Search in sources :

Example 1 with HeadUpdatedSubscriber

use of tech.pegasys.teku.pow.Eth1HeadTracker.HeadUpdatedSubscriber in project teku by ConsenSys.

the class Eth1DepositManagerTest method notifyHeadBlock.

private void notifyHeadBlock(final BigInteger blockNumber, final long timestamp) {
    final Block latestBlock = block(blockNumber, timestamp);
    when(eth1Provider.getGuaranteedEth1Block(UInt64.valueOf(blockNumber))).thenReturn(SafeFuture.completedFuture(latestBlock));
    final ArgumentCaptor<HeadUpdatedSubscriber> captor = ArgumentCaptor.forClass(HeadUpdatedSubscriber.class);
    verify(eth1HeadTracker, atLeastOnce()).subscribe(captor.capture());
    captor.getValue().onHeadUpdated(UInt64.valueOf(blockNumber));
}
Also used : Block(org.web3j.protocol.core.methods.response.EthBlock.Block) HeadUpdatedSubscriber(tech.pegasys.teku.pow.Eth1HeadTracker.HeadUpdatedSubscriber)

Example 2 with HeadUpdatedSubscriber

use of tech.pegasys.teku.pow.Eth1HeadTracker.HeadUpdatedSubscriber in project teku by ConsenSys.

the class DepositProcessingControllerTest method pushLatestCanonicalBlockWithNumber.

private void pushLatestCanonicalBlockWithNumber(long latestBlockNumber) {
    final ArgumentCaptor<HeadUpdatedSubscriber> captor = ArgumentCaptor.forClass(HeadUpdatedSubscriber.class);
    verify(headTracker).subscribe(captor.capture());
    final HeadUpdatedSubscriber subscriber = captor.getValue();
    subscriber.onHeadUpdated(UInt64.valueOf(latestBlockNumber));
}
Also used : HeadUpdatedSubscriber(tech.pegasys.teku.pow.Eth1HeadTracker.HeadUpdatedSubscriber)

Aggregations

HeadUpdatedSubscriber (tech.pegasys.teku.pow.Eth1HeadTracker.HeadUpdatedSubscriber)2 Block (org.web3j.protocol.core.methods.response.EthBlock.Block)1