mirror of
https://github.com/romanz/electrs.git
synced 2026-08-16 13:00:30 +02:00
Expose txin witness when available
This commit is contained in:
parent
9676b8ca7c
commit
26dc229e01
1 changed files with 3 additions and 0 deletions
|
|
@ -86,6 +86,7 @@ struct TxInValue {
|
|||
prevout: Option<TxOutValue>,
|
||||
scriptsig_hex: Script,
|
||||
scriptsig_asm: String,
|
||||
witness: Option<Vec<String>>,
|
||||
is_coinbase: bool,
|
||||
}
|
||||
|
||||
|
|
@ -93,12 +94,14 @@ impl From<TxIn> for TxInValue {
|
|||
fn from(txin: TxIn) -> Self {
|
||||
let script = txin.script_sig;
|
||||
let script_asm = format!("{:?}",script);
|
||||
let witness = if txin.witness.len() > 0 { Some(txin.witness.iter().map(|w| hex::encode(w)).collect()) } else { None };
|
||||
|
||||
TxInValue {
|
||||
outpoint: txin.previous_output,
|
||||
prevout: None, // added later
|
||||
scriptsig_asm: (&script_asm[7..script_asm.len()-1]).to_string(),
|
||||
scriptsig_hex: script,
|
||||
witness: witness,
|
||||
is_coinbase: txin.previous_output.is_null(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue