From 62fc9421f1f95aecdfe190fcc6cdafb65f55124c Mon Sep 17 00:00:00 2001 From: jwinterm Date: Sun, 7 Jun 2026 16:42:16 -0400 Subject: [PATCH] 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). --- libwallet/src/contract/selection.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libwallet/src/contract/selection.rs b/libwallet/src/contract/selection.rs index 2a740f9..d86903b 100644 --- a/libwallet/src/contract/selection.rs +++ b/libwallet/src/contract/selection.rs @@ -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