diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeer.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeer.java index a21306e4e6..1669528a45 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeer.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeer.java @@ -14,6 +14,7 @@ import static com.google.common.base.Preconditions.checkArgument; +import tech.pegasys.pantheon.ethereum.core.Block; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.eth.manager.ChainState.EstimatedHeightListener; import tech.pegasys.pantheon.ethereum.eth.manager.RequestManager.ResponseStream; @@ -23,6 +24,7 @@ import tech.pegasys.pantheon.ethereum.eth.messages.GetBlockHeadersMessage; import tech.pegasys.pantheon.ethereum.eth.messages.GetNodeDataMessage; import tech.pegasys.pantheon.ethereum.eth.messages.GetReceiptsMessage; +import tech.pegasys.pantheon.ethereum.eth.messages.NewBlockMessage; import tech.pegasys.pantheon.ethereum.p2p.api.MessageData; import tech.pegasys.pantheon.ethereum.p2p.api.PeerConnection; import tech.pegasys.pantheon.ethereum.p2p.api.PeerConnection.PeerNotConnected; @@ -130,6 +132,14 @@ public ResponseStream send(final MessageData messageData) throws PeerNotConnecte } } + public void propagateBlock(final Block block, final UInt256 totalDifficulty) { + final NewBlockMessage newBlockMessage = NewBlockMessage.create(block, totalDifficulty); + try { + connection.sendForProtocol(protocolName, newBlockMessage); + } catch (Exception ignored) { + } + } + public ResponseStream getHeadersByHash( final Hash hash, final int maxHeaders, final int skip, final boolean reverse) throws PeerNotConnected {