Skip to content

Commit

Permalink
Report missing inputs in sendrawtransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Apr 28, 2015
1 parent 9e06be2 commit de8e801
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/rpcrawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit de8e801

Please sign in to comment.