@@ -443,9 +443,9 @@ pub trait PsbtExt {
443
443
/// Same as [`PsbtExt::finalize_mut`], but does not mutate the input psbt and
444
444
/// returns a new psbt
445
445
fn finalize < C : secp256k1:: Verification > (
446
- & self ,
446
+ self ,
447
447
secp : & secp256k1:: Secp256k1 < C > ,
448
- ) -> Result < Psbt , Vec < Error > > ;
448
+ ) -> Result < Psbt , ( Psbt , Vec < Error > ) > ;
449
449
450
450
/// Same as [PsbtExt::finalize_mut], but allows for malleable satisfactions
451
451
fn finalize_mall_mut < C : secp256k1:: Verification > (
@@ -455,9 +455,9 @@ pub trait PsbtExt {
455
455
456
456
/// Same as [PsbtExt::finalize], but allows for malleable satisfactions
457
457
fn finalize_mall < C : secp256k1:: Verification > (
458
- & self ,
458
+ self ,
459
459
secp : & Secp256k1 < C > ,
460
- ) -> Result < Psbt , Vec < Error > > ;
460
+ ) -> Result < Psbt , ( Psbt , Vec < Error > ) > ;
461
461
462
462
/// Same as [`PsbtExt::finalize_mut`], but only tries to finalize a single input leaving other
463
463
/// inputs as is. Use this when not all of inputs that you are trying to
@@ -470,10 +470,10 @@ pub trait PsbtExt {
470
470
471
471
/// Same as [`PsbtExt::finalize_inp_mut`], but does not mutate the psbt and returns a new one
472
472
fn finalize_inp < C : secp256k1:: Verification > (
473
- & self ,
473
+ self ,
474
474
secp : & secp256k1:: Secp256k1 < C > ,
475
475
index : usize ,
476
- ) -> Result < Psbt , Error > ;
476
+ ) -> Result < Psbt , ( Psbt , Error ) > ;
477
477
478
478
/// Same as [`PsbtExt::finalize_inp_mut`], but allows for malleable satisfactions
479
479
fn finalize_inp_mall_mut < C : secp256k1:: Verification > (
@@ -484,10 +484,10 @@ pub trait PsbtExt {
484
484
485
485
/// Same as [`PsbtExt::finalize_inp`], but allows for malleable satisfactions
486
486
fn finalize_inp_mall < C : secp256k1:: Verification > (
487
- & mut self ,
487
+ self ,
488
488
secp : & secp256k1:: Secp256k1 < C > ,
489
489
index : usize ,
490
- ) -> Result < Psbt , Error > ;
490
+ ) -> Result < Psbt , ( Psbt , Error ) > ;
491
491
492
492
/// Psbt extractor as defined in BIP174 that takes in a psbt reference
493
493
/// and outputs a extracted bitcoin::Transaction
@@ -566,12 +566,13 @@ impl PsbtExt for Psbt {
566
566
}
567
567
568
568
fn finalize < C : secp256k1:: Verification > (
569
- & self ,
569
+ mut self ,
570
570
secp : & secp256k1:: Secp256k1 < C > ,
571
- ) -> Result < Psbt , Vec < Error > > {
572
- let mut psbt = self . clone ( ) ;
573
- psbt. finalize_mut ( secp) ?;
574
- Ok ( psbt)
571
+ ) -> Result < Psbt , ( Psbt , Vec < Error > ) > {
572
+ match self . finalize_mut ( secp) {
573
+ Ok ( ..) => Ok ( self ) ,
574
+ Err ( e) => Err ( ( self , e) ) ,
575
+ }
575
576
}
576
577
577
578
fn finalize_mall_mut < C : secp256k1:: Verification > (
@@ -595,12 +596,13 @@ impl PsbtExt for Psbt {
595
596
}
596
597
597
598
fn finalize_mall < C : secp256k1:: Verification > (
598
- & self ,
599
+ mut self ,
599
600
secp : & Secp256k1 < C > ,
600
- ) -> Result < Psbt , Vec < Error > > {
601
- let mut psbt = self . clone ( ) ;
602
- psbt. finalize_mall_mut ( secp) ?;
603
- Ok ( psbt)
601
+ ) -> Result < Psbt , ( Psbt , Vec < Error > ) > {
602
+ match self . finalize_mall_mut ( secp) {
603
+ Ok ( ..) => Ok ( self ) ,
604
+ Err ( e) => Err ( ( self , e) ) ,
605
+ }
604
606
}
605
607
606
608
fn finalize_inp_mut < C : secp256k1:: Verification > (
@@ -618,13 +620,14 @@ impl PsbtExt for Psbt {
618
620
}
619
621
620
622
fn finalize_inp < C : secp256k1:: Verification > (
621
- & self ,
623
+ mut self ,
622
624
secp : & secp256k1:: Secp256k1 < C > ,
623
625
index : usize ,
624
- ) -> Result < Psbt , Error > {
625
- let mut psbt = self . clone ( ) ;
626
- psbt. finalize_inp_mut ( secp, index) ?;
627
- Ok ( psbt)
626
+ ) -> Result < Psbt , ( Psbt , Error ) > {
627
+ match self . finalize_inp_mut ( secp, index) {
628
+ Ok ( ..) => Ok ( self ) ,
629
+ Err ( e) => Err ( ( self , e) ) ,
630
+ }
628
631
}
629
632
630
633
fn finalize_inp_mall_mut < C : secp256k1:: Verification > (
@@ -642,13 +645,14 @@ impl PsbtExt for Psbt {
642
645
}
643
646
644
647
fn finalize_inp_mall < C : secp256k1:: Verification > (
645
- & mut self ,
648
+ mut self ,
646
649
secp : & secp256k1:: Secp256k1 < C > ,
647
650
index : usize ,
648
- ) -> Result < Psbt , Error > {
649
- let mut psbt = self . clone ( ) ;
650
- psbt. finalize_inp_mall_mut ( secp, index) ?;
651
- Ok ( psbt)
651
+ ) -> Result < Psbt , ( Psbt , Error ) > {
652
+ match self . finalize_inp_mall_mut ( secp, index) {
653
+ Ok ( ..) => Ok ( self ) ,
654
+ Err ( e) => Err ( ( self , e) ) ,
655
+ }
652
656
}
653
657
654
658
fn extract < C : secp256k1:: Verification > (
0 commit comments