Merged accounts and contracts in to StateObject

* Account removed
* Contract removed
* Address state changed to CachedStateObject
* Added StateObject
This commit is contained in:
obscuren
2014-04-16 04:06:51 +02:00
parent ca13e3b105
commit 9c6aca7893
11 changed files with 219 additions and 300 deletions

View File

@ -142,12 +142,13 @@ func (block *Block) PayFee(addr []byte, fee *big.Int) bool {
data := block.state.trie.Get(string(block.Coinbase))
// Get the ether (Coinbase) and add the fee (gief fee to miner)
ether := NewAccountFromData(block.Coinbase, []byte(data))
account := NewStateObjectFromBytes(block.Coinbase, []byte(data))
base = new(big.Int)
ether.Amount = base.Add(ether.Amount, fee)
account.Amount = base.Add(account.Amount, fee)
block.state.trie.Update(string(block.Coinbase), string(ether.RlpEncode()))
//block.state.trie.Update(string(block.Coinbase), string(ether.RlpEncode()))
block.state.UpdateStateObject(account)
return true
}