This repository was archived by the owner on Jun 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ const (
35
35
// Comet CheckTX and when.
36
36
type CometRemoteCache interface {
37
37
IsRemoteTx (txHash common.Hash ) bool
38
- MarkRemoteSeen (txHash common.Hash )
38
+ MarkRemoteSeen (txHash common.Hash ) bool
39
39
TimeFirstSeen (txHash common.Hash ) int64 // Unix timestamp
40
40
}
41
41
@@ -56,8 +56,12 @@ func (crc *cometRemoteCache) IsRemoteTx(txHash common.Hash) bool {
56
56
}
57
57
58
58
// Record the time the tx was inserted from Comet successfully.
59
- func (crc * cometRemoteCache ) MarkRemoteSeen (txHash common.Hash ) {
60
- crc .timeInserted .Add (txHash , time .Now ().Unix ())
59
+ func (crc * cometRemoteCache ) MarkRemoteSeen (txHash common.Hash ) bool {
60
+ if ! crc .timeInserted .Contains (txHash ) {
61
+ crc .timeInserted .Add (txHash , time .Now ().Unix ())
62
+ return true
63
+ }
64
+ return false
61
65
}
62
66
63
67
func (crc * cometRemoteCache ) TimeFirstSeen (txHash common.Hash ) int64 {
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ func (m *Mempool) Insert(ctx context.Context, sdkTx sdk.Tx) error {
140
140
}
141
141
142
142
// Add the eth tx to the remote cache.
143
- m .crc .MarkRemoteSeen (ethTx .Hash ())
143
+ _ = m .crc .MarkRemoteSeen (ethTx .Hash ())
144
144
145
145
return nil
146
146
}
@@ -157,6 +157,6 @@ func (m *Mempool) Select(context.Context, [][]byte) mempool.Iterator {
157
157
}
158
158
159
159
// Remove is an intentional no-op as the eth txpool handles removals.
160
- func (m * Mempool ) Remove (tx sdk.Tx ) error {
160
+ func (m * Mempool ) Remove (_ sdk.Tx ) error {
161
161
return nil
162
162
}
You can’t perform that action at this time.
0 commit comments