commands: print the PSBT in base64 on sanity checks failure
To make it readable..
This commit is contained in:
parent
6e1c41238f
commit
518eb91064
@ -10,7 +10,10 @@ use crate::{
|
||||
descriptors, DaemonControl, VERSION,
|
||||
};
|
||||
|
||||
use utils::{deser_amount_from_sats, deser_base64, deser_hex, ser_amount, ser_base64, ser_hex};
|
||||
use utils::{
|
||||
deser_amount_from_sats, deser_base64, deser_hex, ser_amount, ser_base64, ser_hex,
|
||||
to_base64_string,
|
||||
};
|
||||
|
||||
use std::{
|
||||
collections::{hash_map, BTreeMap, HashMap},
|
||||
@ -105,8 +108,8 @@ impl fmt::Display for CommandError {
|
||||
}
|
||||
Self::SanityCheckFailure(psbt) => write!(
|
||||
f,
|
||||
"BUG! Please report this. Failed sanity checks for PSBT '{:?}'.",
|
||||
psbt
|
||||
"BUG! Please report this. Failed sanity checks for PSBT '{}'.",
|
||||
to_base64_string(psbt)
|
||||
),
|
||||
Self::UnknownSpend(txid) => write!(f, "Unknown spend transaction '{}'.", txid),
|
||||
Self::SpendFinalization(e) => {
|
||||
|
||||
@ -15,12 +15,16 @@ where
|
||||
Ok(bitcoin::Amount::from_sat(a))
|
||||
}
|
||||
|
||||
pub fn to_base64_string<T: consensus::Encodable>(t: T) -> String {
|
||||
base64::encode(consensus::serialize(&t))
|
||||
}
|
||||
|
||||
pub fn ser_base64<S, T>(t: T, s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
T: consensus::Encodable,
|
||||
{
|
||||
s.serialize_str(&base64::encode(consensus::serialize(&t)))
|
||||
s.serialize_str(&to_base64_string(t))
|
||||
}
|
||||
|
||||
pub fn deser_base64<'de, D, T>(d: D) -> Result<T, D::Error>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user