mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
test: Fix off-by-one in mockscheduler test RPC
This commit is contained in:
parent
61fea52171
commit
fa2e614d16
2 changed files with 3 additions and 2 deletions
|
@ -424,7 +424,7 @@ static RPCHelpMan mockscheduler()
|
||||||
// check params are valid values
|
// check params are valid values
|
||||||
RPCTypeCheck(request.params, {UniValue::VNUM});
|
RPCTypeCheck(request.params, {UniValue::VNUM});
|
||||||
int64_t delta_seconds = request.params[0].get_int64();
|
int64_t delta_seconds = request.params[0].get_int64();
|
||||||
if ((delta_seconds <= 0) || (delta_seconds > 3600)) {
|
if (delta_seconds <= 0 || delta_seconds > 3600) {
|
||||||
throw std::runtime_error("delta_time must be between 1 and 3600 seconds (1 hr)");
|
throw std::runtime_error("delta_time must be between 1 and 3600 seconds (1 hr)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
|
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
|
#include <util/time.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
@ -80,7 +81,7 @@ void CScheduler::schedule(CScheduler::Function f, std::chrono::system_clock::tim
|
||||||
|
|
||||||
void CScheduler::MockForward(std::chrono::seconds delta_seconds)
|
void CScheduler::MockForward(std::chrono::seconds delta_seconds)
|
||||||
{
|
{
|
||||||
assert(delta_seconds.count() > 0 && delta_seconds < std::chrono::hours{1});
|
assert(delta_seconds > 0s && delta_seconds <= 1h);
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(newTaskMutex);
|
LOCK(newTaskMutex);
|
||||||
|
|
Loading…
Add table
Reference in a new issue