1- use alloc:: { boxed :: Box , vec:: Vec } ;
1+ use alloc:: vec:: Vec ;
22use core:: fmt:: { Debug , Display } ;
33
44use bdk_coin_select:: FeeRate ;
5- use bitcoin:: {
5+ use miniscript:: bitcoin;
6+ use miniscript:: bitcoin:: {
67 absolute:: { self , LockTime } ,
7- transaction, Psbt , Sequence ,
8+ transaction, OutPoint , Psbt , Sequence ,
89} ;
9- use miniscript :: bitcoin ;
10+
1011use miniscript:: psbt:: PsbtExt ;
1112
1213use crate :: { apply_anti_fee_sniping, Finalizer , Input , Output } ;
@@ -70,17 +71,15 @@ pub enum CreatePsbtError {
7071 /// Attempted to mix locktime types.
7172 LockTypeMismatch ,
7273 /// Missing tx for legacy input.
73- MissingFullTxForLegacyInput ( Box < Input > ) ,
74+ MissingFullTxForLegacyInput ( OutPoint ) ,
7475 /// Missing tx for segwit v0 input.
75- MissingFullTxForSegwitV0Input ( Box < Input > ) ,
76+ MissingFullTxForSegwitV0Input ( OutPoint ) ,
7677 /// Psbt error.
7778 Psbt ( bitcoin:: psbt:: Error ) ,
7879 /// Update psbt output with descriptor error.
7980 OutputUpdate ( miniscript:: psbt:: OutputUpdateError ) ,
8081 /// Invalid locktime
8182 InvalidLockTime ( absolute:: LockTime ) ,
82- /// Invalid height
83- InvalidHeight ( u32 ) ,
8483 /// Unsupported version for anti fee snipping
8584 UnsupportedVersion ( transaction:: Version ) ,
8685}
@@ -89,15 +88,15 @@ impl core::fmt::Display for CreatePsbtError {
8988 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
9089 match self {
9190 CreatePsbtError :: LockTypeMismatch => write ! ( f, "cannot mix locktime units" ) ,
92- CreatePsbtError :: MissingFullTxForLegacyInput ( input ) => write ! (
91+ CreatePsbtError :: MissingFullTxForLegacyInput ( outpoint ) => write ! (
9392 f,
9493 "legacy input that spends {} requires PSBT_IN_NON_WITNESS_UTXO" ,
95- input . prev_outpoint ( )
94+ outpoint
9695 ) ,
97- CreatePsbtError :: MissingFullTxForSegwitV0Input ( input ) => write ! (
96+ CreatePsbtError :: MissingFullTxForSegwitV0Input ( outpoint ) => write ! (
9897 f,
9998 "segwit v0 input that spends {} requires PSBT_IN_NON_WITNESS_UTXO" ,
100- input . prev_outpoint ( )
99+ outpoint
101100 ) ,
102101 CreatePsbtError :: Psbt ( error) => Display :: fmt ( & error, f) ,
103102 CreatePsbtError :: OutputUpdate ( output_update_error) => {
@@ -106,9 +105,6 @@ impl core::fmt::Display for CreatePsbtError {
106105 CreatePsbtError :: InvalidLockTime ( locktime) => {
107106 write ! ( f, "The locktime - {}, is invalid" , locktime)
108107 }
109- CreatePsbtError :: InvalidHeight ( height) => {
110- write ! ( f, "The height - {}, is invalid" , height)
111- }
112108 CreatePsbtError :: UnsupportedVersion ( version) => {
113109 write ! ( f, "Unsupported version {}" , version)
114110 }
@@ -202,16 +198,16 @@ impl Selection {
202198 psbt_input. non_witness_utxo = plan_input. prev_tx ( ) . cloned ( ) ;
203199 if psbt_input. non_witness_utxo . is_none ( ) {
204200 if witness_version. is_none ( ) {
205- return Err ( CreatePsbtError :: MissingFullTxForLegacyInput ( Box :: new (
206- plan_input. clone ( ) ,
207- ) ) ) ;
201+ return Err ( CreatePsbtError :: MissingFullTxForLegacyInput (
202+ plan_input. prev_outpoint ( ) ,
203+ ) ) ;
208204 }
209205 if params. mandate_full_tx_for_segwit_v0
210206 && witness_version == Some ( bitcoin:: WitnessVersion :: V0 )
211207 {
212- return Err ( CreatePsbtError :: MissingFullTxForSegwitV0Input ( Box :: new (
213- plan_input. clone ( ) ,
214- ) ) ) ;
208+ return Err ( CreatePsbtError :: MissingFullTxForSegwitV0Input (
209+ plan_input. prev_outpoint ( ) ,
210+ ) ) ;
215211 }
216212 }
217213 continue ;
0 commit comments