-
Notifications
You must be signed in to change notification settings - Fork 59
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
pretty print offer-data #422
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -253,6 +253,32 @@ pub(crate) struct Offer { | |
pub(crate) tweakable_point: PublicKey, | ||
pub(crate) fidelity: FidelityProof, | ||
} | ||
impl Display for Offer { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!( | ||
f, | ||
"offer data received:\n\ | ||
- Base fee: {}\n\ | ||
- Percent Fee on total amount: {}\n\ | ||
- Time relative fee: {}\n\ | ||
- Required Confirms: {}\n\ | ||
- Minimum locktime: {}\n\ | ||
- Max size: {}\n\ | ||
- Min size: {}\n\ | ||
- Tweakable Point: {}\n\ | ||
- Fidelity Proof: {:?}", | ||
self.base_fee, | ||
self.amount_relative_fee_pct, | ||
self.time_relative_fee_pct, | ||
self.required_confirms, | ||
self.minimum_locktime, | ||
self.max_size, | ||
self.min_size, | ||
self.tweakable_point, | ||
self.fidelity | ||
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. fidelity itself is a pretty big structure, we cannot directly print it. We just need the fidelity_bond value. And to calculate that we need access to the bitcoin RPC. So this cannot be implemented directly with Display trait. Instead make a dedicated function at |
||
) | ||
} | ||
} | ||
|
||
/// Contract Tx signatures provided by a Sender of a Coinswap. | ||
#[derive(Debug, Serialize, Deserialize)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the tweakable point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add the tor address instead.