aboutsummaryrefslogtreecommitdiffstats
path: root/miner/worker.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-11 23:32:37 +0800
committerobscuren <geffobscura@gmail.com>2015-03-11 23:32:37 +0800
commit7add66c8bba3b3ad8bcc0bab4a0344c7682b7303 (patch)
treea4289398d613a3f1c79a12cfa28a816ec720799a /miner/worker.go
parent6bca40274f2056b8516543d8cc1600224789b77f (diff)
downloadgo-tangerine-7add66c8bba3b3ad8bcc0bab4a0344c7682b7303.tar
go-tangerine-7add66c8bba3b3ad8bcc0bab4a0344c7682b7303.tar.gz
go-tangerine-7add66c8bba3b3ad8bcc0bab4a0344c7682b7303.tar.bz2
go-tangerine-7add66c8bba3b3ad8bcc0bab4a0344c7682b7303.tar.lz
go-tangerine-7add66c8bba3b3ad8bcc0bab4a0344c7682b7303.tar.xz
go-tangerine-7add66c8bba3b3ad8bcc0bab4a0344c7682b7303.tar.zst
go-tangerine-7add66c8bba3b3ad8bcc0bab4a0344c7682b7303.zip
Use the state to up the balance of the coinbase
Diffstat (limited to 'miner/worker.go')
-rw-r--r--miner/worker.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/miner/worker.go b/miner/worker.go
index 21a0522e8..61091f3c0 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -209,6 +209,8 @@ gasLimit:
err := self.commitTransaction(tx)
switch {
case core.IsNonceErr(err):
+ fallthrough
+ case core.IsInvalidTxErr(err):
// Remove invalid transactions
remove = append(remove, tx)
case state.IsGasLimitErr(err):
@@ -222,7 +224,7 @@ gasLimit:
}
self.eth.TxPool().RemoveSet(remove)
- self.current.coinbase.AddBalance(core.BlockReward)
+ self.current.state.AddBalance(self.coinbase, core.BlockReward)
self.current.state.Update(ethutil.Big0)
self.push()
@@ -258,9 +260,11 @@ func (self *worker) commitUncle(uncle *types.Header) error {
}
func (self *worker) commitTransaction(tx *types.Transaction) error {
+ snap := self.current.state.Copy()
//fmt.Printf("proc %x %v\n", tx.Hash()[:3], tx.Nonce())
receipt, _, err := self.proc.ApplyTransaction(self.current.coinbase, self.current.state, self.current.block, tx, self.current.totalUsedGas, true)
- if err != nil && (core.IsNonceErr(err) || state.IsGasLimitErr(err)) {
+ if err != nil && (core.IsNonceErr(err) || state.IsGasLimitErr(err) || core.IsInvalidTxErr(err)) {
+ self.current.state.Set(snap)
return err
}