Skip to content

Commit 71d949e

Browse files
author
Darioush Jalali
committed
update to use commit(true)
1 parent b08c9e0 commit 71d949e

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

ethclient/simulated/backend_test.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ import (
2727
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
2828
"github.com/ava-labs/subnet-evm/core/types"
2929
"github.com/ava-labs/subnet-evm/params"
30-
"github.com/ava-labs/subnet-evm/rpc"
3130
"github.com/ethereum/go-ethereum/common"
3231
"github.com/ethereum/go-ethereum/crypto"
33-
"github.com/stretchr/testify/require"
3432
)
3533

3634
var _ bind.ContractBackend = (Client)(nil)
@@ -216,18 +214,13 @@ func TestForkResendTx(t *testing.T) {
216214
t.Fatalf("could not create transaction: %v", err)
217215
}
218216
client.SendTransaction(ctx, tx)
219-
sim.Commit(false)
217+
sim.Commit(true)
220218

221219
// 3.
222-
// Note this test is revised from upstream since we cannot get the receipt
223-
// for a pending transaction. (Receipts only written for accepted blocks).
224-
require := require.New(t)
225-
pendingBlockNum := big.NewInt(int64(rpc.PendingBlockNumber))
226-
b1, err := client.BlockByNumber(ctx, pendingBlockNum)
227-
require.NoError(err)
228-
require.Len(b1.Transactions(), 1)
229-
require.Equal(tx.Hash(), b1.Transactions()[0].Hash())
230-
require.Equal(uint64(1), b1.NumberU64())
220+
receipt, _ := client.TransactionReceipt(ctx, tx.Hash())
221+
if h := receipt.BlockNumber.Uint64(); h != 1 {
222+
t.Errorf("TX included in wrong block: %d", h)
223+
}
231224

232225
// 4.
233226
if err := sim.Fork(parent.Hash()); err != nil {
@@ -240,7 +233,7 @@ func TestForkResendTx(t *testing.T) {
240233
t.Fatalf("sending transaction: %v", err)
241234
}
242235
sim.Commit(true)
243-
receipt, _ := client.TransactionReceipt(ctx, tx.Hash())
236+
receipt, _ = client.TransactionReceipt(ctx, tx.Hash())
244237
if h := receipt.BlockNumber.Uint64(); h != 2 {
245238
t.Errorf("TX included in wrong block: %d", h)
246239
}

0 commit comments

Comments
 (0)