mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
miner: have waitNext return after 20 min on testnet
On testnet we need to create a min diff template after 20 min.
This commit is contained in:
@@ -958,6 +958,7 @@ public:
|
||||
auto now{NodeClock::now()};
|
||||
const auto deadline = now + options.timeout;
|
||||
const MillisecondsDouble tick{1000};
|
||||
const bool allow_min_difficulty{chainman().GetParams().GetConsensus().fPowAllowMinDifficultyBlocks};
|
||||
|
||||
do {
|
||||
bool tip_changed{false};
|
||||
@@ -982,6 +983,14 @@ public:
|
||||
// Must release m_tip_block_mutex before locking cs_main, to avoid deadlocks.
|
||||
LOCK(::cs_main);
|
||||
|
||||
// On test networks return a minimum difficulty block after 20 minutes
|
||||
if (!tip_changed && allow_min_difficulty) {
|
||||
const NodeClock::time_point tip_time{std::chrono::seconds{chainman().ActiveChain().Tip()->GetBlockTime()}};
|
||||
if (now > tip_time + 20min) {
|
||||
tip_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We determine if fees increased compared to the previous template by generating
|
||||
* a fresh template. There may be more efficient ways to determine how much
|
||||
|
||||
Reference in New Issue
Block a user