Browse Source
Merge pull request #144 from Samourai-Wallet/feat_dojo_tracker_moving_threshold
add dynamic switch of startup mode
use-env-var-docker
kenshin samourai
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
2 deletions
-
tracker/blockchain-processor.js
|
|
@ -55,9 +55,12 @@ class BlockchainProcessor extends AbstractProcessor { |
|
|
|
* @returns {Promise} |
|
|
|
*/ |
|
|
|
async catchup() { |
|
|
|
// Consider that we are in IBD mode if Dojo is far in the past
|
|
|
|
const highest = await db.getHighestBlock() |
|
|
|
this.isIBD = highest.blockHeight < 570000 |
|
|
|
const info = await this.client.getblockchaininfo() |
|
|
|
const daemonNbHeaders = info.headers |
|
|
|
|
|
|
|
// Consider that we are in IBD mode if Dojo is far in the past (> 13,000 blocks)
|
|
|
|
this.isIBD = highest.blockHeight < daemonNbHeaders - 13000 |
|
|
|
|
|
|
|
if (this.isIBD) |
|
|
|
return this.catchupIBDMode() |
|
|
|