Skip to content

Commit de8e801

Browse files
committed
Report missing inputs in sendrawtransaction
1 parent 9e06be2 commit de8e801

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/rpcrawtransaction.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,16 @@ Value sendrawtransaction(const Array& params, bool fHelp)
756756
if (!fHaveMempool && !fHaveChain) {
757757
// push to local node and sync with wallets
758758
CValidationState state;
759-
if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees)) {
760-
if(state.IsInvalid())
759+
bool fMissingInputs;
760+
if (!AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees)) {
761+
if (state.IsInvalid()) {
761762
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
762-
else
763+
} else {
764+
if (fMissingInputs) {
765+
throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs");
766+
}
763767
throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
768+
}
764769
}
765770
} else if (fHaveChain) {
766771
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");

0 commit comments

Comments
 (0)