Skip to content

Commit

Permalink
fix(geometric txmgr test): race condition to set congested blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf committed Aug 6, 2024
1 parent 444333e commit 8583945
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion chainio/txmgr/geometric/geometric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestGeometricTxManager(t *testing.T) {

t.Run("Send 1 tx to congested network", func(t *testing.T) {
h := newTestHarness(t)
h.fakeEthBackend.congestedBlocks = 3
h.fakeEthBackend.setCongestedBlocks(3)
h.txmgr.params.TxnConfirmationTimeout = 1 * time.Second

unsignedTx := newUnsignedEthTransferTx(0, nil)
Expand Down Expand Up @@ -251,6 +251,13 @@ func (s *fakeEthBackend) startMining() {
}()
}

func (s *fakeEthBackend) setCongestedBlocks(n uint64) {
s.mu.Lock()
defer s.mu.Unlock()
s.congestedBlocks = n

}

func (s *fakeEthBackend) BlockNumber(context.Context) (uint64, error) {
s.mu.Lock()
defer s.mu.Unlock()
Expand Down

0 comments on commit 8583945

Please sign in to comment.