automerge
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -4213,6 +4213,7 @@ dependencies = [
|
|||||||
"solana-logger 1.0.9",
|
"solana-logger 1.0.9",
|
||||||
"solana-runtime 1.0.9",
|
"solana-runtime 1.0.9",
|
||||||
"solana-sdk 1.0.9",
|
"solana-sdk 1.0.9",
|
||||||
|
"solana-stake-program 1.0.9",
|
||||||
"solana-vote-program 1.0.9",
|
"solana-vote-program 1.0.9",
|
||||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -20,6 +20,7 @@ solana-logger = { path = "../logger", version = "1.0.10" }
|
|||||||
solana-runtime = { path = "../runtime", version = "1.0.10" }
|
solana-runtime = { path = "../runtime", version = "1.0.10" }
|
||||||
solana-sdk = { path = "../sdk", version = "1.0.10" }
|
solana-sdk = { path = "../sdk", version = "1.0.10" }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "1.0.10" }
|
solana-vote-program = { path = "../programs/vote", version = "1.0.10" }
|
||||||
|
solana-stake-program = { path = "../programs/stake", version = "1.0.10" }
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -36,6 +36,32 @@ enum LedgerOutputMethod {
|
|||||||
Json,
|
Json,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn output_slot_rewards(
|
||||||
|
blockstore: &Blockstore,
|
||||||
|
slot: Slot,
|
||||||
|
method: &LedgerOutputMethod,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
// Note: rewards are not output in JSON yet
|
||||||
|
if *method == LedgerOutputMethod::Print {
|
||||||
|
if let Ok(rewards) = blockstore.read_rewards(slot) {
|
||||||
|
if let Some(rewards) = rewards {
|
||||||
|
if !rewards.is_empty() {
|
||||||
|
println!(" Rewards:");
|
||||||
|
for reward in rewards {
|
||||||
|
println!(
|
||||||
|
" Account {}: {}{} SOL",
|
||||||
|
reward.pubkey,
|
||||||
|
if reward.lamports < 0 { '-' } else { ' ' },
|
||||||
|
lamports_to_sol(reward.lamports.abs().try_into().unwrap())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn output_slot(
|
fn output_slot(
|
||||||
blockstore: &Blockstore,
|
blockstore: &Blockstore,
|
||||||
slot: Slot,
|
slot: Slot,
|
||||||
@ -94,6 +120,15 @@ fn output_slot(
|
|||||||
println!(" {:?}", vote_instruction);
|
println!(" {:?}", vote_instruction);
|
||||||
raw = false;
|
raw = false;
|
||||||
}
|
}
|
||||||
|
} else if program_pubkey == solana_stake_program::id() {
|
||||||
|
if let Ok(stake_instruction) =
|
||||||
|
limited_deserialize::<
|
||||||
|
solana_stake_program::stake_instruction::StakeInstruction,
|
||||||
|
>(&instruction.data)
|
||||||
|
{
|
||||||
|
println!(" {:?}", stake_instruction);
|
||||||
|
raw = false;
|
||||||
|
}
|
||||||
} else if program_pubkey == solana_sdk::system_program::id() {
|
} else if program_pubkey == solana_sdk::system_program::id() {
|
||||||
if let Ok(system_instruction) =
|
if let Ok(system_instruction) =
|
||||||
limited_deserialize::<
|
limited_deserialize::<
|
||||||
@ -164,25 +199,7 @@ fn output_slot(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: rewards are not output in JSON yet
|
output_slot_rewards(blockstore, slot, method)
|
||||||
if *method == LedgerOutputMethod::Print {
|
|
||||||
if let Ok(rewards) = blockstore.read_rewards(slot) {
|
|
||||||
if let Some(rewards) = rewards {
|
|
||||||
if !rewards.is_empty() {
|
|
||||||
println!(" Rewards:");
|
|
||||||
for reward in rewards {
|
|
||||||
println!(
|
|
||||||
" Account {}: {}{} SOL",
|
|
||||||
reward.pubkey,
|
|
||||||
if reward.lamports < 0 { '-' } else { ' ' },
|
|
||||||
lamports_to_sol(reward.lamports.abs().try_into().unwrap())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn output_ledger(blockstore: Blockstore, starting_slot: Slot, method: LedgerOutputMethod) {
|
fn output_ledger(blockstore: Blockstore, starting_slot: Slot, method: LedgerOutputMethod) {
|
||||||
|
Reference in New Issue
Block a user