mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
rpc: Adjust witness-tx deserialize error message
Github-Pull: #19836
Rebased-From: 3333077823
This commit is contained in:
parent
a7bdf5c3ac
commit
9c714993e9
3 changed files with 10 additions and 9 deletions
|
@ -620,7 +620,7 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < txs.size(); idx++) {
|
for (unsigned int idx = 0; idx < txs.size(); idx++) {
|
||||||
if (!DecodeHexTx(txVariants[idx], txs[idx].get_str())) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
||||||
|
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
if (!DecodeHexTx(mtx, request.params[0].get_str())) {
|
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;
|
FillableSigningProvider keystore;
|
||||||
|
@ -800,10 +800,10 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||||
UniValueType(), // NUM or BOOL, checked later
|
UniValueType(), // NUM or BOOL, checked later
|
||||||
});
|
});
|
||||||
|
|
||||||
// parse hex string from parameter
|
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
if (!DecodeHexTx(mtx, request.params[0].get_str()))
|
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.");
|
||||||
|
}
|
||||||
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
|
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
|
||||||
|
|
||||||
CFeeRate max_raw_tx_fee_rate = DEFAULT_MAX_RAW_TX_FEE_RATE;
|
CFeeRate max_raw_tx_fee_rate = DEFAULT_MAX_RAW_TX_FEE_RATE;
|
||||||
|
@ -875,7 +875,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
|
||||||
|
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
if (!DecodeHexTx(mtx, request.params[0].get_array()[0].get_str())) {
|
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)));
|
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
|
||||||
const uint256& tx_hash = tx->GetHash();
|
const uint256& tx_hash = tx->GetHash();
|
||||||
|
|
|
@ -353,8 +353,9 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
|
||||||
}.Check(request);
|
}.Check(request);
|
||||||
|
|
||||||
CMutableTransaction tx;
|
CMutableTransaction tx;
|
||||||
if (!DecodeHexTx(tx, request.params[0].get_str()))
|
if (!DecodeHexTx(tx, 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.");
|
||||||
|
}
|
||||||
uint256 hashTx = tx.GetHash();
|
uint256 hashTx = tx.GetHash();
|
||||||
CWalletTx wtx(pwallet, MakeTransactionRef(std::move(tx)));
|
CWalletTx wtx(pwallet, MakeTransactionRef(std::move(tx)));
|
||||||
|
|
||||||
|
|
|
@ -3270,7 +3270,7 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
|
||||||
|
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
if (!DecodeHexTx(mtx, request.params[0].get_str())) {
|
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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sign the transaction
|
// Sign the transaction
|
||||||
|
|
Loading…
Add table
Reference in a new issue