Skip to content

Commit

Permalink
Merge bitcoin#18037: Util: Allow scheduler to be mocked
Browse files Browse the repository at this point in the history
8bca30e [rpc] expose ability to mock scheduler via the rpc (Amiti Uttarwar)
7c8b6e5 [lib] add scheduler to node context (Amiti Uttarwar)
930d837 [test] add chainparams property to indicate chain allows time mocking (Amiti Uttarwar)
1cd43e8 [test] unit test for new MockForward scheduler method (Amiti Uttarwar)
a6f6359 [util] allow scheduler to be mocked (Amiti Uttarwar)

Pull request description:

  This PR is to support functional tests by allowing the scheduler to be mocked via the RPC.

  It adds a `MockForward` method to the scheduler class that iterates through the task queue and reschedules them to be `delta_seconds` sooner.

  This is currently used to support functional testing of the "unbroadcast" set tracking in bitcoin#18038. If this patch is accepted, it would also be useful to simplify the code in bitcoin#16698.

ACKs for top commit:
  MarcoFalke:
    ACK 8bca30e, only change is some style fixups 🕓

Tree-SHA512: 2a97fe8ade2b7fd1fb5cdfa1dcafb3227a377d7a847e3845a228bc119eb77824b4aefa43d922a06d583939b22725e223f308cf092961048079d36f6b1d9a639b
  • Loading branch information
MarcoFalke authored and sidhujag committed Feb 18, 2020
1 parent 3fd2ed7 commit 990a3ee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,9 @@ bool AppInitMain(NodeContext& node)
assert(!node.scheduler);
node.scheduler = MakeUnique<CScheduler>();

assert(!node.scheduler);
node.scheduler = MakeUnique<CScheduler>();

// Start the lightweight task scheduler thread
CScheduler::Function serviceLoop = [&node]{ node.scheduler->serviceQueue(); };
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
Expand Down

0 comments on commit 990a3ee

Please sign in to comment.