Skip to content

Commit

Permalink
eth/tracers: fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed May 4, 2023
1 parent 7b0c45d commit 000dcdc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions eth/tracers/api_test.go
Expand Up @@ -384,12 +384,14 @@ func TestTraceBlock(t *testing.T) {
}
genBlocks := 10
signer := types.HomesteadSigner{}
var txHash common.Hash
backend := newTestBackend(t, genBlocks, genesis, func(i int, b *core.BlockGen) {
// Transfer from account[0] to account[1]
// value: 1000 wei
// fee: 0 wei
tx, _ := types.SignTx(types.NewTransaction(uint64(i), accounts[1].addr, big.NewInt(1000), params.TxGas, b.BaseFee(), nil), signer, accounts[0].key)
b.AddTx(tx)
txHash = tx.Hash()
})
defer backend.chain.Stop()
api := NewAPI(backend)
Expand All @@ -408,7 +410,7 @@ func TestTraceBlock(t *testing.T) {
// Trace head block
{
blockNumber: rpc.BlockNumber(genBlocks),
want: `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`,
want: fmt.Sprintf(`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`, txHash),
},
// Trace non-existent block
{
Expand All @@ -418,12 +420,12 @@ func TestTraceBlock(t *testing.T) {
// Trace latest block
{
blockNumber: rpc.LatestBlockNumber,
want: `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`,
want: fmt.Sprintf(`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`, txHash),
},
// Trace pending block
{
blockNumber: rpc.PendingBlockNumber,
want: `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`,
want: fmt.Sprintf(`[{"txHash":"%v","result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`, txHash),
},
}
for i, tc := range testSuite {
Expand Down

0 comments on commit 000dcdc

Please sign in to comment.