Skip to content

Commit

Permalink
Clean p2p plugin (#2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon authored Jan 12, 2021
1 parent 8b1509f commit a3d97bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/neo/Ledger/Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,9 @@ private void OnInventory(IInventory inventory, bool relay = true)
Transaction transaction => OnNewTransaction(transaction),
_ => OnNewInventory(inventory)
};
if (result == VerifyResult.Succeed)
if (result == VerifyResult.Succeed && relay)
{
if (relay) system.LocalNode.Tell(new LocalNode.RelayDirectly { Inventory = inventory });
foreach (IP2PPlugin plugin in Plugin.P2PPlugins)
plugin.OnVerifiedInventory(inventory);
system.LocalNode.Tell(new LocalNode.RelayDirectly { Inventory = inventory });
}
SendRelayResult(inventory, result);
}
Expand Down
2 changes: 0 additions & 2 deletions src/neo/Plugins/IP2PPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Neo.Network.P2P;
using Neo.Network.P2P.Payloads;

namespace Neo.Plugins
{
public interface IP2PPlugin
{
bool OnP2PMessage(Message message) => true;
void OnVerifiedInventory(IInventory inventory) { }
}
}

0 comments on commit a3d97bc

Please sign in to comment.