aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-10-13 15:21:03 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-10-13 14:57:52 +0200
commit33330778230961cfbf2a24de36b5877e395cc596 (patch)
treed64f2f2a59a16d02025485e0e976280cf122c79a /src/rpc/rawtransaction.cpp
parentcccc7525697e7b8d99b545e34f0f504c78ffdb94 (diff)
downloadbitcoin-33330778230961cfbf2a24de36b5877e395cc596.tar.xz
rpc: Adjust witness-tx deserialize error message
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
-rw-r--r--src/rpc/rawtransaction.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index b0df6ec287..5354b4a681 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -645,7 +645,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
for (unsigned int idx = 0; idx < txs.size(); idx++) {
if (!DecodeHexTx(txVariants[idx], txs[idx].get_str())) {
- throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed for tx %d", idx));
+ throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed for tx %d. Make sure the tx has at least one input.", idx));
}
}
@@ -767,7 +767,7 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
CMutableTransaction mtx;
if (!DecodeHexTx(mtx, request.params[0].get_str())) {
- throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
+ throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input.");
}
FillableSigningProvider keystore;
@@ -831,10 +831,10 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
UniValueType(), // VNUM or VSTR, checked inside AmountFromValue()
});
- // parse hex string from parameter
CMutableTransaction mtx;
- if (!DecodeHexTx(mtx, request.params[0].get_str()))
- throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
+ if (!DecodeHexTx(mtx, request.params[0].get_str())) {
+ throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input.");
+ }
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
const CFeeRate max_raw_tx_fee_rate = request.params[1].isNull() ?
@@ -905,7 +905,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
CMutableTransaction mtx;
if (!DecodeHexTx(mtx, request.params[0].get_array()[0].get_str())) {
- throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
+ throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input.");
}
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
const uint256& tx_hash = tx->GetHash();