This commit is contained in:
Hardhat Chad
2024-05-15 16:57:51 +00:00
parent 96548235dc
commit 7c4ccfd7af

View File

@@ -1,4 +1,5 @@
use bytemuck::{Pod, Zeroable};
use drillx::Solution;
use num_enum::TryFromPrimitive;
use shank::ShankInstruction;
use solana_program::{
@@ -274,7 +275,7 @@ pub fn deregister(signer: Pubkey) -> Instruction {
}
/// Builds a mine instruction.
pub fn mine(signer: Pubkey, bus: Pubkey, digest: [u8; 16], nonce: u64) -> Instruction {
pub fn mine(signer: Pubkey, bus: Pubkey, solution: Solution) -> Instruction {
let proof = Pubkey::find_program_address(&[PROOF, signer.as_ref()], &crate::id()).0;
Instruction {
program_id: crate::id(),
@@ -289,8 +290,8 @@ pub fn mine(signer: Pubkey, bus: Pubkey, digest: [u8; 16], nonce: u64) -> Instru
data: [
OreInstruction::Mine.to_vec(),
MineArgs {
digest,
nonce: nonce.to_le_bytes(),
digest: solution.d,
nonce: solution.n,
}
.to_bytes()
.to_vec(),