-
Notifications
You must be signed in to change notification settings - Fork 446
fix: no Debug on Display implementations
#2083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5d715c2
d0889f3
5a85f6e
823e4e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -256,15 +256,33 @@ pub enum CalculateFeeError { | |
| impl fmt::Display for CalculateFeeError { | ||
| fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { | ||
| match self { | ||
| CalculateFeeError::MissingTxOut(outpoints) => write!( | ||
| f, | ||
| "missing `TxOut` for one or more of the inputs of the tx: {outpoints:?}", | ||
| ), | ||
| CalculateFeeError::NegativeFee(fee) => write!( | ||
| f, | ||
| "transaction is invalid according to the graph and has negative fee: {}", | ||
| fee.display_dynamic() | ||
| ), | ||
| CalculateFeeError::MissingTxOut(outpoints) => { | ||
| let max_show = 3; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I were to nit-pick, I would say get rid of this and just show all prev outputs. |
||
| let shown: Vec<_> = outpoints.iter().take(max_show).collect(); | ||
| let remaining = outpoints.len().saturating_sub(max_show); | ||
|
|
||
| write!(f, "cannot calculate fee, missing previous output(s): ")?; | ||
| if outpoints.is_empty() { | ||
| write!(f, "<none>") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this ever happens, it's a bug in the library - let's |
||
| } else { | ||
| write!(f, "{}", shown[0])?; | ||
| for op in &shown[1..] { | ||
| write!(f, ", {}", op)?; | ||
| } | ||
| if remaining > 0 { | ||
| write!(f, " (+{} more)", remaining)?; | ||
| } | ||
|
Dmenec marked this conversation as resolved.
|
||
| Ok(()) | ||
| } | ||
| } | ||
| CalculateFeeError::NegativeFee(fee) => { | ||
| write!( | ||
| f, | ||
| "invalid transaction: negative fee {}", | ||
| fee.display_dynamic() | ||
| )?; | ||
| Ok(()) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.