rpc+bitcoin-tx: Specify correct type for ParseFixedPoint()
What changed, and why it matters
This is a tiny type-cleanup change. The developer replaced the custom CAmount type with the standard int64_t type in two places where a string is being converted to a numeric amount. In Bitcoin Core, CAmount is defined as int64_t, so the compiled code is identical and behavior does not change. It is essentially a code-quality fix with no security effect.
No action required. Treat as a routine code-quality commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit changes the local variable type used as the output parameter for ParseFixedPoint() from CAmount to int64_t in src/bitcoin-tx.cpp and src/rpc/util.cpp. ParseFixedPoint() writes an int64_t through its pointer parameter. Because CAmount is a typedef for int64_t, this is a non-functional refactor. No bounds checks, parsing logic, or control flow were altered.
Changed components
src/bitcoin-tx.cppsrc/rpc/util.cppInspect captured patch +2 / −2
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index f21db40f..017e8e1e 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -556,7 +556,7 @@ static CAmount AmountFromValue(const UniValue& value)
{
if (!value.isNum() && !value.isStr())
throw std::runtime_error("Amount is not a number or string");
- CAmount amount;
+ int64_t amount;
if (!ParseFixedPoint(value.getValStr(), 8, &amount))
throw std::runtime_error("Invalid amount");
if (!MoneyRange(amount))
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 80b08d01..fedde2eb 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -99,7 +99,7 @@ CAmount AmountFromValue(const UniValue& value, int decimals)
{
if (!value.isNum() && !value.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string");
- CAmount amount;
+ int64_t amount;
if (!ParseFixedPoint(value.getValStr(), decimals, &amount))
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
if (!MoneyRange(amount))
Why this scored 11/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.