Search in sources :

Example 6 with HeadEvent

use of tech.pegasys.teku.api.response.v1.HeadEvent in project teku by ConsenSys.

the class EventSourceHandlerTest method onMessage_shouldHandleInvalidMessage.

@Test
void onMessage_shouldHandleInvalidMessage() throws Exception {
    final UInt64 slot = UInt64.valueOf(134);
    final HeadEvent event = new HeadEvent(slot, dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes32(), false, false, dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes32());
    // Head message with a reorg type
    final MessageEvent messageEvent = new MessageEvent(jsonProvider.objectToJSON(event));
    assertDoesNotThrow(() -> handler.onMessage(EventType.chain_reorg.name(), messageEvent));
    verifyNoInteractions(validatorTimingChannel);
}
Also used : HeadEvent(tech.pegasys.teku.api.response.v1.HeadEvent) MessageEvent(com.launchdarkly.eventsource.MessageEvent) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) Test(org.junit.jupiter.api.Test)

Aggregations

HeadEvent (tech.pegasys.teku.api.response.v1.HeadEvent)6 Test (org.junit.jupiter.api.Test)4 MessageEvent (com.launchdarkly.eventsource.MessageEvent)3 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)3 Bytes32 (org.apache.tuweni.bytes.Bytes32)2 ChainReorgEvent (tech.pegasys.teku.api.response.v1.ChainReorgEvent)1