@Test public void onDepositsFromBlock_shouldInitializeGenesis() { final UInt64 genesisTime = Constants.MIN_GENESIS_TIME; final int batchSize = INITIAL_DEPOSIT_DATA.size() / 2; final DepositsFromBlockEvent event1 = DepositsFromBlockEvent.create( UInt64.valueOf(100), dataStructureUtil.randomBytes32(), UInt64.ZERO, INITIAL_DEPOSITS.stream().limit(batchSize)); final DepositsFromBlockEvent event2 = DepositsFromBlockEvent.create( UInt64.valueOf(100), dataStructureUtil.randomBytes32(), genesisTime, INITIAL_DEPOSITS.stream().skip(batchSize)); assertThat(storageSystem.recentChainData().isPreGenesis()).isTrue(); genesisHandler.onDepositsFromBlock(event1); assertThat(storageSystem.recentChainData().isPreGenesis()).isTrue(); genesisHandler.onDepositsFromBlock(event2); assertThat(storageSystem.recentChainData().isPreGenesis()).isFalse(); }
@Override public void onDepositsFromBlock(final DepositsFromBlockEvent event) { if (!recentChainData.isPreGenesis()) { return; } LOG.trace( "Processing {} deposits from block {}", event.getDeposits().size(), event.getBlockNumber()); final List<DepositWithIndex> deposits = event.getDeposits().stream() .map(DepositUtil::convertDepositEventToOperationDeposit) .collect(Collectors.toList()); processNewData(event.getBlockHash(), event.getBlockTimestamp(), deposits); }
GenesisHandler implements Eth1EventsChannel { @Override public void onDepositsFromBlock(final DepositsFromBlockEvent event) { if (!recentChainData.isPreGenesis()) { return; } LOG.trace( "Processing {} deposits from block {}", event.getDeposits().size(), event.getBlockNumber()); final List<DepositWithIndex> deposits = event.getDeposits().stream() .map(DepositUtil::convertDepositEventToOperationDeposit) .collect(Collectors.toList()); processNewData(event.getBlockHash(), event.getBlockTimestamp(), deposits); } }
GenesisHandler implements Eth1EventsChannel { @Override public void onDepositsFromBlock(final DepositsFromBlockEvent event) { if (!recentChainData.isPreGenesis()) { return; } LOG.trace( "Processing {} deposits from block {}", event.getDeposits().size(), event.getBlockNumber()); final List<DepositWithIndex> deposits = event.getDeposits().stream() .map(DepositUtil::convertDepositEventToOperationDeposit) .collect(Collectors.toList()); processNewData(event.getBlockHash(), event.getBlockTimestamp(), deposits); } GenesisHandler(final RecentChainData recentChainData); }
GenesisHandler implements Eth1EventsChannel { @Override public void onDepositsFromBlock(final DepositsFromBlockEvent event) { if (!recentChainData.isPreGenesis()) { return; } LOG.trace( "Processing {} deposits from block {}", event.getDeposits().size(), event.getBlockNumber()); final List<DepositWithIndex> deposits = event.getDeposits().stream() .map(DepositUtil::convertDepositEventToOperationDeposit) .collect(Collectors.toList()); processNewData(event.getBlockHash(), event.getBlockTimestamp(), deposits); } GenesisHandler(final RecentChainData recentChainData); @Override void onDepositsFromBlock(final DepositsFromBlockEvent event); @Override void onMinGenesisTimeBlock(MinGenesisTimeBlockEvent event); }
GenesisHandler implements Eth1EventsChannel { @Override public void onDepositsFromBlock(final DepositsFromBlockEvent event) { if (!recentChainData.isPreGenesis()) { return; } LOG.trace( "Processing {} deposits from block {}", event.getDeposits().size(), event.getBlockNumber()); final List<DepositWithIndex> deposits = event.getDeposits().stream() .map(DepositUtil::convertDepositEventToOperationDeposit) .collect(Collectors.toList()); processNewData(event.getBlockHash(), event.getBlockTimestamp(), deposits); } GenesisHandler(final RecentChainData recentChainData); @Override void onDepositsFromBlock(final DepositsFromBlockEvent event); @Override void onMinGenesisTimeBlock(MinGenesisTimeBlockEvent event);  }