mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
eth: add integration test
This commit is contained in:
parent
a199748899
commit
ea977525df
1 changed files with 22 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"context"
|
||||
"crypto/ecdsa"
|
||||
"errors"
|
||||
"math"
|
||||
"math/big"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -130,6 +131,27 @@ func TestSendTx(t *testing.T) {
|
|||
testSendTx(t, true)
|
||||
}
|
||||
|
||||
func TestSendTxEIP2681(t *testing.T) {
|
||||
b := initBackend(false)
|
||||
|
||||
// Test EIP-2681: nonce overflow should be rejected
|
||||
tx := makeTx(uint64(math.MaxUint64), nil, nil, key) // max uint64 nonce
|
||||
err := b.SendTx(context.Background(), tx)
|
||||
if err == nil {
|
||||
t.Fatal("Expected EIP-2681 nonce overflow error, but transaction was accepted")
|
||||
}
|
||||
if !errors.Is(err, core.ErrNonceMax) {
|
||||
t.Errorf("Expected core.ErrNonceMax, got: %v", err)
|
||||
}
|
||||
|
||||
// Test normal case: should succeed
|
||||
normalTx := makeTx(0, nil, nil, key)
|
||||
err = b.SendTx(context.Background(), normalTx)
|
||||
if err != nil {
|
||||
t.Errorf("Normal transaction should succeed, got error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func testSendTx(t *testing.T, withLocal bool) {
|
||||
b := initBackend(withLocal)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue