instruction macro and simplification

This commit is contained in:
Hardhat Chad
2024-08-26 21:02:52 +00:00
parent 3a3550ced5
commit bff1868ccc
16 changed files with 217 additions and 170 deletions

View File

@@ -4,7 +4,7 @@ use solana_program::pubkey::Pubkey;
use crate::consts::BUS;
use super::AccountDiscriminator;
use super::OreAccount;
/// Bus accounts are responsible for distributing mining rewards. There are 8 busses total
/// to minimize write-lock contention and allow Solana to process mine instructions in parallel.
@@ -26,8 +26,8 @@ pub struct Bus {
}
/// Fetch the PDA of a bus account.
pub fn bus_pda(id: u64) -> (Pubkey, u8) {
Pubkey::find_program_address(&[BUS, id.to_le_bytes().as_slice()], &crate::id())
pub fn bus_pda(id: u8) -> (Pubkey, u8) {
Pubkey::find_program_address(&[BUS, &[id]], &crate::id())
}
account!(AccountDiscriminator, Bus);
account!(OreAccount, Bus);