Skip to content

Commit

Permalink
Merge pull request #937 from helium/andymck/post-deploy-tweaks
Browse files Browse the repository at this point in the history
Address issues post deploy of 138
  • Loading branch information
andymck authored Jan 30, 2025
2 parents 18efc28 + 2fc84b0 commit 0304f25
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
11 changes: 9 additions & 2 deletions iot_config/src/sub_dao_epoch_reward_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,20 @@ pub(crate) mod db {
))));
};

let delegation_rewards_issued =
row.get::<i64, &str>("delegation_rewards_issued") as u64;
if delegation_rewards_issued == 0 {
return Err(sqlx::Error::Decode(Box::new(sqlx::Error::Decode(
Box::from("delegation_rewards_issued is 0"),
))));
};

Ok(Self {
epoch: row.try_get::<i64, &str>("epoch")? as u64,
epoch_address: row.try_get::<String, &str>("epoch_address")?,
sub_dao_address: row.try_get::<String, &str>("sub_dao_address")?,
hnt_rewards_issued,
delegation_rewards_issued: row.try_get::<i64, &str>("delegation_rewards_issued")?
as u64,
delegation_rewards_issued,
rewards_issued_at,
})
}
Expand Down
4 changes: 2 additions & 2 deletions iot_verifier/src/rewarder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ where
};

tracing::info!(
"rewards will be retried in {}",
humantime::format_duration(REWARDS_NOT_CURRENT_DELAY_PERIOD)
"rewards will be rerun in {}",
humantime::format_duration(sleep_duration)
);

let shutdown = shutdown.clone();
Expand Down
12 changes: 11 additions & 1 deletion mobile_config/src/sub_dao_epoch_reward_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,28 @@ pub(crate) mod db {
as u64)
.to_timestamp()
.map_err(|err| sqlx::Error::Decode(Box::new(err)))?;

let hnt_rewards_issued = row.get::<i64, &str>("hnt_rewards_issued") as u64;
if hnt_rewards_issued == 0 {
return Err(sqlx::Error::Decode(Box::new(sqlx::Error::Decode(
Box::from("hnt_rewards_issued is 0"),
))));
}

let delegation_rewards_issued =
row.get::<i64, &str>("delegation_rewards_issued") as u64;
if delegation_rewards_issued == 0 {
return Err(sqlx::Error::Decode(Box::new(sqlx::Error::Decode(
Box::from("delegation_rewards_issued is 0"),
))));
};

Ok(Self {
epoch: row.get::<i64, &str>("epoch") as u64,
epoch_address: row.get::<String, &str>("epoch_address"),
sub_dao_address: row.get::<String, &str>("sub_dao_address"),
hnt_rewards_issued,
delegation_rewards_issued: row.get::<i64, &str>("delegation_rewards_issued") as u64,
delegation_rewards_issued,
rewards_issued_at,
})
}
Expand Down

0 comments on commit 0304f25

Please sign in to comment.