Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

Add first pass change to tx rejection #299

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,11 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
if tx.Value().Sign() < 0 {
return ErrNegativeValue
}
// Ensure the transaction doesn't exceed the current block limit gas.
if pool.currentMaxGas < tx.Gas() {
return ErrGasLimit
if !vm.UsingOVM {
// Ensure the transaction doesn't exceed the current block limit gas.
if pool.currentMaxGas < tx.Gas() {
return ErrGasLimit
}
}
// Make sure the transaction is signed properly
from, err := types.Sender(pool.signer, tx)
Expand All @@ -558,6 +560,14 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
// Transactor should have enough funds to cover the costs
// cost == V + GP * GL
if vm.UsingOVM {
// TODO: Update syntax to add rejection logic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to check for overflows in this logic when implementing!

// gasLimit = api.DoEstimateGas(tx)
// if tx.GasPrice() < fixedGasPrice {
// return ErrInsufficientFunds
// }
// if tx.GasLimit < gasLimit {
// return ErrInsufficientFunds
// }
if pool.currentState.GetOVMBalance(from).Cmp(tx.Cost()) < 0 {
return ErrInsufficientFunds
}
Expand Down