@@ -14,6 +14,7 @@ import (
1414
1515 "github.com/iotaledger/hive.go/ds/shrinkingmap"
1616 "github.com/iotaledger/hive.go/logger"
17+
1718 consGR "github.com/iotaledger/wasp/packages/chain/cons/cons_gr"
1819 "github.com/iotaledger/wasp/packages/isc"
1920 "github.com/iotaledger/wasp/packages/kv/codec"
@@ -67,16 +68,16 @@ func (p *OffLedgerPool) Get(reqRef *isc.RequestRef) isc.OffLedgerRequest {
6768 return entry .req
6869}
6970
70- func (p * OffLedgerPool ) Add (request isc.OffLedgerRequest ) {
71+ func (p * OffLedgerPool ) Add (request isc.OffLedgerRequest ) bool {
7172 ref := isc .RequestRefFromRequest (request )
7273 entry := & OrderedPoolEntry {req : request , ts : time .Now ()}
7374 account := request .SenderAccount ().String ()
7475
7576 //
7677 // add the request to the "request ref" Lookup Table
7778 if ! p .refLUT .Set (ref .AsKey (), entry ) {
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+ p .log .Debugf ("OffLedger Request NOT ADDED, already exists. reqID: %v as key=%v, senderAccount: %v " , request .ID (), ref , account )
80+ return true // not added already exists
8081 }
8182
8283 //
@@ -134,14 +135,16 @@ func (p *OffLedgerPool) Add(request isc.OffLedgerRequest) {
134135 deleted := p .LimitPoolSize ()
135136 if lo .Contains (deleted , entry ) {
136137 // this exact request was deleted from the pool, do not update metrics, or mark available
137- return
138+ p .log .Debugf ("OffLedger Request NOT ADDED, was removed already. reqID: %v as key=%v, senderAccount: %v" , request .ID (), ref , account )
139+ return false
138140 }
139141
140142 //
141143 // update metrics and signal that the request is available
142144 p .log .Debugf ("ADD %v as key=%v, senderAccount: %s" , request .ID (), ref , account )
143145 p .sizeMetric (p .refLUT .Size ())
144146 p .waitReq .MarkAvailable (request )
147+ return true
145148}
146149
147150// LimitPoolSize drops the txs with the lowest price if the total number of requests is too big
0 commit comments