Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
sasurobert committed Aug 25, 2021
1 parent db6bb03 commit 322637a
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions vm/systemSmartContracts/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1420,26 +1420,20 @@ func (d *delegation) addToActiveFund(
dStatus *DelegationContractStatus,
isNew bool,
) error {
if len(delegator.ActiveFund) == 0 {
var fundKey []byte
fundKey, err := d.createAndSaveNextKeyFund(callerAddr, delegateValue, active)
if err != nil {
return err
}

delegator.ActiveFund = fundKey
if isNew {
dStatus.NumUsers++
}

return nil
if len(delegator.ActiveFund) > 0 {
return d.addValueToFund(delegator.ActiveFund, delegateValue)
}

err := d.addValueToFund(delegator.ActiveFund, delegateValue)
fundKey, err := d.createAndSaveNextKeyFund(callerAddr, delegateValue, active)
if err != nil {
return err
}

delegator.ActiveFund = fundKey
if isNew {
dStatus.NumUsers++
}

return nil
}

Expand Down

0 comments on commit 322637a

Please sign in to comment.