eth: fix SendTx

This commit is contained in:
Gary Rong 2025-05-08 15:06:22 +08:00
parent b853a2f50c
commit b4525261d3

View file

@ -134,13 +134,17 @@ func TestSendTx(t *testing.T) {
func testSendTx(t *testing.T, withLocal bool) { func testSendTx(t *testing.T, withLocal bool) {
b := initBackend(withLocal) b := initBackend(withLocal)
txA := pricedSetCodeTx(0, 250000, uint256.NewInt(params.GWei), uint256.NewInt(params.GWei), key, []unsignedAuth{ txA := pricedSetCodeTx(0, 250000, uint256.NewInt(params.GWei), uint256.NewInt(params.GWei), key, []unsignedAuth{{nonce: 0, key: key}})
{ if err := b.SendTx(context.Background(), txA); err != nil {
nonce: 0, t.Fatalf("Failed to submit tx: %v", err)
key: key, }
}, for {
}) pending, _ := b.TxPool().ContentFrom(address)
b.SendTx(context.Background(), txA) if len(pending) == 1 {
break
}
time.Sleep(100 * time.Millisecond)
}
txB := makeTx(1, nil, nil, key) txB := makeTx(1, nil, nil, key)
err := b.SendTx(context.Background(), txB) err := b.SendTx(context.Background(), txB)