File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,10 +256,28 @@ pub enum CalculateFeeError {
256256impl fmt:: Display for CalculateFeeError {
257257 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
258258 match self {
259- CalculateFeeError :: MissingTxOut ( outpoints) => write ! (
260- f,
261- "missing `TxOut` for one or more of the inputs of the tx: {outpoints:?}" ,
262- ) ,
259+ CalculateFeeError :: MissingTxOut ( outpoints) => {
260+ let max_show = 3 ;
261+ let shown = outpoints. iter ( ) . take ( max_show) ;
262+ let remaining = outpoints. len ( ) . saturating_sub ( max_show) ;
263+
264+ write ! ( f, "missing `TxOut` for input(s)" ) ?;
265+ if outpoints. is_empty ( ) {
266+ write ! ( f, ": <none>" )
267+ } else {
268+ write ! ( f, ": " ) ?;
269+ for ( i, op) in shown. enumerate ( ) {
270+ if i > 0 {
271+ write ! ( f, ", " ) ?;
272+ }
273+ write ! ( f, "{}" , op) ?;
274+ }
275+ if remaining > 0 {
276+ write ! ( f, " (+{} more)" , remaining) ?;
277+ }
278+ Ok ( ( ) )
279+ }
280+ }
263281 CalculateFeeError :: NegativeFee ( fee) => write ! (
264282 f,
265283 "transaction is invalid according to the graph and has negative fee: {}" ,
You can’t perform that action at this time.
0 commit comments