Skip to content

Commit 2b53000

Browse files
committed
Use EcdsaSig in PSBT partial signatures instead of Vec<u8>
1 parent 141dbbd commit 2b53000

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/util/psbt/map/input.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use prelude::*;
1616

17-
use io;
17+
use ::{EcdsaSig, io};
1818

1919
use blockdata::script::Script;
2020
use blockdata::transaction::{EcdsaSigHashType, Transaction, TxOut};
@@ -87,9 +87,8 @@ pub struct Input {
8787
/// including P2SH embedded ones.
8888
pub witness_utxo: Option<TxOut>,
8989
/// A map from public keys to their corresponding signature as would be
90-
/// pushed to the stack from a scriptSig or witness.
91-
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::btreemap_byte_values"))]
92-
pub partial_sigs: BTreeMap<PublicKey, Vec<u8>>,
90+
/// pushed to the stack from a scriptSig or witness for a non-taproot inputs.
91+
pub partial_sigs: BTreeMap<PublicKey, EcdsaSig>,
9392
/// The sighash type to be used for this input. Signatures for this input
9493
/// must use the sighash type.
9594
pub sighash_type: Option<EcdsaSigHashType>,
@@ -163,7 +162,7 @@ impl Map for Input {
163162
}
164163
PSBT_IN_PARTIAL_SIG => {
165164
impl_psbt_insert_pair! {
166-
self.partial_sigs <= <raw_key: PublicKey>|<raw_value: Vec<u8>>
165+
self.partial_sigs <= <raw_key: PublicKey>|<raw_value: EcdsaSig>
167166
}
168167
}
169168
PSBT_IN_SIGHASH_TYPE => {
@@ -267,7 +266,7 @@ impl Map for Input {
267266
}
268267

269268
impl_psbt_get_pair! {
270-
rv.push(self.partial_sigs as <PSBT_IN_PARTIAL_SIG, PublicKey>|<Vec<u8>>)
269+
rv.push(self.partial_sigs as <PSBT_IN_PARTIAL_SIG, PublicKey>|<EcdsaSig>)
271270
}
272271

273272
impl_psbt_get_pair! {

src/util/psbt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ mod tests {
477477
witness_script: None,
478478
partial_sigs: vec![(
479479
"0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(),
480-
vec![8, 5, 4],
480+
"304402204f67e2afb76142d44fae58a2495d33a3419daa26cd0db8d04f3452b63289ac0f022010762a9fb67e94cc5cad9026f6dc99ff7f070f4278d30fbc7d0c869dd38c7fe701".parse().unwrap(),
481481
)].into_iter().collect(),
482482
bip32_derivation: keypaths.clone(),
483483
final_script_witness: Some(vec![vec![1, 3], vec![5]]),

0 commit comments

Comments
 (0)