Search in sources :

Example 1 with BlockNotConnectingException

use of bisq.core.dao.blockchain.exceptions.BlockNotConnectingException in project bisq-core by bisq-network.

the class FullNodeParser method parseBlocks.

// /////////////////////////////////////////////////////////////////////////////////////////
// Package private
// /////////////////////////////////////////////////////////////////////////////////////////
@VisibleForTesting
void parseBlocks(int startBlockHeight, int chainHeadHeight, Consumer<BsqBlock> newBlockHandler) throws BsqBlockchainException, BlockNotConnectingException {
    try {
        for (int blockHeight = startBlockHeight; blockHeight <= chainHeadHeight; blockHeight++) {
            Block btcdBlock = rpcService.requestBlock(blockHeight);
            final BsqBlock bsqBlock = parseBlock(btcdBlock);
            newBlockHandler.accept(bsqBlock);
        }
    } catch (BlockNotConnectingException e) {
        throw e;
    } catch (Throwable t) {
        log.error(t.toString());
        t.printStackTrace();
        throw new BsqBlockchainException(t);
    }
}
Also used : BsqBlockchainException(bisq.core.dao.blockchain.exceptions.BsqBlockchainException) BsqBlock(bisq.core.dao.blockchain.vo.BsqBlock) Block(com.neemre.btcdcli4j.core.domain.Block) BlockNotConnectingException(bisq.core.dao.blockchain.exceptions.BlockNotConnectingException) BsqBlock(bisq.core.dao.blockchain.vo.BsqBlock) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

BlockNotConnectingException (bisq.core.dao.blockchain.exceptions.BlockNotConnectingException)1 BsqBlockchainException (bisq.core.dao.blockchain.exceptions.BsqBlockchainException)1 BsqBlock (bisq.core.dao.blockchain.vo.BsqBlock)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Block (com.neemre.btcdcli4j.core.domain.Block)1