HomePhabricator

rpc: Better way to allow shutdown while in generateblocks

Description

rpc: Better way to allow shutdown while in generateblocks

Summary:
By checking the shutdown flag every loop we can use the entire nonce space
instead of breaking every 16 bits to check the shutdown flag.

This has been possible since the shutdown flag was switched to an atomic,
before that change it was controlled by a condition variable and lock.

Backport of Core PR16262

Test Plan:
ninja && ninja check-all

This still runs fine:

addr=`src/bitcoin-cli -regtest getnewaddress`
bitcoin-cli -regtest generatetoaddress 100 $addr

This command can still be interrupted cleanly with Ctrl-C:

bitcoin-cli -regtest generatetoaddress 100000 $addr

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D7839

Details

Provenance
Patrick Strateman <patrick.strateman@gmail.com>Authored on Jun 21 2019, 17:27
PiRKCommitted on Oct 9 2020, 11:21
PiRKPushed on Oct 9 2020, 11:21
Reviewer
Restricted Owners Package
Differential Revision
D7839: rpc: Better way to allow shutdown while in generateblocks
Parents
rABC948877df9035: wallet: Prefer full destination groups in coin selection
Branches
Unknown
Tags
Unknown