mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
core: fix refund
This commit is contained in:
parent
fc3ee373ab
commit
3bfdefbacc
1 changed files with 12 additions and 4 deletions
|
|
@ -235,6 +235,18 @@ func (self *StateDB) AddRefund(gas *big.Int) {
|
||||||
self.refund.Add(self.refund, gas)
|
self.refund.Add(self.refund, gas)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StateDB) GetRefund() *big.Int {
|
||||||
|
var refund *big.Int
|
||||||
|
if s.MarkedTransition {
|
||||||
|
return new(big.Int)
|
||||||
|
} else if s.parent == nil {
|
||||||
|
refund = new(big.Int)
|
||||||
|
} else {
|
||||||
|
refund = s.parent.GetRefund()
|
||||||
|
}
|
||||||
|
return refund.Add(refund, s.refund)
|
||||||
|
}
|
||||||
|
|
||||||
func (self *StateDB) HasAccount(addr common.Address) bool {
|
func (self *StateDB) HasAccount(addr common.Address) bool {
|
||||||
return self.GetStateObject(addr) != nil
|
return self.GetStateObject(addr) != nil
|
||||||
}
|
}
|
||||||
|
|
@ -488,10 +500,6 @@ func (self *StateDB) Set(state *StateDB) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *StateDB) GetRefund() *big.Int {
|
|
||||||
return self.refund
|
|
||||||
}
|
|
||||||
|
|
||||||
// IntermediateRoot computes the current root hash of the state trie.
|
// IntermediateRoot computes the current root hash of the state trie.
|
||||||
// It is called in between transactions to get the root hash that
|
// It is called in between transactions to get the root hash that
|
||||||
// goes into transaction receipts.
|
// goes into transaction receipts.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue