diff options
author | Determinant <[email protected]> | 2020-09-20 14:37:49 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-09-20 14:37:49 -0400 |
commit | 3c8282bebe65b493ffb55fe9bce81ffd34fe7975 (patch) | |
tree | 158b219dc1e4093955028638d495d9a9ebfe1c2a /core/state | |
parent | 99431861078d78289c6513005e8c173be289843a (diff) |
minor change to properly journal the IsMultiCoin flag
Diffstat (limited to 'core/state')
-rw-r--r-- | core/state/journal.go | 2 | ||||
-rw-r--r-- | core/state/state_object.go | 28 |
2 files changed, 15 insertions, 15 deletions
diff --git a/core/state/journal.go b/core/state/journal.go index be27493..0cc556b 100644 --- a/core/state/journal.go +++ b/core/state/journal.go @@ -185,7 +185,7 @@ func (ch balanceChange) dirtied() *common.Address { } func (ch multiCoinEnable) revert(s *StateDB) { - //s.getStateObject(*ch.account).data.IsMultiCoin = false + s.getStateObject(*ch.account).data.IsMultiCoin = false } func (ch multiCoinEnable) dirtied() *common.Address { diff --git a/core/state/state_object.go b/core/state/state_object.go index bbfff1d..f5c2ff3 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -430,7 +430,7 @@ func (s *stateObject) SubBalanceMultiCoin(coinID common.Hash, amount *big.Int, d } func (s *stateObject) SetBalanceMultiCoin(coinID common.Hash, amount *big.Int, db Database) { - s.data.IsMultiCoin = true + s.EnableMultiCoin() NormalizeCoinID(&coinID) s.SetState(db, coinID, common.BigToHash(amount)) } @@ -439,9 +439,9 @@ func (s *stateObject) setBalance(amount *big.Int) { s.data.Balance = amount } -//func (s *stateObject) enableMultiCoin() { -// s.data.IsMultiCoin = true -//} +func (s *stateObject) enableMultiCoin() { + s.data.IsMultiCoin = true +} // Return the gas back to the origin. Used by the Virtual machine or Closures func (s *stateObject) ReturnGas(gas *big.Int) {} @@ -556,16 +556,16 @@ func (s *stateObject) BalanceMultiCoin(coinID common.Hash, db Database) *big.Int return s.GetState(db, coinID).Big() } -//func (s *stateObject) EnableMultiCoin() bool { -// if s.data.IsMultiCoin { -// return false -// } -// s.db.journal.append(multiCoinEnable{ -// account: &s.address, -// }) -// s.enableMultiCoin() -// return true -//} +func (s *stateObject) EnableMultiCoin() bool { + if s.data.IsMultiCoin { + return false + } + s.db.journal.append(multiCoinEnable{ + account: &s.address, + }) + s.enableMultiCoin() + return true +} //func (s *stateObject) IsMultiCoin() bool { // return s.data.IsMultiCoin |