apply changes across all pkgs

This commit is contained in:
Ian Norden
2020-07-03 14:26:02 -05:00
parent 910f8fb071
commit 2193a29246
2 changed files with 4 additions and 10 deletions
+4 -4
View File
@@ -3904,20 +3904,20 @@ func TestTransactionAllowedTxSize(t *testing.T) {
dataSize := txMaxSize - baseSize
// Try adding a transaction with maximal allowed size
tx := pricedDataTransaction(0, pool.currentMaxGas, big.NewInt(1), key, dataSize)
tx := pricedDataTransaction(0, pool.currentLegacyMaxGas, big.NewInt(1), key, dataSize)
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
if err := pool.addRemoteSync(pricedDataTransaction(1, pool.currentMaxGas, big.NewInt(1), key, uint64(rand.Intn(int(dataSize))))); err != nil {
if err := pool.addRemoteSync(pricedDataTransaction(1, pool.currentLegacyMaxGas, big.NewInt(1), key, uint64(rand.Intn(int(dataSize))))); err != nil {
t.Fatalf("failed to add transaction of random allowed size: %v", err)
}
// Try adding a transaction of minimal not allowed size
if err := pool.addRemoteSync(pricedDataTransaction(2, pool.currentMaxGas, big.NewInt(1), key, txMaxSize)); err == nil {
if err := pool.addRemoteSync(pricedDataTransaction(2, pool.currentLegacyMaxGas, big.NewInt(1), key, txMaxSize)); err == nil {
t.Fatalf("expected rejection on slightly oversize transaction")
}
// Try adding a transaction of random not allowed size
if err := pool.addRemoteSync(pricedDataTransaction(2, pool.currentMaxGas, big.NewInt(1), key, dataSize+1+uint64(rand.Intn(int(10*txMaxSize))))); err == nil {
if err := pool.addRemoteSync(pricedDataTransaction(2, pool.currentLegacyMaxGas, big.NewInt(1), key, dataSize+1+uint64(rand.Intn(int(10*txMaxSize))))); err == nil {
t.Fatalf("expected rejection on oversize transaction")
}
// Run some sanity checks on the pool internals
-6
View File
@@ -158,12 +158,6 @@ func (tx *Transaction) EncodeRLP(w io.Writer) error {
return rlp.Encode(w, &tx.data)
}
/*
DecodeRLP should decode the rlp.Stream value into individual fields first, then build the resulting struct.
If decoding the gasPremiums value returns an EOL error, then this is a legacy transaction.
This allows legacy RLP-encoded transactions to be decoded while properly handling errors
*/
// DecodeRLP implements rlp.Decoder
func (tx *Transaction) DecodeRLP(stream *rlp.Stream) error {
size, err := stream.List()