Contracts: use Error::Fee for the fee-overshoot error

The committed-fee-exceeded check returned a GenericError. Use the existing
Error::Fee variant and fold the "cancel and retry" hint into the message.

Addresses PR #754 review (selection.rs).
This commit is contained in:
jwinterm
2026-06-07 16:42:16 -04:00
parent b3f75ee2b5
commit 62fc9421f1
+2 -3
View File
@@ -212,13 +212,12 @@ where
// Return an error if the fee computed is larger than the committed fee
if committed_fee.is_some() && my_fee.fee() > committed_fee.unwrap().fee() {
// TODO: Return a specific Fee estimation error and suggest the user to cancel the transaction
let msg = format!(
"Fee computed ({}) is larger than the committed fee ({})",
"Fee computed ({}) is larger than the committed fee ({}); cancel the transaction and retry",
my_fee.fee(),
committed_fee.unwrap().fee()
);
return Err(Error::GenericError(msg.into()).into());
return Err(Error::Fee(msg).into());
}
// Check that the inputs we picked are enough to cover all our output amounts and fees