mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +00:00
Rename sizedDataTransaction to sizedTx
This commit is contained in:
parent
76f79b339d
commit
a31e1acade
1 changed files with 6 additions and 6 deletions
|
|
@ -1217,22 +1217,22 @@ func TestAllowedTxSize(t *testing.T) {
|
||||||
gasLimit := pool.currentHead.Load().GasLimit
|
gasLimit := pool.currentHead.Load().GasLimit
|
||||||
|
|
||||||
// Try adding a transaction with maximal allowed size
|
// Try adding a transaction with maximal allowed size
|
||||||
tx := sizedDataTransaction(t, txMaxSize, 0, gasLimit, key)
|
tx := sizedTx(t, txMaxSize, 0, gasLimit, key)
|
||||||
if err := pool.addRemoteSync(tx); err != nil {
|
if err := pool.addRemoteSync(tx); err != nil {
|
||||||
t.Fatalf("failed to add transaction of size %d, close to maximal: %v", int(tx.Size()), err)
|
t.Fatalf("failed to add transaction of size %d, close to maximal: %v", int(tx.Size()), err)
|
||||||
}
|
}
|
||||||
// Try adding a transaction with random allowed size
|
// Try adding a transaction with random allowed size
|
||||||
tx = sizedDataTransaction(t, txMaxSize/2, 1, gasLimit, key)
|
tx = sizedTx(t, txMaxSize/2, 1, gasLimit, key)
|
||||||
if err := pool.addRemoteSync(tx); err != nil {
|
if err := pool.addRemoteSync(tx); err != nil {
|
||||||
t.Fatalf("failed to add transaction of random allowed size: %v", err)
|
t.Fatalf("failed to add transaction of random allowed size: %v", err)
|
||||||
}
|
}
|
||||||
// Try adding a transaction above maximum size by one
|
// Try adding a transaction above maximum size by one
|
||||||
tx = sizedDataTransaction(t, txMaxSize+1, 2, gasLimit, key)
|
tx = sizedTx(t, txMaxSize+1, 2, gasLimit, key)
|
||||||
if err := pool.addRemoteSync(tx); err == nil {
|
if err := pool.addRemoteSync(tx); err == nil {
|
||||||
t.Fatalf("expected rejection on slightly oversize transaction")
|
t.Fatalf("expected rejection on slightly oversize transaction")
|
||||||
}
|
}
|
||||||
// Try adding a transaction above maximum size by two
|
// Try adding a transaction above maximum size by two
|
||||||
tx = sizedDataTransaction(t, txMaxSize+2, 2, gasLimit, key)
|
tx = sizedTx(t, txMaxSize+2, 2, gasLimit, key)
|
||||||
if err := pool.addRemoteSync(tx); err == nil {
|
if err := pool.addRemoteSync(tx); err == nil {
|
||||||
t.Fatalf("expected rejection on oversize transaction")
|
t.Fatalf("expected rejection on oversize transaction")
|
||||||
}
|
}
|
||||||
|
|
@ -1249,10 +1249,10 @@ func TestAllowedTxSize(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sizedDataTransaction generates a transaction with the size matching the `targetSize` given
|
// sizedTx generates a transaction with the size matching the `targetSize` given
|
||||||
// as argument. It uses the nonce, gasLimit and key given as arguments to generate the transaction.
|
// as argument. It uses the nonce, gasLimit and key given as arguments to generate the transaction.
|
||||||
// Note around 1% of all possible sizes under [txMaxSize] cannot be generated by this function.
|
// Note around 1% of all possible sizes under [txMaxSize] cannot be generated by this function.
|
||||||
func sizedDataTransaction(t *testing.T, targetSize, nonce, gasLimit uint64, key *ecdsa.PrivateKey) (
|
func sizedTx(t *testing.T, targetSize, nonce, gasLimit uint64, key *ecdsa.PrivateKey) (
|
||||||
tx *types.Transaction) {
|
tx *types.Transaction) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
gasPrice := big.NewInt(1)
|
gasPrice := big.NewInt(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue