aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-05-04 12:39:59 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-05-04 12:42:26 +0200
commit16341cc15c545415ea996052dbd0b5bee0127571 (patch)
treefa02dfa6507fae04272bd785f10e8caddfba9e64 /src
parent59305cebee4e2140ff21962cc83c0499d1c5d748 (diff)
parentbba2216fc14d949e560c83ba0be6cdc3eedfa73f (diff)
Merge pull request #5418
bba2216 RPC test for "#5418 Report missing inputs in sendrawtransaction" (Jonas Schnelli) de8e801 Report missing inputs in sendrawtransaction (Pieter Wuille)
Diffstat (limited to 'src')
-rw-r--r--src/rpcrawtransaction.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 1e13f5dbba..ca5aba8759 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -756,11 +756,16 @@ Value sendrawtransaction(const Array& params, bool fHelp)
if (!fHaveMempool && !fHaveChain) {
// push to local node and sync with wallets
CValidationState state;
- if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees)) {
- if(state.IsInvalid())
+ bool fMissingInputs;
+ if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees)) {
+ if (state.IsInvalid()) {
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
- else
+ } else {
+ if (fMissingInputs) {
+ throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs");
+ }
throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
+ }
}
} else if (fHaveChain) {
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");