Rename sizedDataTransaction to sizedTx
This commit is contained in:
parent
76f79b339d
commit
a31e1acade
|
@ -1217,22 +1217,22 @@ func TestAllowedTxSize(t *testing.T) {
|
|||
gasLimit := pool.currentHead.Load().GasLimit
|
||||
|
||||
// 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 {
|
||||
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
|
||||
tx = sizedDataTransaction(t, txMaxSize/2, 1, gasLimit, key)
|
||||
tx = sizedTx(t, txMaxSize/2, 1, gasLimit, key)
|
||||
if err := pool.addRemoteSync(tx); err != nil {
|
||||
t.Fatalf("failed to add transaction of random allowed size: %v", err)
|
||||
}
|
||||
// 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 {
|
||||
t.Fatalf("expected rejection on slightly oversize transaction")
|
||||
}
|
||||
// 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 {
|
||||
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.
|
||||
// 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) {
|
||||
t.Helper()
|
||||
gasPrice := big.NewInt(1)
|
||||
|
|
Loading…
Reference in New Issue