Skip to content

Commit

Permalink
tryfix: reward check on withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
RafilxTenfen committed Dec 19, 2024
1 parent f99d86e commit f5b8bfc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/e2e/btc_rewards_distribution_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ func (s *BtcRewardsDistribution) Test5CheckRewardsFirstDelegations() {

// The rewards distributed for the finality providers should be fp1 => 3x, fp2 => 1x
fp1LastRewardGauge, fp2LastRewardGauge, btcDel1LastRewardGauge, btcDel2LastRewardGauge := s.QueryRewardGauges(n2)

// does the withdraw right after the query to avoid new blocks rewarded
del2BalanceBeforeWithdraw, errQueryB := n2.QueryBalances(s.del2Addr)
n2.WithdrawReward(itypes.BTCDelegationType.String(), wDel2)
s.NoError(errQueryB)

// fp1 ~2674ubbn
// fp2 ~891ubbn
coins.RequireCoinsDiffInPointOnePercentMargin(
Expand All @@ -331,13 +337,8 @@ func (s *BtcRewardsDistribution) Test5CheckRewardsFirstDelegations() {
// del2 ~7130ubbn
coins.RequireCoinsDiffInPointOnePercentMargin(s.T(), btcDel1LastRewardGauge.Coins, btcDel2LastRewardGauge.Coins)

// note that the rewards will not be precise as more or less blocks were produced and given out rewards.
// note that the rewards might not be precise as more or less blocks were produced and given out rewards.
// Withdraw the reward just for del2 to check it is possible
n2.WaitForNextBlockWithSleep50ms()
del2BalanceBeforeWithdraw, errQueryB := n2.QueryBalances(s.del2Addr)
n2.WithdrawReward(itypes.BTCDelegationType.String(), wDel2)

s.NoError(errQueryB)
n2.WaitForNextBlock()

del2BalanceAfterWithdraw, err := n2.QueryBalances(s.del2Addr)
Expand Down

0 comments on commit f5b8bfc

Please sign in to comment.