From 046bda321ba6b22c0844b9b1052ae81cb62c671c Mon Sep 17 00:00:00 2001 From: Harshil Jani Date: Tue, 28 Mar 2023 12:20:11 +0530 Subject: [PATCH] comparing NetworkUncheck addresses Signed-off-by: Harshil Jani implementation of PartialEq
for Address Signed-off-by: Harshil Jani --- bitcoin/src/address.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bitcoin/src/address.rs b/bitcoin/src/address.rs index beca6b11..7cdfec15 100644 --- a/bitcoin/src/address.rs +++ b/bitcoin/src/address.rs @@ -1057,6 +1057,17 @@ impl Address { pub fn assume_checked(self) -> Address { Address::new(self.network, self.payload) } } +// For NetworkUnchecked , it compare Addresses and if network and payload matches then return true. +impl PartialEq> for Address { + fn eq(&self, other: &Address) -> bool { + self.network == other.network && self.payload == other.payload + } +} + +impl PartialEq
for Address { + fn eq(&self, other: &Address) -> bool { other == self } +} + impl From
for script::ScriptBuf { fn from(a: Address) -> Self { a.script_pubkey() } }