diff --git a/zebra-network/src/protocol/external/inv.rs b/zebra-network/src/protocol/external/inv.rs index f3c6aeac..f22389ba 100644 --- a/zebra-network/src/protocol/external/inv.rs +++ b/zebra-network/src/protocol/external/inv.rs @@ -40,6 +40,20 @@ pub enum InventoryHash { FilteredBlock(BlockHeaderHash), } +impl From for InventoryHash { + fn from(tx: TransactionHash) -> InventoryHash { + InventoryHash::Tx(tx) + } +} + +impl From for InventoryHash { + fn from(block: BlockHeaderHash) -> InventoryHash { + // Auto-convert to Block rather than FilteredBlock because filtered + // blocks aren't useful for Zcash. + InventoryHash::Block(block) + } +} + impl ZcashSerialize for InventoryHash { fn zcash_serialize(&self, mut writer: W) -> Result<(), SerializationError> { let (code, bytes) = match *self {