diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-05 17:25:29 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-05 17:25:29 +0800 |
commit | 12643c7c5769ee8ed31b9df4556b6ede1cf2db80 (patch) | |
tree | a13f007f95251bebe8e19ed2bcbc04126c96c424 /ethchain/state_manager.go | |
parent | 782910eaa76bb31be4c2bcd0f4505b8085acb57c (diff) | |
parent | 90bb512f420f204f50ba451a4a25682ca8443746 (diff) | |
download | dexon-12643c7c5769ee8ed31b9df4556b6ede1cf2db80.tar dexon-12643c7c5769ee8ed31b9df4556b6ede1cf2db80.tar.gz dexon-12643c7c5769ee8ed31b9df4556b6ede1cf2db80.tar.bz2 dexon-12643c7c5769ee8ed31b9df4556b6ede1cf2db80.tar.lz dexon-12643c7c5769ee8ed31b9df4556b6ede1cf2db80.tar.xz dexon-12643c7c5769ee8ed31b9df4556b6ede1cf2db80.tar.zst dexon-12643c7c5769ee8ed31b9df4556b6ede1cf2db80.zip |
Merge branch 'develop' into miner
Diffstat (limited to 'ethchain/state_manager.go')
-rw-r--r-- | ethchain/state_manager.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go index 78fcb2c2f..4b0ea2515 100644 --- a/ethchain/state_manager.go +++ b/ethchain/state_manager.go @@ -112,13 +112,18 @@ func (sm *StateManager) ApplyTransactions(block *Block, txs []*Transaction) { // Figure out if the address this transaction was sent to is a // contract or an actual account. In case of a contract, we process that // contract instead of moving funds between accounts. + var err error if contract := sm.procState.GetContract(tx.Recipient); contract != nil { - sm.ProcessContract(contract, tx, block) - } else { - err := sm.Ethereum.TxPool().ProcessTransaction(tx, block) - if err != nil { - ethutil.Config.Log.Infoln("[STATE]", err) + err = sm.Ethereum.TxPool().ProcessTransaction(tx, sm.procState, true) + if err == nil { + sm.ProcessContract(contract, tx, block) } + } else { + err = sm.Ethereum.TxPool().ProcessTransaction(tx, sm.procState, false) + } + + if err != nil { + ethutil.Config.Log.Infoln("[STATE]", err) } } } @@ -323,4 +328,7 @@ func (sm *StateManager) ProcessContract(contract *Contract, tx *Transaction, blo txData: nil, }) closure.Call(vm, nil) + + // Update the account (refunds) + sm.procState.UpdateAccount(tx.Sender(), caller) } |