Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List transaction outputs #292

Merged
merged 12 commits into from
Aug 7, 2022
Prev Previous commit
Next Next commit
Format, add asserts
  • Loading branch information
terror committed Aug 5, 2022
commit 88da81199fce123b8734ad500535ad3accc6dedb
22 changes: 20 additions & 2 deletions tests/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ pub trait RpcApi {
fn getblock(&self, blockhash: BlockHash, verbosity: u64) -> Result<String>;

#[rpc(name = "getrawtransaction")]
fn getrawtransaction(&self, txid: Txid, bs: bool, block_hash: Option<BlockHash>) -> Result<Transaction>;
fn getrawtransaction(
&self,
txid: Txid,
verbose: bool,
block_hash: Option<BlockHash>,
) -> Result<Transaction>;
}

pub struct RpcServer {
Expand Down Expand Up @@ -93,9 +98,22 @@ impl RpcApi for RpcServer {
))
}

fn getrawtransaction(&self, txid: Txid, _bs: bool, _block_hash: Option<BlockHash>) -> Result<Transaction> {
fn getrawtransaction(
&self,
txid: Txid,
verbose: bool,
block_hash: Option<BlockHash>,
) -> Result<Transaction> {
self.call("getrawtransaction");

assert_eq!(verbose, false, "Verbose flag {verbose} is unsupported");

assert_eq!(
block_hash, None,
"Passing in a block hash {:?} is unsupported",
block_hash
);

for block in self.blocks.lock().unwrap().iter() {
for transaction in &block.txdata {
if transaction.txid() == txid {
Expand Down