From cfa8941cc59fc164bf95d7a698927dce0bcc4607 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Tue, 14 Feb 2023 15:35:40 -0800 Subject: [PATCH] Implement PartialEq manually Since we don't store `pending_claim_events` within `OnchainTxHandler` as they'll be regenerated on restarts, we opt to implement `PartialEq` manually such that the field is not longer considered. --- lightning/src/chain/onchaintx.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index d3ca02ca7..719d8314c 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -215,7 +215,6 @@ type PackageID = [u8; 32]; /// OnchainTxHandler receives claiming requests, aggregates them if it's sound, broadcast and /// do RBF bumping if possible. -#[derive(PartialEq)] pub struct OnchainTxHandler { destination_script: Script, holder_commitment: HolderCommitmentTransaction, @@ -265,6 +264,22 @@ pub struct OnchainTxHandler { pub(super) secp_ctx: Secp256k1, } +impl PartialEq for OnchainTxHandler { + fn eq(&self, other: &Self) -> bool { + // `signer`, `secp_ctx`, and `pending_claim_events` are excluded on purpose. + self.destination_script == other.destination_script && + self.holder_commitment == other.holder_commitment && + self.holder_htlc_sigs == other.holder_htlc_sigs && + self.prev_holder_commitment == other.prev_holder_commitment && + self.prev_holder_htlc_sigs == other.prev_holder_htlc_sigs && + self.channel_transaction_parameters == other.channel_transaction_parameters && + self.pending_claim_requests == other.pending_claim_requests && + self.claimable_outpoints == other.claimable_outpoints && + self.locktimed_packages == other.locktimed_packages && + self.onchain_events_awaiting_threshold_conf == other.onchain_events_awaiting_threshold_conf + } +} + const SERIALIZATION_VERSION: u8 = 1; const MIN_SERIALIZATION_VERSION: u8 = 1; -- 2.39.5