Skip to content

Commit

Permalink
Fix: don't fail if no rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Lacy committed Dec 17, 2024
1 parent e528d44 commit 7ee2ced
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/btc-finality/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ fn handle_end_block(
// On an epoch boundary, send rewards to Babylon through the babylon contract
let params = PARAMS.load(deps.storage)?;
if env.block.height > 0 && env.block.height % params.epoch_length == 0 {
let rewards = TOTAL_REWARDS.load(deps.storage)?;
let rewards = TOTAL_REWARDS.may_load(deps.storage)?.unwrap_or_default();
if rewards.u128() > 0 {
let wasm_msg = send_rewards_msg(deps, rewards.u128(), &cfg)?;
res = res.add_message(wasm_msg);
Expand Down

0 comments on commit 7ee2ced

Please sign in to comment.