mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
trace
This commit is contained in:
@@ -34,12 +34,12 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul
|
||||
|
||||
// Check whitelist
|
||||
if !AUTHORIZED_ACCOUNTS.contains(&signer_info.key) {
|
||||
return Err(OreError::NotAuthorized.into());
|
||||
return Err(trace("Not authorized", OreError::NotAuthorized.into()));
|
||||
}
|
||||
|
||||
// Check minimum amount.
|
||||
if amount < config.min_deploy_amount {
|
||||
return Err(OreError::AmountTooSmall.into());
|
||||
return Err(trace("Amount too small", OreError::AmountTooSmall.into()));
|
||||
}
|
||||
|
||||
// Create miner.
|
||||
|
||||
@@ -104,7 +104,10 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
||||
|
||||
// Check if miner was provided in correct order.
|
||||
if miner.authority != square.miners[winning_square][i] {
|
||||
return Err(ProgramError::InvalidAccountData);
|
||||
return Err(trace(
|
||||
"Incorrect miner order",
|
||||
ProgramError::InvalidAccountData,
|
||||
));
|
||||
}
|
||||
|
||||
// Find the top winner.
|
||||
@@ -117,7 +120,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
||||
// Verify checksum.
|
||||
if checksum != square_prospects {
|
||||
// This can only happen if the caller didn't provide full set of winning miners.
|
||||
return Err(ProgramError::InvalidAccountData);
|
||||
return Err(trace("Invalid checksum", ProgramError::InvalidAccountData));
|
||||
}
|
||||
|
||||
// Payout reward to top miner.
|
||||
@@ -199,7 +202,10 @@ pub fn get_slot_hash(
|
||||
let Some(slot_hash) = slot_hashes.get(&slot) else {
|
||||
// If reset is not called within ~2.5 minutes of the block ending,
|
||||
// then the slot hash will be unavailable and secure hashes cannot be generated.
|
||||
return Err(ProgramError::InvalidAccountData);
|
||||
return Err(trace(
|
||||
"Slot hash unavailable",
|
||||
ProgramError::InvalidAccountData,
|
||||
));
|
||||
};
|
||||
let slot_hash = slot_hash.to_bytes();
|
||||
Ok(slot_hash)
|
||||
|
||||
Reference in New Issue
Block a user