Browse Source

bump block height defining ibd mode

develop^2
kenshin-samourai 4 years ago
parent
commit
247ca59402
  1. 28
      tracker/blockchain-processor.js

28
tracker/blockchain-processor.js

@ -60,7 +60,7 @@ class BlockchainProcessor extends AbstractProcessor {
const daemonNbHeaders = info.headers const daemonNbHeaders = info.headers
// Consider that we are in IBD mode if Dojo is far in the past (> 13,000 blocks) // Consider that we are in IBD mode if Dojo is far in the past (> 13,000 blocks)
this.isIBD = (highest.blockHeight < 612000) || (highest.blockHeight < daemonNbHeaders - 13000) this.isIBD = (highest.blockHeight < 655000) || (highest.blockHeight < daemonNbHeaders - 13000)
if (this.isIBD) if (this.isIBD)
return this.catchupIBDMode() return this.catchupIBDMode()
@ -169,7 +169,7 @@ class BlockchainProcessor extends AbstractProcessor {
try { try {
const hash = await this.client.getblockhash(height) const hash = await this.client.getblockhash(height)
const header = await this.client.getblockheader(hash) const header = await this.client.getblockheader(hash)
return this.processBlock(header) return this.processBlock(header)
} catch(e) { } catch(e) {
Logger.error(e, 'Tracker : BlockchainProcessor.catchupNormalMode()') Logger.error(e, 'Tracker : BlockchainProcessor.catchupNormalMode()')
process.exit() process.exit()
@ -206,25 +206,25 @@ class BlockchainProcessor extends AbstractProcessor {
/** /**
* Upon receipt of a new block hash, retrieve the block header from bitcoind via * Upon receipt of a new block hash, retrieve the block header from bitcoind via
* RPC. Continue pulling block headers back through the chain until the database * RPC. Continue pulling block headers back through the chain until the database
* contains header.previousblockhash, adding the headers to a stack. If the * contains header.previousblockhash, adding the headers to a stack. If the
* previousblockhash is not found on the first call, this is either a chain * previousblockhash is not found on the first call, this is either a chain
* re-org or the tracker missed blocks during a shutdown. * re-org or the tracker missed blocks during a shutdown.
* *
* Once the chain has bottomed out with a known block in the database, delete * Once the chain has bottomed out with a known block in the database, delete
* all known database transactions confirmed in blocks at heights greater than * all known database transactions confirmed in blocks at heights greater than
* the last known block height. These transactions are orphaned but may reappear * the last known block height. These transactions are orphaned but may reappear
* in the new chain. Notify relevant accounts of balance updates / * in the new chain. Notify relevant accounts of balance updates /
* transaction confirmation counts. * transaction confirmation counts.
* *
* Delete block entries not on the main chain. * Delete block entries not on the main chain.
* *
* Forward-scan through the block headers, pulling the full raw block hex via * Forward-scan through the block headers, pulling the full raw block hex via
* RPC. The raw block contains all transactions and is parsed by bitcoinjs-lib. * RPC. The raw block contains all transactions and is parsed by bitcoinjs-lib.
* Add the block to the database. Run checkTransaction for each transaction in * Add the block to the database. Run checkTransaction for each transaction in
* the block that is not in the database. Confirm all transactions in the block. * the block that is not in the database. Confirm all transactions in the block.
* *
* After each block, query bitcoin against all database unconfirmed outputs * After each block, query bitcoin against all database unconfirmed outputs
* to see if they remain in the mempool or have been confirmed in blocks. * to see if they remain in the mempool or have been confirmed in blocks.
* Malleated transactions entering the wallet will disappear from the mempool on * Malleated transactions entering the wallet will disappear from the mempool on
* block confirmation. * block confirmation.
* *
@ -247,7 +247,7 @@ class BlockchainProcessor extends AbstractProcessor {
} catch(err) { } catch(err) {
Logger.error(err, `Tracker : BlockchainProcessor.onBlockHash() : error in getblockheader(${blockHash})`) Logger.error(err, `Tracker : BlockchainProcessor.onBlockHash() : error in getblockheader(${blockHash})`)
} }
if(headers == null) if(headers == null)
return null return null
@ -263,7 +263,7 @@ class BlockchainProcessor extends AbstractProcessor {
// Process the blocks // Process the blocks
return await util.seriesCall(headers, header => { return await util.seriesCall(headers, header => {
return this.processBlock(header) return this.processBlock(header)
}) })
} catch(e) { } catch(e) {
@ -302,7 +302,7 @@ class BlockchainProcessor extends AbstractProcessor {
} }
/** /**
* Cancel confirmation of transactions * Cancel confirmation of transactions
* and delete blocks after a given height * and delete blocks after a given height
* @param {integer} height - height of last block maintained * @param {integer} height - height of last block maintained
* @returns {Promise} * @returns {Promise}
@ -348,7 +348,7 @@ class BlockchainProcessor extends AbstractProcessor {
Logger.info(`Tracker : Rescanning block ${height}`) Logger.info(`Tracker : Rescanning block ${height}`)
const hash = await this.client.getblockhash(height) const hash = await this.client.getblockhash(height)
const header = await this.client.getblockheader(hash) const header = await this.client.getblockheader(hash)
return this.processBlock(header) return this.processBlock(header)
} catch(e) { } catch(e) {
Logger.error(e, 'Tracker : BlockchainProcessor.rescan()') Logger.error(e, 'Tracker : BlockchainProcessor.rescan()')
throw e throw e
@ -367,7 +367,7 @@ class BlockchainProcessor extends AbstractProcessor {
const hex = await this.client.getblock(header.hash, false) const hex = await this.client.getblock(header.hash, false)
const block = new Block(hex, header) const block = new Block(hex, header)
const txsForBroadcast = await block.checkBlock() const txsForBroadcast = await block.checkBlock()
// Send notifications // Send notifications

Loading…
Cancel
Save