diff --git a/client/src/client.rs b/client/src/client.rs index faea7490..309f61fb 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -343,7 +343,10 @@ pub trait RpcApi: Sized { fn get_block_info(&self, hash: &bitcoin::BlockHash) -> Result { self.call("getblock", &[into_json(hash)?, 1.into()]) } - //TODO(stevenroose) add getblock_txs + + fn get_block_txs(&self, hash: &bitcoin::BlockHash) -> Result { + self.call("getblock", &[into_json(hash)?, 3.into()]) + } fn get_block_header(&self, hash: &bitcoin::BlockHash) -> Result { let hex: String = self.call("getblockheader", &[into_json(hash)?, false.into()])?; diff --git a/json/src/lib.rs b/json/src/lib.rs index 3574ef1b..1744e662 100644 --- a/json/src/lib.rs +++ b/json/src/lib.rs @@ -217,6 +217,32 @@ pub struct GetBlockResult { pub nextblockhash: Option, } +#[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GetBlockTxsResult { + pub hash: bitcoin::BlockHash, + pub confirmations: i32, + pub size: usize, + pub strippedsize: Option, + pub weight: usize, + pub height: usize, + pub version: i32, + #[serde(default, with = "crate::serde_hex::opt")] + pub version_hex: Option>, + pub merkleroot: bitcoin::hash_types::TxMerkleNode, + pub tx: Vec, + pub time: usize, + pub mediantime: Option, + pub nonce: u32, + pub bits: String, + pub difficulty: f64, + #[serde(with = "crate::serde_hex")] + pub chainwork: Vec, + pub n_tx: usize, + pub previousblockhash: Option, + pub nextblockhash: Option, +} + #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct GetBlockHeaderResult {