ord/subcommand/
subsidy.rs

1use super::*;
2
3#[derive(Debug, Parser)]
4pub(crate) struct Subsidy {
5  #[arg(help = "List sats in subsidy at <HEIGHT>.")]
6  height: Height,
7}
8
9#[derive(Debug, PartialEq, Serialize, Deserialize)]
10pub struct Output {
11  pub first: u64,
12  pub subsidy: u64,
13  pub name: String,
14}
15
16impl Subsidy {
17  pub(crate) fn run(self) -> SubcommandResult {
18    let first = self.height.starting_sat();
19
20    let subsidy = self.height.subsidy();
21
22    if subsidy == 0 {
23      bail!("block {} has no subsidy", self.height);
24    }
25
26    Ok(Some(Box::new(Output {
27      first: first.0,
28      subsidy,
29      name: first.name(),
30    })))
31  }
32}