Compare commits

...

1 Commits

Author SHA1 Message Date
junderw
a58f6c0279
Add electrum verbose transaction get 2026-01-11 23:39:56 +09:00
3 changed files with 28 additions and 2 deletions

View File

@ -590,6 +590,21 @@ impl Daemon {
Ok(blocks)
}
pub fn gettransaction_verbose(
&self,
txid: &Txid,
blockhash: Option<BlockHash>,
) -> Result<Value> {
self.request(
"getrawtransaction",
json!([
txid.to_hex(),
/*verbose=*/ true,
blockhash.map(|b| b.to_hex())
]),
)
}
pub fn gettransactions(&self, txhashes: &[&Txid]) -> Result<Vec<Transaction>> {
let params_list: Vec<Value> = txhashes
.iter()

View File

@ -392,9 +392,12 @@ impl Connection {
None => false,
};
// FIXME: implement verbose support
if verbose {
bail!("verbose transactions are currently unsupported");
let blockid = self.query.chain().tx_confirming_block(&tx_hash);
return self
.query
.lookup_txn_info_verbose(&tx_hash, blockid)
.chain_err(|| "missing transaction");
}
let tx = self

View File

@ -147,6 +147,14 @@ impl Query {
.lookup_raw_txn(txid, None)
.or_else(|| self.mempool().lookup_raw_txn(txid))
}
pub fn lookup_txn_info_verbose(
&self,
txid: &Txid,
blockid: Option<BlockId>,
) -> Result<serde_json::Value> {
self.daemon
.gettransaction_verbose(txid, blockid.map(|b| b.hash))
}
/// Not all OutPoints from mempool transactions are guaranteed to be included in the result
pub fn lookup_txos(&self, outpoints: &BTreeSet<OutPoint>) -> HashMap<OutPoint, TxOut> {