Skip to content

Commit 61f8298

Browse files
rpc: Adjust ifdef to avoid unreachable code
1 parent 7466a26 commit 61f8298

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,18 +1023,18 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
10231023
new_request.params.push_back(request.params[1]);
10241024
new_request.params.push_back(request.params[3]);
10251025
return signrawtransactionwithkey(new_request);
1026-
}
1027-
// Otherwise sign with the wallet which does not take a privkeys parameter
1026+
} else {
10281027
#ifdef ENABLE_WALLET
1029-
else {
1028+
// Otherwise sign with the wallet which does not take a privkeys parameter
10301029
new_request.params.push_back(request.params[0]);
10311030
new_request.params.push_back(request.params[1]);
10321031
new_request.params.push_back(request.params[3]);
10331032
return signrawtransactionwithwallet(new_request);
1034-
}
1033+
#else
1034+
// If we have made it this far, then wallet is disabled and no private keys were given, so fail here.
1035+
throw JSONRPCError(RPC_INVALID_PARAMETER, "No private keys available.");
10351036
#endif
1036-
// If we have made it this far, then wallet is disabled and no private keys were given, so fail here.
1037-
throw JSONRPCError(RPC_INVALID_PARAMETER, "No private keys available.");
1037+
}
10381038
}
10391039

10401040
UniValue sendrawtransaction(const JSONRPCRequest& request)

0 commit comments

Comments
 (0)