@@ -713,6 +713,7 @@ pub struct ChannelMonitor<Signer: WriteableEcdsaChannelSigner> {
713
713
inner : Mutex < ChannelMonitorImpl < Signer > > ,
714
714
}
715
715
716
+ #[ derive( PartialEq ) ]
716
717
pub ( crate ) struct ChannelMonitorImpl < Signer : WriteableEcdsaChannelSigner > {
717
718
latest_update_id : u64 ,
718
719
commitment_transaction_number_obscure_factor : u64 ,
@@ -854,64 +855,14 @@ pub(crate) struct ChannelMonitorImpl<Signer: WriteableEcdsaChannelSigner> {
854
855
/// Transaction outputs to watch for on-chain spends.
855
856
pub type TransactionOutputs = ( Txid , Vec < ( u32 , TxOut ) > ) ;
856
857
857
- #[ cfg( any( test, fuzzing, feature = "_test_utils" ) ) ]
858
- /// Used only in testing and fuzzing to check serialization roundtrips don't change the underlying
859
- /// object
860
- impl < Signer : WriteableEcdsaChannelSigner > PartialEq for ChannelMonitor < Signer > {
858
+ impl < Signer : WriteableEcdsaChannelSigner > PartialEq for ChannelMonitor < Signer > where Signer : PartialEq {
861
859
fn eq ( & self , other : & Self ) -> bool {
862
860
let inner = self . inner . lock ( ) . unwrap ( ) ;
863
861
let other = other. inner . lock ( ) . unwrap ( ) ;
864
862
inner. eq ( & other)
865
863
}
866
864
}
867
865
868
- #[ cfg( any( test, fuzzing, feature = "_test_utils" ) ) ]
869
- /// Used only in testing and fuzzing to check serialization roundtrips don't change the underlying
870
- /// object
871
- impl < Signer : WriteableEcdsaChannelSigner > PartialEq for ChannelMonitorImpl < Signer > {
872
- fn eq ( & self , other : & Self ) -> bool {
873
- if self . latest_update_id != other. latest_update_id ||
874
- self . commitment_transaction_number_obscure_factor != other. commitment_transaction_number_obscure_factor ||
875
- self . destination_script != other. destination_script ||
876
- self . broadcasted_holder_revokable_script != other. broadcasted_holder_revokable_script ||
877
- self . counterparty_payment_script != other. counterparty_payment_script ||
878
- self . channel_keys_id != other. channel_keys_id ||
879
- self . holder_revocation_basepoint != other. holder_revocation_basepoint ||
880
- self . funding_info != other. funding_info ||
881
- self . current_counterparty_commitment_txid != other. current_counterparty_commitment_txid ||
882
- self . prev_counterparty_commitment_txid != other. prev_counterparty_commitment_txid ||
883
- self . counterparty_commitment_params != other. counterparty_commitment_params ||
884
- self . funding_redeemscript != other. funding_redeemscript ||
885
- self . channel_value_satoshis != other. channel_value_satoshis ||
886
- self . their_cur_per_commitment_points != other. their_cur_per_commitment_points ||
887
- self . on_holder_tx_csv != other. on_holder_tx_csv ||
888
- self . commitment_secrets != other. commitment_secrets ||
889
- self . counterparty_claimable_outpoints != other. counterparty_claimable_outpoints ||
890
- self . counterparty_commitment_txn_on_chain != other. counterparty_commitment_txn_on_chain ||
891
- self . counterparty_hash_commitment_number != other. counterparty_hash_commitment_number ||
892
- self . prev_holder_signed_commitment_tx != other. prev_holder_signed_commitment_tx ||
893
- self . current_counterparty_commitment_number != other. current_counterparty_commitment_number ||
894
- self . current_holder_commitment_number != other. current_holder_commitment_number ||
895
- self . current_holder_commitment_tx != other. current_holder_commitment_tx ||
896
- self . payment_preimages != other. payment_preimages ||
897
- self . pending_monitor_events != other. pending_monitor_events ||
898
- self . pending_events . len ( ) != other. pending_events . len ( ) || // We trust events to round-trip properly
899
- self . onchain_events_awaiting_threshold_conf != other. onchain_events_awaiting_threshold_conf ||
900
- self . outputs_to_watch != other. outputs_to_watch ||
901
- self . lockdown_from_offchain != other. lockdown_from_offchain ||
902
- self . holder_tx_signed != other. holder_tx_signed ||
903
- self . funding_spend_seen != other. funding_spend_seen ||
904
- self . funding_spend_confirmed != other. funding_spend_confirmed ||
905
- self . confirmed_commitment_tx_counterparty_output != other. confirmed_commitment_tx_counterparty_output ||
906
- self . htlcs_resolved_on_chain != other. htlcs_resolved_on_chain
907
- {
908
- false
909
- } else {
910
- true
911
- }
912
- }
913
- }
914
-
915
866
impl < Signer : WriteableEcdsaChannelSigner > Writeable for ChannelMonitor < Signer > {
916
867
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , Error > {
917
868
self . inner . lock ( ) . unwrap ( ) . write ( writer)
0 commit comments