Skip to content

Commit 946d454

Browse files
committed
fix: remove Debugs from CreateTxError
1 parent 83be6a4 commit 946d454

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

crates/wallet/src/wallet/error.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl fmt::Display for CreateTxError {
112112
Self::Descriptor(e) => e.fmt(f),
113113
Self::Policy(e) => e.fmt(f),
114114
CreateTxError::SpendingPolicyRequired(keychain_kind) => {
115-
write!(f, "Spending policy required: {:?}", keychain_kind)
115+
write!(f, "Spending policy required: {}", keychain_kind)
116116
}
117117
CreateTxError::Version0 => {
118118
write!(f, "Invalid version `0`")
@@ -127,12 +127,16 @@ impl fmt::Display for CreateTxError {
127127
requested,
128128
required,
129129
} => {
130-
write!(f, "TxBuilder requested timelock of `{:?}`, but at least `{:?}` is required to spend from this script", required, requested)
130+
if requested.is_block_height() && required.is_block_height() {
131+
write!(f, "TxBuilder requested timelock of `{}` blocks, but at least `{}` blocks are required to spend from this script", required, requested)
132+
} else {
133+
write!(f, "TxBuilder requested timelock of `{}` seconds, but at least `{}` seconds are required to spend from this script", required, requested)
134+
}
131135
}
132136
CreateTxError::RbfSequenceCsv { sequence, csv } => {
133137
write!(
134138
f,
135-
"Cannot enable RBF with nSequence `{:?}` given a required OP_CSV of `{:?}`",
139+
"Cannot enable RBF with nSequence `{}` given a required OP_CSV of `{}`",
136140
sequence, csv
137141
)
138142
}

0 commit comments

Comments
 (0)