Skip to content

Commit 10953a7

Browse files
committed
Better error message for fundrawtransaction w/ empty vout
Previously this case failed deep in Cwallet::CreateTransaction() with the error message "Transaction amounts must be positive"
1 parent 61e1eb2 commit 10953a7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,6 +2418,9 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
24182418
if (!DecodeHexTx(origTx, params[0].get_str()))
24192419
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
24202420

2421+
if (origTx.vout.size() == 0)
2422+
throw JSONRPCError(RPC_INVALID_PARAMETER, "TX must have at least one output");
2423+
24212424
bool includeWatching = false;
24222425
if (params.size() > 1)
24232426
includeWatching = params[1].get_bool();

0 commit comments

Comments
 (0)