001package org.consensusj.bitcoin.jsonrpc.test; 002 003import org.bitcoinj.base.Sha256Hash; 004 005import java.util.List; 006 007/** 008 * Abstraction(s) to help reuse tests between RegTest mode and TestNet or MainNet 009 * RegTest mode implementation will generate blocks when waitForBlocks() is called. 010 * Other implementations will actually wait for blocks to be confirmed. 011 */ 012public interface BlockChainEnvironment { 013 /** 014 * Wait for (and possible *hasten*) the creation of a single block 015 * 016 * @return A list with a single block hash 017 */ 018 List<Sha256Hash> waitForBlock() throws Exception; 019 020 /** 021 * Wait for (and possible *hasten*) the creation of blocks 022 * 023 * @param numBlocks the number of blocks to wait for 024 * @return A list of block hashes 025 */ 026 List<Sha256Hash> waitForBlocks(int numBlocks) throws Exception; 027}