UNPKG

@node-dlc/chainmon

Version:
36 lines (35 loc) 1.21 kB
import { BitcoindClient, BlockHeader } from '@node-dlc/bitcoind'; import { BlockDiffResult } from './BlockDiffResult'; export declare class BlockDiffer { readonly bitcoind: BitcoindClient; constructor(bitcoind: BitcoindClient); /** * This method is used to construct the required block disconnects * and connects need to resync to the tip of the best blockchain even * if the prior header is now stale. * * For example, if the previous header was 4b and our current best * block header is 5c, we have a common ancestor of 2a and require * disconnecting 4b and 3b and connecting 3c, 4c, and 5c. * * 5c * | * 4c 4b * | | * 3c 3b * \ / * 2a * | * 1a * | * 0a * * If no fork is detected, we should expect to simply connect blocks * in the new best block chain. * * @param currentHeader best block header * @param priorHeader prior known header * @returns Actions needed to resolve a block difference */ diff(currentHeader: BlockHeader, priorHeader: BlockHeader): Promise<BlockDiffResult>; }