Skip to content

Commit

Permalink
ethclient/simulated: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Sep 20, 2024
1 parent 3c2c0d2 commit b245f47
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ethclient/simulated/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ func TestFork(t *testing.T) {
// 2. Send a transaction.
// 3. Check that the TX is included in block 1.
// 4. Fork by using the parent block as ancestor.
// 5. Mine a block, Re-send the transaction and mine another one.
// 6. Check that the TX is now included in block 2.
// 5. Mine a block. We expect the out-forked tx to have trickled to the pool, and into the new block.
// 6. Check that the TX is now included in (the new) block 1.
func TestForkResendTx(t *testing.T) {
t.Parallel()
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
Expand Down Expand Up @@ -228,15 +228,13 @@ func TestForkResendTx(t *testing.T) {
if err := sim.Fork(parent.Hash()); err != nil {
t.Errorf("forking: %v", err)
}

// 5.
sim.Commit()
if err := client.SendTransaction(ctx, tx); err != nil {
t.Fatalf("sending transaction: %v", err)
t.Logf("sending transaction: %v", err)
}
sim.Commit()
receipt, _ = client.TransactionReceipt(ctx, tx.Hash())
if h := receipt.BlockNumber.Uint64(); h != 2 {
if h := receipt.BlockNumber.Uint64(); h != 1 {
t.Errorf("TX included in wrong block: %d", h)
}
}
Expand Down

0 comments on commit b245f47

Please sign in to comment.