@Test public void onDepositsFromBlock_missingDeposit() { final DepositsFromBlockEvent event1 = dataStructureUtil.randomDepositsFromBlockEvent(1, 0, 10); final DepositsFromBlockEvent event3 = dataStructureUtil.randomDepositsFromBlockEvent(3, 11, 15); publisher.onDepositsFromBlock(event1); assertThatThrownBy(() -> publisher.onDepositsFromBlock(event3)) .isInstanceOf(InvalidDepositEventsException.class) .hasMessageContaining("Expected next deposit at index 10, but got 11"); }
@Override public synchronized void onDepositsFromBlock(final DepositsFromBlockEvent event) { LOG.trace( "Process deposits {} - {}", event.getFirstDepositIndex(), event.getLastDepositIndex()); assertDepositEventIsValid(event); lastPublishedDeposit = Optional.of(event.getLastDepositIndex()); delegate.onDepositsFromBlock(event); }
ValidatingEth1EventsPublisher extends DelegatingEth1EventsChannel { @Override public synchronized void onDepositsFromBlock(final DepositsFromBlockEvent event) { LOG.trace( "Process deposits {} - {}", event.getFirstDepositIndex(), event.getLastDepositIndex()); assertDepositEventIsValid(event); lastPublishedDeposit = Optional.of(event.getLastDepositIndex()); delegate.onDepositsFromBlock(event); } }
ValidatingEth1EventsPublisher extends DelegatingEth1EventsChannel { @Override public synchronized void onDepositsFromBlock(final DepositsFromBlockEvent event) { LOG.trace( "Process deposits {} - {}", event.getFirstDepositIndex(), event.getLastDepositIndex()); assertDepositEventIsValid(event); lastPublishedDeposit = Optional.of(event.getLastDepositIndex()); delegate.onDepositsFromBlock(event); } ValidatingEth1EventsPublisher(final Eth1EventsChannel delegate); }
ValidatingEth1EventsPublisher extends DelegatingEth1EventsChannel { @Override public synchronized void onDepositsFromBlock(final DepositsFromBlockEvent event) { LOG.trace( "Process deposits {} - {}", event.getFirstDepositIndex(), event.getLastDepositIndex()); assertDepositEventIsValid(event); lastPublishedDeposit = Optional.of(event.getLastDepositIndex()); delegate.onDepositsFromBlock(event); } ValidatingEth1EventsPublisher(final Eth1EventsChannel delegate); synchronized void setLatestPublishedDeposit(final UInt64 latestPublishedDeposit); @Override synchronized void onDepositsFromBlock(final DepositsFromBlockEvent event); }
ValidatingEth1EventsPublisher extends DelegatingEth1EventsChannel { @Override public synchronized void onDepositsFromBlock(final DepositsFromBlockEvent event) { LOG.trace( "Process deposits {} - {}", event.getFirstDepositIndex(), event.getLastDepositIndex()); assertDepositEventIsValid(event); lastPublishedDeposit = Optional.of(event.getLastDepositIndex()); delegate.onDepositsFromBlock(event); } ValidatingEth1EventsPublisher(final Eth1EventsChannel delegate); synchronized void setLatestPublishedDeposit(final UInt64 latestPublishedDeposit); @Override synchronized void onDepositsFromBlock(final DepositsFromBlockEvent event);  }