diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-04-06 19:58:03 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-04-06 22:34:19 +0800 |
commit | 158d603528d2ba36b633a8f22a2bff8329f69717 (patch) | |
tree | 7e95ceca2b57686e766182b6e6d14fe10704dcf8 /miner | |
parent | 702bef8493f0f3486072f1a7593fa582a1fb53d0 (diff) | |
download | go-tangerine-158d603528d2ba36b633a8f22a2bff8329f69717.tar go-tangerine-158d603528d2ba36b633a8f22a2bff8329f69717.tar.gz go-tangerine-158d603528d2ba36b633a8f22a2bff8329f69717.tar.bz2 go-tangerine-158d603528d2ba36b633a8f22a2bff8329f69717.tar.lz go-tangerine-158d603528d2ba36b633a8f22a2bff8329f69717.tar.xz go-tangerine-158d603528d2ba36b633a8f22a2bff8329f69717.tar.zst go-tangerine-158d603528d2ba36b633a8f22a2bff8329f69717.zip |
consensus, core: drop all the legacy custom core error types
Diffstat (limited to 'miner')
-rw-r--r-- | miner/worker.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/miner/worker.go b/miner/worker.go index b2183b77d..8a67b12a6 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -503,13 +503,13 @@ func (self *worker) commitNewWork() { func (self *worker) commitUncle(work *Work, uncle *types.Header) error { hash := uncle.Hash() if work.uncles.Has(hash) { - return core.UncleError("uncle not unique") + return fmt.Errorf("uncle not unique") } if !work.ancestors.Has(uncle.ParentHash) { - return core.UncleError(fmt.Sprintf("uncle's parent unknown (%x)", uncle.ParentHash[0:4])) + return fmt.Errorf("uncle's parent unknown (%x)", uncle.ParentHash[0:4]) } if work.family.Has(hash) { - return core.UncleError(fmt.Sprintf("uncle already in family (%x)", hash)) + return fmt.Errorf("uncle already in family (%x)", hash) } work.uncles.Add(uncle.Hash()) return nil @@ -554,23 +554,23 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB env.state.StartRecord(tx.Hash(), common.Hash{}, env.tcount) err, logs := env.commitTransaction(tx, bc, gp) - switch { - case core.IsGasLimitErr(err): + switch err { + case core.ErrGasLimitReached: // Pop the current out-of-gas transaction without shifting in the next from the account log.Trace("Gas limit exceeded for current block", "sender", from) txs.Pop() - case err != nil: - // Pop the current failed transaction without shifting in the next from the account - log.Trace("Transaction failed, will be removed", "hash", tx.Hash(), "err", err) - env.failedTxs = append(env.failedTxs, tx) - txs.Pop() - - default: + case nil: // Everything ok, collect the logs and shift in the next transaction from the same account coalescedLogs = append(coalescedLogs, logs...) env.tcount++ txs.Shift() + + default: + // Pop the current failed transaction without shifting in the next from the account + log.Trace("Transaction failed, will be removed", "hash", tx.Hash(), "err", err) + env.failedTxs = append(env.failedTxs, tx) + txs.Pop() } } |