@@ -14,6 +14,7 @@ import (
14
14
15
15
"github.com/iotaledger/hive.go/ds/shrinkingmap"
16
16
"github.com/iotaledger/hive.go/logger"
17
+
17
18
consGR "github.com/iotaledger/wasp/packages/chain/cons/cons_gr"
18
19
"github.com/iotaledger/wasp/packages/isc"
19
20
"github.com/iotaledger/wasp/packages/kv/codec"
@@ -67,16 +68,16 @@ func (p *OffLedgerPool) Get(reqRef *isc.RequestRef) isc.OffLedgerRequest {
67
68
return entry .req
68
69
}
69
70
70
- func (p * OffLedgerPool ) Add (request isc.OffLedgerRequest ) {
71
+ func (p * OffLedgerPool ) Add (request isc.OffLedgerRequest ) bool {
71
72
ref := isc .RequestRefFromRequest (request )
72
73
entry := & OrderedPoolEntry {req : request , ts : time .Now ()}
73
74
account := request .SenderAccount ().String ()
74
75
75
76
//
76
77
// add the request to the "request ref" Lookup Table
77
78
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
80
81
}
81
82
82
83
//
@@ -134,14 +135,16 @@ func (p *OffLedgerPool) Add(request isc.OffLedgerRequest) {
134
135
deleted := p .LimitPoolSize ()
135
136
if lo .Contains (deleted , entry ) {
136
137
// 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
138
140
}
139
141
140
142
//
141
143
// update metrics and signal that the request is available
142
144
p .log .Debugf ("ADD %v as key=%v, senderAccount: %s" , request .ID (), ref , account )
143
145
p .sizeMetric (p .refLUT .Size ())
144
146
p .waitReq .MarkAvailable (request )
147
+ return true
145
148
}
146
149
147
150
// LimitPoolSize drops the txs with the lowest price if the total number of requests is too big
0 commit comments