use of co.rsk.bitcoinj.core.CheckpointManager in project rskj by rsksmart.
the class BridgeSupport method getLowestBlock.
/**
* Returns the first bitcoin block we have. It is either a checkpoint or the genesis
*/
private StoredBlock getLowestBlock() throws IOException {
InputStream checkpoints = this.getCheckPoints();
if (checkpoints == null) {
BtcBlock genesis = bridgeConstants.getBtcParams().getGenesisBlock();
return new StoredBlock(genesis, genesis.getWork(), 0);
}
CheckpointManager manager = new CheckpointManager(bridgeConstants.getBtcParams(), checkpoints);
long time = getActiveFederation().getCreationTime().toEpochMilli();
// Go back 1 week to match CheckpointManager.checkpoint() behaviour
time -= 86400 * 7;
return manager.getCheckpointBefore(time);
}
Aggregations