Skip to content

Commit cfa9bf2

Browse files
authored
chains/txmgr: fix broadcaster race (#34)
1 parent 8e9cc6b commit cfa9bf2

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

chains/txmgr/broadcaster.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,20 @@ func (eb *Broadcaster[CID, HEAD, ADDR, THASH, BHASH, SEQ, FEE]) HealthReport() m
253253
// Trigger forces the monitor for a particular address to recheck for new txes
254254
// Logs error and does nothing if address was not registered on startup
255255
func (eb *Broadcaster[CID, HEAD, ADDR, THASH, BHASH, SEQ, FEE]) Trigger(addr ADDR) {
256-
if eb.isStarted {
257-
triggerCh, exists := eb.triggers[addr]
258-
if !exists {
259-
// ignoring trigger for address which is not registered with this Broadcaster
260-
return
261-
}
262-
select {
263-
case triggerCh <- struct{}{}:
264-
default:
265-
}
266-
} else {
256+
eb.initSync.Lock()
257+
defer eb.initSync.Unlock()
258+
if !eb.isStarted {
267259
eb.lggr.Debugf("Unstarted; ignoring trigger for %s", addr)
268260
}
261+
triggerCh, exists := eb.triggers[addr]
262+
if !exists {
263+
// ignoring trigger for address which is not registered with this Broadcaster
264+
return
265+
}
266+
select {
267+
case triggerCh <- struct{}{}:
268+
default:
269+
}
269270
}
270271

271272
func (eb *Broadcaster[CID, HEAD, ADDR, THASH, BHASH, SEQ, FEE]) newResendBackoff() backoff.Backoff {

tools/evm-chain-bindings/go.mod

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ go 1.22.5
44

55
require github.com/stretchr/testify v1.9.0
66

7-
require github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240903151153-2a21b170f38d
7+
require (
8+
github.com/ethereum/go-ethereum v1.13.8
9+
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240903151153-2a21b170f38d
10+
)
811

912
require (
1013
github.com/DataDog/zstd v1.5.2 // indirect
@@ -13,6 +16,7 @@ require (
1316
github.com/beorn7/perks v1.0.1 // indirect
1417
github.com/bits-and-blooms/bitset v1.10.0 // indirect
1518
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
19+
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
1620
github.com/cespare/xxhash/v2 v2.3.0 // indirect
1721
github.com/cockroachdb/errors v1.9.1 // indirect
1822
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
@@ -69,6 +73,7 @@ require (
6973
github.com/rogpeppe/go-internal v1.12.0 // indirect
7074
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
7175
github.com/shopspring/decimal v1.4.0 // indirect
76+
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830180817-6a0f3d1e0f9e // indirect
7277
github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 // indirect
7378
github.com/status-im/keycard-go v0.2.0 // indirect
7479
github.com/supranational/blst v0.3.11 // indirect
@@ -100,10 +105,4 @@ require (
100105
rsc.io/tmplfunc v0.0.3 // indirect
101106
)
102107

103-
require (
104-
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
105-
github.com/ethereum/go-ethereum v1.13.8
106-
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240830180817-6a0f3d1e0f9e // indirect
107-
)
108-
109108
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

0 commit comments

Comments
 (0)