diff --git a/evmcore/tx_pool.go b/evmcore/tx_pool.go index a079c3aa8..fdd716f29 100644 --- a/evmcore/tx_pool.go +++ b/evmcore/tx_pool.go @@ -134,6 +134,8 @@ type stateReader interface { MaxGasLimit() uint64 SubscribeNewBlock(ch chan<- ChainHeadNotify) notify.Subscription + + TxExists(common.Hash) bool } // TxPoolConfig are the configuration parameters of the transaction pool. @@ -567,6 +569,9 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if pool.chain.MinGasPrice().Cmp(tx.GasPrice()) > 0 { return ErrUnderpriced } + if pool.chain.TxExists(tx.Hash()) { + return ErrUnderpriced + } // Ensure the transaction adheres to nonce ordering if pool.currentState.GetNonce(from) > tx.Nonce() { return ErrNonceTooLow diff --git a/evmcore/tx_pool_test.go b/evmcore/tx_pool_test.go index f7375d95b..5f8448dd1 100644 --- a/evmcore/tx_pool_test.go +++ b/evmcore/tx_pool_test.go @@ -59,6 +59,10 @@ func (bc *testBlockChain) MaxGasLimit() uint64 { return bc.CurrentBlock().GasLimit } +func (bc *testBlockChain) TxExists(common.Hash) bool { + return false +} + func (bc *testBlockChain) CurrentBlock() *EvmBlock { b := &EvmBlock{} b.Number = big.NewInt(0) diff --git a/gossip/evm_state_reader.go b/gossip/evm_state_reader.go index e9df3b0a4..ec346ab35 100644 --- a/gossip/evm_state_reader.go +++ b/gossip/evm_state_reader.go @@ -138,3 +138,7 @@ func (r *EvmStateReader) getBlock(h hash.Event, n idx.Block, readTxs bool) *evmc func (r *EvmStateReader) StateAt(root common.Hash) (*state.StateDB, error) { return r.store.evm.StateDB(hash.Hash(root)) } + +func (r *EvmStateReader) TxExists(txid common.Hash) bool { + return r.store.EvmStore().GetTxPosition(txid) != nil +} diff --git a/version/version.go b/version/version.go index 3703e45be..cadf4d9a0 100644 --- a/version/version.go +++ b/version/version.go @@ -11,7 +11,7 @@ func init() { params.VersionMajor = 1 // Major version component of the current release params.VersionMinor = 0 // Minor version component of the current release params.VersionPatch = 0 // Patch version component of the current release - params.VersionMeta = "rc.1" // Version metadata to append to the version string + params.VersionMeta = "rc.2" // Version metadata to append to the version string } func BigToString(b *big.Int) string {