@@ -67,7 +67,7 @@ func (p *OffLedgerPool) Get(reqRef *isc.RequestRef) isc.OffLedgerRequest {
67
67
return entry .req
68
68
}
69
69
70
- func (p * OffLedgerPool ) Add (request isc.OffLedgerRequest ) {
70
+ func (p * OffLedgerPool ) Add (request isc.OffLedgerRequest ) bool {
71
71
ref := isc .RequestRefFromRequest (request )
72
72
entry := & OrderedPoolEntry {req : request , ts : time .Now ()}
73
73
account := request .SenderAccount ().String ()
@@ -76,7 +76,7 @@ func (p *OffLedgerPool) Add(request isc.OffLedgerRequest) {
76
76
// add the request to the "request ref" Lookup Table
77
77
if ! p .refLUT .Set (ref .AsKey (), entry ) {
78
78
p .log .Debugf ("NOT ADDED, already exists. reqID: %v as key=%v, senderAccount: " , request .ID (), ref , account )
79
- return // not added already exists
79
+ return true // not added already exists
80
80
}
81
81
82
82
//
@@ -134,14 +134,15 @@ func (p *OffLedgerPool) Add(request isc.OffLedgerRequest) {
134
134
deleted := p .LimitPoolSize ()
135
135
if lo .Contains (deleted , entry ) {
136
136
// this exact request was deleted from the pool, do not update metrics, or mark available
137
- return
137
+ return false
138
138
}
139
139
140
140
//
141
141
// update metrics and signal that the request is available
142
142
p .log .Debugf ("ADD %v as key=%v, senderAccount: %s" , request .ID (), ref , account )
143
143
p .sizeMetric (p .refLUT .Size ())
144
144
p .waitReq .MarkAvailable (request )
145
+ return true
145
146
}
146
147
147
148
// LimitPoolSize drops the txs with the lowest price if the total number of requests is too big
0 commit comments