diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2014-12-03 14:13:09 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2015-04-28 07:16:39 -0700 |
commit | de8e801d3f7c61634b4fdec2a389ca36abbd9e9a (patch) | |
tree | ddf907e5ea65c137c6dea888205f21b221283cea /src | |
parent | 9e06be2802eb731dfa3273abdf85e3c94d7c1e59 (diff) |
Report missing inputs in sendrawtransaction
Diffstat (limited to 'src')
-rw-r--r-- | src/rpcrawtransaction.cpp | 11 |
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"); |