rpc: [wallet] Use unsigned type for tx version in sendall
What changed, and why it matters
This is a tiny type-cleanup in the wallet's 'sendall' RPC command. It changes how the transaction version number is read from a signed integer to an unsigned integer matching the field's actual type. There is no direct evidence in the commit that this fixes an exploitable bug, but using the wrong signed type could in principle allow a user to pass a negative value that gets misinterpreted as a very large positive version number, which might then be rejected or handled unexpectedly.
Treat as a minor hardening change. Review whether negative or out-of-range version values are rejected elsewhere before reaching this code, and consider adding an explicit range check for the version parameter. No urgent action is indicated by the diff alone.
Security signals we found
User-controlled integer parsed as signed type and assigned to unsigned field
Implicit signed-to-unsigned conversion on RPC input
No bounds or negative-value validation visible in the diff
Transaction version field type mismatch
Evidence from the diff
In src/wallet/rpc/spend.cpp, the sendall RPC handler previously read the optional ‘version’ parameter with getInt
Changed components
src/wallet/rpc/spend.cppwallet RPC sendall commandCoinControl transaction version fieldInspect captured patch +1 / −1
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index c7208e05..64cf95a4 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -1467,7 +1467,7 @@ RPCHelpMan sendall()
}
if (options.exists("version")) {
- coin_control.m_version = options["version"].getInt<int>();
+ coin_control.m_version = options["version"].getInt<decltype(coin_control.m_version)>();
}
if (coin_control.m_version == TRUC_VERSION) {
Why this scored 18/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.