mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
cleanup
This commit is contained in:
@@ -55,7 +55,7 @@ pub fn process_bet(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
|
||||
block.total_bets += amount;
|
||||
block.bet_count += 1;
|
||||
|
||||
// Hash client seed into block noise. This follows the scheme for provable randomness.
|
||||
// Hash client seed into block noise for provably fair randomness.
|
||||
block.noise = hashv(&[&block.noise, &seed]).to_bytes();
|
||||
|
||||
// Transfer wagers.
|
||||
|
||||
@@ -33,11 +33,10 @@ pub fn process_payout(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResu
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Select the slothash from the slot at when the round ended.
|
||||
// The represents the server seed for a provably fair random number.
|
||||
// Select the hash from the slot when the block ended for provably fair randomness.
|
||||
let slot_hashes =
|
||||
bincode::deserialize::<SlotHashes>(slot_hashes_sysvar.data.borrow().as_ref()).unwrap();
|
||||
let slot_hash = slot_hashes.get(&block.ends_at).unwrap();
|
||||
let slot_hash = slot_hashes.get(&block.ends_at).unwrap(); // TODO: Handle recovery case.
|
||||
block.noise = hashv(&[&block.noise, slot_hash.as_ref()]).to_bytes();
|
||||
|
||||
// Calculate the random number.
|
||||
|
||||
Reference in New Issue
Block a user