From 04425ce50ebac97a6b1c6f32b9eab1c13e2c5379 Mon Sep 17 00:00:00 2001 From: "S. Matthew English" Date: Thu, 14 Feb 2019 00:22:42 -0500 Subject: [PATCH] initial commit --- .../pegasys/pantheon/ethereum/eth/manager/EthPeer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 {