mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-16 07:26:51 +00:00
challenge
This commit is contained in:
@@ -79,7 +79,7 @@ pub fn process_mine<'a, 'info>(
|
||||
|
||||
// Calculate the hash from the provided nonce
|
||||
let noise_data = noise_info.data.borrow();
|
||||
let hx = drillx::hash(&proof.hash, &args.nonce, &noise_data);
|
||||
let hx = drillx::hash(&proof.challenge, &args.nonce, &noise_data);
|
||||
drop(noise_data);
|
||||
|
||||
// Validate hash satisfies the minimnum difficulty
|
||||
@@ -139,7 +139,7 @@ pub fn process_mine<'a, 'info>(
|
||||
proof.balance = proof.balance.saturating_add(reward);
|
||||
|
||||
// Hash recent slot hash into the next challenge to prevent pre-mining attacks
|
||||
proof.hash = hashv(&[
|
||||
proof.challenge = hashv(&[
|
||||
hx.as_slice(),
|
||||
&slot_hashes_info.data.borrow()[0..size_of::<SlotHash>()],
|
||||
])
|
||||
|
||||
@@ -59,7 +59,7 @@ pub fn process_register<'a, 'info>(
|
||||
let proof = Proof::try_from_bytes_mut(&mut proof_data)?;
|
||||
proof.authority = *signer.key;
|
||||
proof.balance = 0;
|
||||
proof.hash = hashv(&[
|
||||
proof.challenge = hashv(&[
|
||||
signer.key.as_ref(),
|
||||
&slot_hashes_info.data.borrow()[0..size_of::<SlotHash>()],
|
||||
])
|
||||
|
||||
@@ -18,8 +18,8 @@ pub struct Proof {
|
||||
/// The quantity of tokens this miner has staked or earned.
|
||||
pub balance: u64,
|
||||
|
||||
/// The proof's current hash.
|
||||
pub hash: [u8; 32],
|
||||
/// The current mining challenge.
|
||||
pub challenge: [u8; 32],
|
||||
|
||||
/// The last slot ore was deposited into this account.
|
||||
pub last_deposit_slot: u64,
|
||||
|
||||
Reference in New Issue
Block a user