Orchard: update Debug impl for commitments
This commit is contained in:
parent
cc2e58fade
commit
eb68caf14c
|
|
@ -58,14 +58,18 @@ pub struct NoteCommitment(#[serde(with = "serde_helpers::Affine")] pub pallas::A
|
||||||
|
|
||||||
impl fmt::Debug for NoteCommitment {
|
impl fmt::Debug for NoteCommitment {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
// This will panic if the public key is the identity, which is bad news
|
let mut d = f.debug_struct("NoteCommitment");
|
||||||
// bears.
|
|
||||||
let (x, y) = self.0.get_xy().unwrap();
|
|
||||||
|
|
||||||
f.debug_struct("NoteCommitment")
|
match self.0.get_xy().into() {
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
Some((x, y)) => d
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
.field("x", &hex::encode(x.to_bytes()))
|
||||||
.finish()
|
.field("y", &hex::encode(y.to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
None => d
|
||||||
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,14 +205,18 @@ impl std::ops::AddAssign<ValueCommitment> for ValueCommitment {
|
||||||
|
|
||||||
impl fmt::Debug for ValueCommitment {
|
impl fmt::Debug for ValueCommitment {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
// This will panic if the public key is the identity, which is bad news
|
let mut d = f.debug_struct("ValueCommitment");
|
||||||
// bears.
|
|
||||||
let (x, y) = self.0.get_xy().unwrap();
|
|
||||||
|
|
||||||
f.debug_struct("ValueCommitment")
|
match self.0.get_xy().into() {
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
Some((x, y)) => d
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
.field("x", &hex::encode(x.to_bytes()))
|
||||||
.finish()
|
.field("y", &hex::encode(y.to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
None => d
|
||||||
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.field("y", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
.finish(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue