@@ -114,8 +114,8 @@ pub(crate) enum AbortReason {
114114 /// if funding output is provided by the peer this is an interop error,
115115 /// if provided by the same node than internal input consistency error.
116116 InvalidLowFundingOutputValue ,
117- /// Internal error, error while getting destination script
118- InternalErrorGettingDestinationScript ,
117+ /// Internal error
118+ InternalError ( String ) ,
119119}
120120
121121impl AbortReason {
@@ -126,39 +126,49 @@ impl AbortReason {
126126
127127impl Display for AbortReason {
128128 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
129- f. write_str ( match self {
130- AbortReason :: InvalidStateTransition => "State transition was invalid" ,
131- AbortReason :: UnexpectedCounterpartyMessage => "Unexpected message" ,
132- AbortReason :: ReceivedTooManyTxAddInputs => "Too many `tx_add_input`s received" ,
133- AbortReason :: ReceivedTooManyTxAddOutputs => "Too many `tx_add_output`s received" ,
129+ match self {
130+ AbortReason :: InvalidStateTransition => f. write_str ( "State transition was invalid" ) ,
131+ AbortReason :: UnexpectedCounterpartyMessage => f. write_str ( "Unexpected message" ) ,
132+ AbortReason :: ReceivedTooManyTxAddInputs => {
133+ f. write_str ( "Too many `tx_add_input`s received" )
134+ } ,
135+ AbortReason :: ReceivedTooManyTxAddOutputs => {
136+ f. write_str ( "Too many `tx_add_output`s received" )
137+ } ,
134138 AbortReason :: IncorrectInputSequenceValue => {
135- "Input has a sequence value greater than 0xFFFFFFFD"
139+ f. write_str ( "Input has a sequence value greater than 0xFFFFFFFD" )
140+ } ,
141+ AbortReason :: IncorrectSerialIdParity => {
142+ f. write_str ( "Parity for `serial_id` was incorrect" )
136143 } ,
137- AbortReason :: IncorrectSerialIdParity => "Parity for `serial_id` was incorrect" ,
138- AbortReason :: SerialIdUnknown => "The `serial_id` is unknown" ,
139- AbortReason :: DuplicateSerialId => "The `serial_id` already exists" ,
140- AbortReason :: PrevTxOutInvalid => "Invalid previous transaction output" ,
144+ AbortReason :: SerialIdUnknown => f. write_str ( "The `serial_id` is unknown" ) ,
145+ AbortReason :: DuplicateSerialId => f. write_str ( "The `serial_id` already exists" ) ,
146+ AbortReason :: PrevTxOutInvalid => f. write_str ( "Invalid previous transaction output" ) ,
141147 AbortReason :: ExceededMaximumSatsAllowed => {
142- "Output amount exceeded total bitcoin supply"
148+ f . write_str ( "Output amount exceeded total bitcoin supply" )
143149 } ,
144- AbortReason :: ExceededNumberOfInputsOrOutputs => "Too many inputs or outputs" ,
145- AbortReason :: TransactionTooLarge => "Transaction weight is too large" ,
146- AbortReason :: BelowDustLimit => "Output amount is below the dust limit" ,
147- AbortReason :: InvalidOutputScript => "The output script is non-standard" ,
148- AbortReason :: InsufficientFees => "Insufficient fees paid" ,
150+ AbortReason :: ExceededNumberOfInputsOrOutputs => {
151+ f. write_str ( "Too many inputs or outputs" )
152+ } ,
153+ AbortReason :: TransactionTooLarge => f. write_str ( "Transaction weight is too large" ) ,
154+ AbortReason :: BelowDustLimit => f. write_str ( "Output amount is below the dust limit" ) ,
155+ AbortReason :: InvalidOutputScript => f. write_str ( "The output script is non-standard" ) ,
156+ AbortReason :: InsufficientFees => f. write_str ( "Insufficient fees paid" ) ,
149157 AbortReason :: OutputsValueExceedsInputsValue => {
150- "Total value of outputs exceeds total value of inputs"
158+ f . write_str ( "Total value of outputs exceeds total value of inputs" )
151159 } ,
152- AbortReason :: InvalidTx => "The transaction is invalid" ,
153- AbortReason :: MissingFundingOutput => "No shared funding output found" ,
154- AbortReason :: DuplicateFundingOutput => "More than one funding output found" ,
155- AbortReason :: InvalidLowFundingOutputValue => {
156- "Local part of funding output value is greater than the funding output value"
160+ AbortReason :: InvalidTx => f. write_str ( "The transaction is invalid" ) ,
161+ AbortReason :: MissingFundingOutput => f. write_str ( "No shared funding output found" ) ,
162+ AbortReason :: DuplicateFundingOutput => {
163+ f. write_str ( "More than one funding output found" )
157164 } ,
158- AbortReason :: InternalErrorGettingDestinationScript => {
159- "Internal error getting destination script"
165+ AbortReason :: InvalidLowFundingOutputValue => f. write_str (
166+ "Local part of funding output value is greater than the funding output value" ,
167+ ) ,
168+ AbortReason :: InternalError ( text) => {
169+ f. write_fmt ( format_args ! ( "Internal error: {}" , text) )
160170 } ,
161- } )
171+ }
162172 }
163173}
164174
0 commit comments