Skip to content

Commit

Permalink
metadium: fixed error handling during rewards calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
sadoci authored and MetadiumRelease committed Sep 21, 2022
1 parent 2069123 commit 7d802e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions metadium/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,18 @@ func (ma *metaAdmin) getRewardAccounts(ctx context.Context, block *big.Int) (rew

input = []interface{}{metclient.ToBytes32("RewardPool")}
err = metclient.CallContract(ctx, ma.registry, "getContractAddress", input, &addr, block)
if err == nil {
if err != nil {
return
} else {
rewardPoolAccount = &common.Address{}
rewardPoolAccount.SetBytes(addr.Bytes())
}

input = []interface{}{metclient.ToBytes32("Maintenance")}
err = metclient.CallContract(ctx, ma.registry, "getContractAddress", input, &addr, block)
if err == nil {
if err != nil {
return
} else {
maintenanceAccount = &common.Address{}
maintenanceAccount.SetBytes(addr.Bytes())
}
Expand Down Expand Up @@ -877,7 +881,7 @@ func (ma *metaAdmin) calculateRewards(num, blockReward, fees *big.Int, addBalanc
rewardPoolAccount, maintenanceAccount, members, err := ma.getRewardAccounts(ctx, big.NewInt(num.Int64()-1))
if err != nil {
// all goes to the coinbase
return
return nil, nil, err
}

if rewardPoolAccount == nil && maintenanceAccount == nil && len(members) == 0 {
Expand Down

0 comments on commit 7d802e3

Please sign in to comment.