|
|
@ -144,6 +144,10 @@ func (s *State) ComputeBlockStateHash(block *types.Block) error { |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
func (s *State) SetDB(db dbm.DB) { |
|
|
|
s.DB = db |
|
|
|
} |
|
|
|
|
|
|
|
//-------------------------------------
|
|
|
|
// State.accounts
|
|
|
|
|
|
|
@ -178,6 +182,11 @@ func (s *State) GetAccounts() merkle.Tree { |
|
|
|
return s.accounts.Copy() |
|
|
|
} |
|
|
|
|
|
|
|
// Set the accounts tree
|
|
|
|
func (s *State) SetAccounts(accounts merkle.Tree) { |
|
|
|
s.accounts = accounts |
|
|
|
} |
|
|
|
|
|
|
|
// State.accounts
|
|
|
|
//-------------------------------------
|
|
|
|
// State.validators
|
|
|
@ -199,6 +208,10 @@ func (s *State) SetValidatorInfo(valInfo *ValidatorInfo) (updated bool) { |
|
|
|
return s.validatorInfos.Set(valInfo.Address, valInfo.Copy()) |
|
|
|
} |
|
|
|
|
|
|
|
func (s *State) GetValidatorInfos() merkle.Tree { |
|
|
|
return s.validatorInfos.Copy() |
|
|
|
} |
|
|
|
|
|
|
|
func (s *State) unbondValidator(val *Validator) { |
|
|
|
// Move validator to UnbondingValidators
|
|
|
|
val, removed := s.BondedValidators.Remove(val.Address) |
|
|
@ -284,6 +297,11 @@ func (s *State) destroyValidator(val *Validator) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Set the validator infos tree
|
|
|
|
func (s *State) SetValidatorInfos(validatorInfos merkle.Tree) { |
|
|
|
s.validatorInfos = validatorInfos |
|
|
|
} |
|
|
|
|
|
|
|
// State.validators
|
|
|
|
//-------------------------------------
|
|
|
|
// State.storage
|
|
|
@ -320,6 +338,11 @@ func (s *State) GetNames() merkle.Tree { |
|
|
|
return s.nameReg.Copy() |
|
|
|
} |
|
|
|
|
|
|
|
// Set the name reg tree
|
|
|
|
func (s *State) SetNameReg(nameReg merkle.Tree) { |
|
|
|
s.nameReg = nameReg |
|
|
|
} |
|
|
|
|
|
|
|
func NameRegEncoder(o interface{}, w io.Writer, n *int64, err *error) { |
|
|
|
binary.WriteBinary(o.(*types.NameRegEntry), w, n, err) |
|
|
|
} |
|
|
|