diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-14 00:47:11 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-14 00:47:11 +0800 |
commit | 03403399fcd4abf106a098f15bc7186197bd09bc (patch) | |
tree | b5ebbf0330c6cc2d6aff3100511c4843c2d8593a | |
parent | a0266489b4592af751d87c59087ed25a32899de6 (diff) | |
download | go-tangerine-03403399fcd4abf106a098f15bc7186197bd09bc.tar go-tangerine-03403399fcd4abf106a098f15bc7186197bd09bc.tar.gz go-tangerine-03403399fcd4abf106a098f15bc7186197bd09bc.tar.bz2 go-tangerine-03403399fcd4abf106a098f15bc7186197bd09bc.tar.lz go-tangerine-03403399fcd4abf106a098f15bc7186197bd09bc.tar.xz go-tangerine-03403399fcd4abf106a098f15bc7186197bd09bc.tar.zst go-tangerine-03403399fcd4abf106a098f15bc7186197bd09bc.zip |
Return proper error
-rw-r--r-- | core/chain_manager.go | 2 | ||||
-rw-r--r-- | core/error.go | 2 | ||||
-rw-r--r-- | core/state_transition.go | 3 | ||||
-rw-r--r-- | miner/worker.go | 1 |
4 files changed, 7 insertions, 1 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index 7fed7b8b1..101d0568d 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -449,6 +449,8 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error { */ self.setTransState(state.New(block.Root(), self.stateDb)) + self.setTxState(state.New(block.Root(), self.stateDb)) + queue[i] = ChainEvent{block} queueEvent.canonicalCount++ } else { diff --git a/core/error.go b/core/error.go index 04e40646c..69e320eb0 100644 --- a/core/error.go +++ b/core/error.go @@ -78,7 +78,7 @@ func (err *NonceErr) Error() string { } func NonceError(is, exp uint64) *NonceErr { - return &NonceErr{Message: fmt.Sprintf("Nonce err. Is %d, expected %d", is, exp), Is: is, Exp: exp} + return &NonceErr{Message: fmt.Sprintf("Transaction w/ invalid nonce (%d / %d)", is, exp), Is: is, Exp: exp} } func IsNonceErr(err error) bool { diff --git a/core/state_transition.go b/core/state_transition.go index ee99ec7aa..f49aed874 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -148,6 +148,9 @@ func (self *StateTransition) preCheck() (err error) { // Pre-pay gas / Buy gas of the coinbase account if err = self.BuyGas(); err != nil { + if state.IsGasLimitErr(err) { + return err + } return InvalidTxError(err) } diff --git a/miner/worker.go b/miner/worker.go index 9bcea1539..a39a0b43b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -212,6 +212,7 @@ gasLimit: fallthrough case core.IsInvalidTxErr(err): // Remove invalid transactions + self.chain.TxState().RemoveNonce(tx.From(), tx.Nonce()) remove = append(remove, tx) case state.IsGasLimitErr(err): // Break on gas limit |