mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 23:16:48 +00:00
mine test
This commit is contained in:
@@ -70,12 +70,15 @@ pub fn process_mine<'a, 'info>(
|
||||
proof.claimable_rewards = proof.claimable_rewards.saturating_add(treasury.reward_rate);
|
||||
|
||||
// Hash most recent slot hash into the next challenge to prevent pre-mining attacks
|
||||
let slot_hash_bytes = &slot_hashes_info.data.borrow()[0..size_of::<SlotHash>()];
|
||||
proof.hash = hashv(&[KeccakHash::from(args.hash).as_ref(), slot_hash_bytes]).into();
|
||||
proof.hash = hashv(&[
|
||||
KeccakHash::from(args.hash).as_ref(),
|
||||
&slot_hashes_info.data.borrow()[0..size_of::<SlotHash>()],
|
||||
])
|
||||
.into();
|
||||
|
||||
// Update lifetime stats
|
||||
proof.total_hashes = proof.total_hashes.saturating_add(1);
|
||||
proof.total_rewards = proof.total_rewards.saturating_add(1);
|
||||
proof.total_rewards = proof.total_rewards.saturating_add(treasury.reward_rate);
|
||||
|
||||
// Log the mined rewards
|
||||
set_return_data(treasury.reward_rate.to_le_bytes().as_slice());
|
||||
|
||||
@@ -42,10 +42,9 @@ pub fn process_register<'a, 'info>(
|
||||
let mut proof_data = proof_info.data.borrow_mut();
|
||||
proof_data[0] = Proof::discriminator() as u8;
|
||||
let mut proof = Proof::try_from_bytes_mut(&mut proof_data)?;
|
||||
// proof.bump = args.bump as u64;
|
||||
proof.authority = *signer.key;
|
||||
proof.claimable_rewards = 0;
|
||||
proof.hash = hashv(&[&signer.key.to_bytes()]).into();
|
||||
proof.hash = hashv(&[signer.key.as_ref()]).into();
|
||||
proof.total_hashes = 0;
|
||||
proof.total_rewards = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user