Merge #1186: Add minimum feerate to TooLowFeerate error message
8be0d9856b29eb30593ae7614fe74430ffd206d4 commands: add minimum feerate to TooLowFeerate error message (Aaron Carlucci) Pull request description: This PR adds the minimum feerate value into the `TooLowFeerate` error message for additional context. Addresses the second bullet point in #853. ACKs for top commit: jp1ac4: ACK 8be0d9856b29eb30593ae7614fe74430ffd206d4. Thanks! Tree-SHA512: 3a0e9c69ddb40433faf1e58c16dfee0212641b34478eddeda99388ebf82e2fb466633ab8f79c9bb0bb784f4a46807aa0a5abd65b9d92506144b84addb01dfdd8
This commit is contained in:
commit
b2aeafab56
@ -134,7 +134,7 @@ impl From<SpendCreationError> for CommandError {
|
||||
pub enum RbfErrorInfo {
|
||||
MissingFeerate,
|
||||
SuperfluousFeerate,
|
||||
TooLowFeerate(u64),
|
||||
TooLowFeerate(u64, u64),
|
||||
NotSignaling,
|
||||
}
|
||||
|
||||
@ -147,7 +147,9 @@ impl fmt::Display for RbfErrorInfo {
|
||||
Self::SuperfluousFeerate => {
|
||||
write!(f, "A feerate must not be provided if creating a cancel. We'll always use the smallest one which satisfies the RBF rules.")
|
||||
}
|
||||
Self::TooLowFeerate(r) => write!(f, "Feerate too low: {}.", r),
|
||||
Self::TooLowFeerate(r, m) => {
|
||||
write!(f, "Feerate {} too low for minimum feerate {}.", r, m)
|
||||
}
|
||||
Self::NotSignaling => write!(f, "Replacement candidate does not signal for RBF."),
|
||||
}
|
||||
}
|
||||
@ -823,6 +825,7 @@ impl DaemonControl {
|
||||
if feerate_vb < min_feerate_vb {
|
||||
return Err(CommandError::RbfError(RbfErrorInfo::TooLowFeerate(
|
||||
feerate_vb,
|
||||
min_feerate_vb,
|
||||
)));
|
||||
}
|
||||
// Get info about prev outputs to determine replacement outputs.
|
||||
|
||||
@ -1104,7 +1104,7 @@ def test_rbfpsbt_bump_fee(lianad, bitcoind):
|
||||
)
|
||||
)
|
||||
# We can now use RBF, but the feerate must be higher than that of the first transaction.
|
||||
with pytest.raises(RpcError, match=f"Feerate too low: 1."):
|
||||
with pytest.raises(RpcError, match=f"Feerate 1 too low for minimum feerate 2."):
|
||||
lianad.rpc.rbfpsbt(first_txid, False, 1)
|
||||
# Using a higher feerate works.
|
||||
lianad.rpc.rbfpsbt(first_txid, False, 2)
|
||||
@ -1144,7 +1144,9 @@ def test_rbfpsbt_bump_fee(lianad, bitcoind):
|
||||
# If we try to RBF the first transaction again, it will use the first RBF's
|
||||
# feerate to set the min feerate, instead of 1 sat/vb of first
|
||||
# transaction:
|
||||
with pytest.raises(RpcError, match=f"Feerate too low: {int(rbf_1_feerate)}."):
|
||||
with pytest.raises(
|
||||
RpcError, match=f"Feerate {int(rbf_1_feerate)} too low for minimum feerate 10."
|
||||
):
|
||||
lianad.rpc.rbfpsbt(first_txid, False, int(rbf_1_feerate))
|
||||
# Using 1 more for feerate works.
|
||||
feerate = int(rbf_1_feerate) + 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user