mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-20 15:10:32 +00:00
miner migration
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
use steel::*;
|
||||
|
||||
use crate::state::miner_pda;
|
||||
use crate::state::{miner_pda, OreAccountOLD};
|
||||
|
||||
use super::OreAccount;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct MinerOLD {
|
||||
/// The authority of this miner account.
|
||||
pub authority: Pubkey,
|
||||
|
||||
/// The ID of the last block this miner mined in.
|
||||
pub block_id: u64,
|
||||
|
||||
/// The amount of hashpower this miner has committed to the current block.
|
||||
pub hashpower: u64,
|
||||
|
||||
/// A user-supplied seed for random number generation.
|
||||
pub seed: [u8; 32],
|
||||
|
||||
/// The total amount of hashpower this miner has committed across all blocks.
|
||||
pub total_hashpower: u64,
|
||||
|
||||
/// The total amount of ORE this miner has mined across all blocks.
|
||||
pub total_rewards: u64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct Miner {
|
||||
@@ -13,6 +35,9 @@ pub struct Miner {
|
||||
/// The ID of the last block this miner mined in.
|
||||
pub block_id: u64,
|
||||
|
||||
/// An account authorized to execute actions on behalf of this miner.
|
||||
pub executor: Pubkey,
|
||||
|
||||
/// The amount of hashpower this miner has committed to the current block.
|
||||
pub hashpower: u64,
|
||||
|
||||
@@ -33,3 +58,4 @@ impl Miner {
|
||||
}
|
||||
|
||||
account!(OreAccount, Miner);
|
||||
account!(OreAccountOLD, MinerOLD);
|
||||
|
||||
@@ -24,6 +24,12 @@ pub enum OreAccount {
|
||||
Treasury = 104,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
|
||||
pub enum OreAccountOLD {
|
||||
MinerOLD = 103,
|
||||
}
|
||||
|
||||
pub fn block_pda(id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[BLOCK, &id.to_le_bytes()], &crate::ID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user