@@ -124,46 +124,50 @@ impl AbortReason {
124
124
125
125
impl Display for AbortReason {
126
126
fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
127
- f. write_str ( & match self {
128
- AbortReason :: InvalidStateTransition => "State transition was invalid" . into ( ) ,
129
- AbortReason :: UnexpectedCounterpartyMessage => "Unexpected message" . into ( ) ,
130
- AbortReason :: ReceivedTooManyTxAddInputs => "Too many `tx_add_input`s received" . into ( ) ,
131
- AbortReason :: ReceivedTooManyTxAddOutputs => "Too many `tx_add_output`s received" . into ( ) ,
132
- AbortReason :: IncorrectInputSequenceValue => {
133
- "Input has a sequence value greater than 0xFFFFFFFD" . into ( )
134
- } ,
135
- AbortReason :: IncorrectSerialIdParity => "Parity for `serial_id` was incorrect" . into ( ) ,
136
- AbortReason :: SerialIdUnknown => "The `serial_id` is unknown" . into ( ) ,
137
- AbortReason :: DuplicateSerialId => "The `serial_id` already exists" . into ( ) ,
138
- AbortReason :: PrevTxOutInvalid => "Invalid previous transaction output" . into ( ) ,
139
- AbortReason :: ExceededMaximumSatsAllowed => {
140
- "Output amount exceeded total bitcoin supply" . into ( )
141
- } ,
142
- AbortReason :: ExceededNumberOfInputsOrOutputs => "Too many inputs or outputs" . into ( ) ,
143
- AbortReason :: TransactionTooLarge => "Transaction weight is too large" . into ( ) ,
144
- AbortReason :: BelowDustLimit => "Output amount is below the dust limit" . into ( ) ,
145
- AbortReason :: InvalidOutputScript => "The output script is non-standard" . into ( ) ,
146
- AbortReason :: InsufficientFees => "Insufficient fees paid" . into ( ) ,
147
- AbortReason :: OutputsValueExceedsInputsValue => {
148
- "Total value of outputs exceeds total value of inputs" . into ( )
149
- } ,
150
- AbortReason :: InvalidTx => "The transaction is invalid" . into ( ) ,
151
- AbortReason :: MissingFundingOutput => "No shared funding output found" . into ( ) ,
152
- AbortReason :: DuplicateFundingOutput => "More than one funding output found" . into ( ) ,
153
- AbortReason :: InvalidLowFundingOutputValue => {
154
- "Local part of funding output value is greater than the funding output value" . into ( )
155
- } ,
156
- AbortReason :: ProvidedInputsAndPrevtxsTxIdMismatch ( idx) => format ! (
127
+ match self {
128
+ AbortReason :: ProvidedInputsAndPrevtxsTxIdMismatch ( idx) => f. write_fmt ( format_args ! (
157
129
"TxId mismatch in the provided inputs and previous transactions, input index {}" ,
158
130
idx
159
- ) ,
160
- AbortReason :: ProvidedInputsAndPrevtxsVoutNotFound ( idx) => format ! (
131
+ ) ) ,
132
+ AbortReason :: ProvidedInputsAndPrevtxsVoutNotFound ( idx) => f . write_fmt ( format_args ! (
161
133
"Vout provided in an input is not found in the previous transaction, input index {}" ,
162
- idx) ,
163
- AbortReason :: InternalErrorGettingDestinationScript => {
164
- "Internal error getting destination script" . into ( )
165
- } ,
166
- } )
134
+ idx
135
+ ) ) ,
136
+ _ => f. write_str ( & match self {
137
+ AbortReason :: InvalidStateTransition => "State transition was invalid" ,
138
+ AbortReason :: UnexpectedCounterpartyMessage => "Unexpected message" ,
139
+ AbortReason :: ReceivedTooManyTxAddInputs => "Too many `tx_add_input`s received" ,
140
+ AbortReason :: ReceivedTooManyTxAddOutputs => "Too many `tx_add_output`s received" ,
141
+ AbortReason :: IncorrectInputSequenceValue => {
142
+ "Input has a sequence value greater than 0xFFFFFFFD" . into ( )
143
+ } ,
144
+ AbortReason :: IncorrectSerialIdParity => "Parity for `serial_id` was incorrect" ,
145
+ AbortReason :: SerialIdUnknown => "The `serial_id` is unknown" ,
146
+ AbortReason :: DuplicateSerialId => "The `serial_id` already exists" ,
147
+ AbortReason :: PrevTxOutInvalid => "Invalid previous transaction output" ,
148
+ AbortReason :: ExceededMaximumSatsAllowed => {
149
+ "Output amount exceeded total bitcoin supply" . into ( )
150
+ } ,
151
+ AbortReason :: ExceededNumberOfInputsOrOutputs => "Too many inputs or outputs" ,
152
+ AbortReason :: TransactionTooLarge => "Transaction weight is too large" ,
153
+ AbortReason :: BelowDustLimit => "Output amount is below the dust limit" ,
154
+ AbortReason :: InvalidOutputScript => "The output script is non-standard" ,
155
+ AbortReason :: InsufficientFees => "Insufficient fees paid" ,
156
+ AbortReason :: OutputsValueExceedsInputsValue => {
157
+ "Total value of outputs exceeds total value of inputs" . into ( )
158
+ } ,
159
+ AbortReason :: InvalidTx => "The transaction is invalid" ,
160
+ AbortReason :: MissingFundingOutput => "No shared funding output found" ,
161
+ AbortReason :: DuplicateFundingOutput => "More than one funding output found" ,
162
+ AbortReason :: InvalidLowFundingOutputValue => {
163
+ "Local part of funding output value is greater than the funding output value"
164
+ } ,
165
+ AbortReason :: InternalErrorGettingDestinationScript => {
166
+ "Internal error getting destination script"
167
+ } ,
168
+ _ => unreachable ! ( ) ,
169
+ } ) ,
170
+ }
167
171
}
168
172
}
169
173
0 commit comments