diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-05-04 12:39:59 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-05-04 12:42:26 +0200 |
commit | 16341cc15c545415ea996052dbd0b5bee0127571 (patch) | |
tree | fa02dfa6507fae04272bd785f10e8caddfba9e64 /src | |
parent | 59305cebee4e2140ff21962cc83c0499d1c5d748 (diff) | |
parent | bba2216fc14d949e560c83ba0be6cdc3eedfa73f (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.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"); |