pull/1830/head
Rongjian Lan 5 years ago
parent 740aeac3e7
commit 3e9b34adb6
  1. 1
      core/state/statedb.go
  2. 1
      core/state_transition.go

@ -764,6 +764,7 @@ func (db *DB) AddReward(validator common.Address, reward *big.Int) error {
return db.UpdateStakingInfo(validator, wrapper)
}
// CollectReward moves the rewards into the delegator's normal balance.
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.

@ -394,6 +394,7 @@ func (st *StateTransition) applyDelegateTx(delegate *staking.Delegate) error {
// Firstly use the tokens in undelegation to delegate (redelegate)
undelegateAmount := big.NewInt(0).Set(delegate.Amount)
// Use the latest undelegated token first as it has the longest remaining locking time.
// TODO: always order the list by epoch.
i := len(delegation.Entries) - 1
for ; i >= 0; i-- {
if delegation.Entries[i].Amount.Cmp(undelegateAmount) <= 0 {

Loading…
Cancel
Save