@Bean StoreBuilder storeBuilder(DefaultConfig defaultConfig) { return new StoreBuilder(defaultConfig); }
public static StoreBuilder getProdMockBuilder() { return new StoreBuilder(new ProdDefaultConfig()); }
@Before public void setUp() { StoreBuilder builder = new StoreBuilder(config); this.branchConfig = new BranchConfiguration(builder); this.peerHandlerGroup = new SimplePeerHandlerGroup(PeerHandlerMock.factory); }
@Before public void setUp() { builder = new StoreBuilder(new DefaultConfig()); }
@Test public void shouldBeBuiltMetaStore() { BlockHusk block = BlockChainTestUtils.genesisBlock(); StoreBuilder builder = new StoreBuilder(new DefaultConfig()); MetaStore store = builder.buildMetaStore(BRANCH_ID); store.setBestBlock(block); assertThat(store.contains(BlockchainMetaInfo.BRANCH.toString())).isTrue(); assertThat(store.getBestBlockHash()).isEqualTo(block.getHash()); }
public static BlockChain createBlockChain(boolean isProductionMode) { StoreBuilder storeBuilder; if (isProductionMode) { storeBuilder = StoreTestUtils.getProdMockBuilder(); } else { storeBuilder = new StoreBuilder(new DefaultConfig()); } return BlockChainBuilder.Builder() .addGenesis(genesis) .setStoreBuilder(storeBuilder) .build(); }
@Test public void executorTest() { CoinContract contract = new CoinContract(); Runtime runtime = new Runtime<>( new StateStore<>(new HashMapDbSource()), new TransactionReceiptStore(new HashMapDbSource()) ); runtime.addContract(ContractId.of("c10e873655becf550c4aece75a091f4553d6202d"), contract); // Block Store // Blockchain Runtime StoreBuilder builder = new StoreBuilder(new DefaultConfig(false)); BlockStore store = builder.buildBlockStore(BRANCH_ID); MetaStore meta = builder.buildMetaStore(BRANCH_ID); BlockExecutor ex = new BlockExecutor(store, meta, runtime); // BlockStore add genesis block and other ex.runExecuteBlocks(); } }