aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-10-03 09:56:59 +0800
committerfanquake <fanquake@gmail.com>2020-10-03 11:13:21 +0800
commit54fc96ffa70ad3a53d32709101b7a2ce064d822e (patch)
treec1bb8391dd2fb67d4dfbd37b9364a1094700cbb7 /src
parent171cd05ae3413e18fd6382572c86f2bb21ab2fd9 (diff)
parentf471a3be00c2b6433b8c258b716982c0539da13f (diff)
downloadbitcoin-54fc96ffa70ad3a53d32709101b7a2ce064d822e.tar.xz
Merge #19956: rpc: Improve invalid vout value rpc error message
f471a3be00c2b6433b8c258b716982c0539da13f scripted diff: Improve invalid vout value rpc error message (Nima Yazdanmehr) Pull request description: Since the `vout` value can start at `0`, the error message for *negative* values can be improved to something like: `vout cannot be negative`. ACKs for top commit: fanquake: ACK f471a3be00c2b6433b8c258b716982c0539da13f promag: Code review ACK f471a3be00c2b6433b8c258b716982c0539da13f. Tree-SHA512: fbdee3d0ddd5b58eb93934a1217b44e125a9ad39e672b1f35c7609c6c5fcf45ae1b731d3d6135b7225d98792dbfc34a50907b8c41274a5b029d7b5c59f886560
Diffstat (limited to 'src')
-rw-r--r--src/bitcoin-tx.cpp2
-rw-r--r--src/rpc/rawtransaction_util.cpp4
-rw-r--r--src/wallet/rpcwallet.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index 085f1ecfda..e22b3766cf 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -594,7 +594,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
const int nOut = prevOut["vout"].get_int();
if (nOut < 0)
- throw std::runtime_error("vout must be positive");
+ throw std::runtime_error("vout cannot be negative");
COutPoint out(txid, nOut);
std::vector<unsigned char> pkData(ParseHexUV(prevOut["scriptPubKey"], "scriptPubKey"));
diff --git a/src/rpc/rawtransaction_util.cpp b/src/rpc/rawtransaction_util.cpp
index 8dfbead0e4..f004ecc20c 100644
--- a/src/rpc/rawtransaction_util.cpp
+++ b/src/rpc/rawtransaction_util.cpp
@@ -55,7 +55,7 @@ CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniVal
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key");
int nOutput = vout_v.get_int();
if (nOutput < 0)
- throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout cannot be negative");
uint32_t nSequence;
if (rbf) {
@@ -177,7 +177,7 @@ void ParsePrevouts(const UniValue& prevTxsUnival, FillableSigningProvider* keyst
int nOut = find_value(prevOut, "vout").get_int();
if (nOut < 0) {
- throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout must be positive");
+ throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout cannot be negative");
}
COutPoint out(txid, nOut);
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 10af5c36c8..4a11eb1669 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -2204,7 +2204,7 @@ static RPCHelpMan lockunspent()
const uint256 txid(ParseHashO(o, "txid"));
const int nOutput = find_value(o, "vout").get_int();
if (nOutput < 0) {
- throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout cannot be negative");
}
const COutPoint outpt(txid, nOutput);