Add state db apis for block rewards

pull/1830/head
Rongjian Lan 5 years ago
parent 6c8fe922b4
commit b013e1fea3
  1. 10
      core/state/statedb.go
  2. 2
      core/vm/interface.go

@ -726,3 +726,13 @@ func (db *DB) IsValidator(addr common.Address) bool {
}
return so.IsValidator(db.db)
}
func (db *DB) AddReward(validator common.Address, reward *big.Int) {
//TODO: implement reward logic
// the reward will be distributed to all the delegators based on stake percentage.
}
func (db *DB) CollectReward(delegator common.Address) {
//TODO: implement collect reward logic
// The reward will be withdrawn to the delegator's address balance as a whole.
}

@ -45,6 +45,8 @@ type StateDB interface {
SetValidatorFlag(common.Address)
UnsetValidatorFlag(common.Address)
IsValidator(common.Address) bool
AddReward(common.Address, *big.Int)
CollectReward(common.Address)
AddRefund(uint64)
SubRefund(uint64)

Loading…
Cancel
Save