Skip to content

Commit

Permalink
rpc: check for negative timeout arg in waitfor*
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Aug 26, 2024
1 parent e6386d5 commit fd05970
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ static RPCHelpMan waitfornewblock()
int timeout = 0;
if (!request.params[0].isNull())
timeout = request.params[0].getInt<int>();
if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout");

CUpdatedBlock block;
{
Expand Down Expand Up @@ -324,6 +325,7 @@ static RPCHelpMan waitforblock()

if (!request.params[1].isNull())
timeout = request.params[1].getInt<int>();
if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout");

CUpdatedBlock block;
{
Expand Down Expand Up @@ -372,6 +374,7 @@ static RPCHelpMan waitforblockheight()

if (!request.params[1].isNull())
timeout = request.params[1].getInt<int>();
if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout");

CUpdatedBlock block;
{
Expand Down

0 comments on commit fd05970

Please sign in to comment.