wallet: store fee for not_enough_{unlocked_,}balance
What changed, and why it matters
This commit only adds a 'fee' field to two existing wallet error types (not_enough_unlocked_money and not_enough_money). It does not change how transactions are validated, how fees are calculated, or how money is handled. It simply lets the wallet remember and report what fee was involved when an error about insufficient balance occurs. There is no security issue visible in this change.
No security action required. Review the callers that construct these exceptions to ensure the new fee argument is supplied consistently, but this is a code-quality concern, not a security issue.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch extends two exception classes in src/wallet/wallet_errors.h to store and expose a m_fee member. Constructors are updated to accept a fee argument, and a fee() accessor is added. The diff is limited to error metadata and does not alter consensus, fee logic, balance checks, or any control flow. No security vulnerability is introduced by this change.
Changed components
src/wallet/wallet_errors.hInspect captured patch +6 / −0
diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h
index 1ca1b21..8c15944 100644
--- a/src/wallet/wallet_errors.h
+++ b/src/wallet/wallet_errors.h
@@ -494,11 +494,13 @@ namespace tools
: transfer_error(std::move(loc), "not enough unlocked money")
, m_available(available)
, m_tx_amount(tx_amount)
+ , m_fee(fee)
{
}
uint64_t available() const { return m_available; }
uint64_t tx_amount() const { return m_tx_amount; }
+ uint64_t fee() const { return m_fee; }
std::string to_string() const
{
@@ -512,6 +514,7 @@ namespace tools
private:
uint64_t m_available;
uint64_t m_tx_amount;
+ uint64_t m_fee;
};
//----------------------------------------------------------------------------------------------------
struct not_enough_money : public transfer_error
@@ -520,11 +523,13 @@ namespace tools
: transfer_error(std::move(loc), "not enough money")
, m_available(available)
, m_tx_amount(tx_amount)
+ , m_fee(fee)
{
}
uint64_t available() const { return m_available; }
uint64_t tx_amount() const { return m_tx_amount; }
+ uint64_t fee() const { return m_fee; }
std::string to_string() const
{
@@ -538,6 +543,7 @@ namespace tools
private:
uint64_t m_available;
uint64_t m_tx_amount;
+ uint64_t m_fee;
};
//----------------------------------------------------------------------------------------------------
struct tx_not_possible : public transfer_error
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.