mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-29 07:18:58 +01:00
rpc: check for negative timeout arg in waitfor*
This commit is contained in:
@@ -296,6 +296,7 @@ static RPCHelpMan waitfornewblock()
|
|||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
if (!request.params[0].isNull())
|
if (!request.params[0].isNull())
|
||||||
timeout = request.params[0].getInt<int>();
|
timeout = request.params[0].getInt<int>();
|
||||||
|
if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout");
|
||||||
|
|
||||||
CUpdatedBlock block;
|
CUpdatedBlock block;
|
||||||
{
|
{
|
||||||
@@ -343,6 +344,7 @@ static RPCHelpMan waitforblock()
|
|||||||
|
|
||||||
if (!request.params[1].isNull())
|
if (!request.params[1].isNull())
|
||||||
timeout = request.params[1].getInt<int>();
|
timeout = request.params[1].getInt<int>();
|
||||||
|
if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout");
|
||||||
|
|
||||||
CUpdatedBlock block;
|
CUpdatedBlock block;
|
||||||
{
|
{
|
||||||
@@ -391,6 +393,7 @@ static RPCHelpMan waitforblockheight()
|
|||||||
|
|
||||||
if (!request.params[1].isNull())
|
if (!request.params[1].isNull())
|
||||||
timeout = request.params[1].getInt<int>();
|
timeout = request.params[1].getInt<int>();
|
||||||
|
if (timeout < 0) throw JSONRPCError(RPC_MISC_ERROR, "Negative timeout");
|
||||||
|
|
||||||
CUpdatedBlock block;
|
CUpdatedBlock block;
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user