Skip to content

Commit fb140b5

Browse files
authored
Merge pull request #2328 from benthecarman/partial-eq-in-mem-signer
Impl PartialEq and Debug for InMemorySigner
2 parents 32eb894 + a8a7fc1 commit fb140b5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lightning/src/sign/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ pub trait SignerProvider {
689689
///
690690
/// This implementation performs no policy checks and is insufficient by itself as
691691
/// a secure external signer.
692+
#[derive(Debug)]
692693
pub struct InMemorySigner {
693694
/// Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
694695
/// holder's anchor output in a commitment transaction, if one is present.
@@ -718,6 +719,21 @@ pub struct InMemorySigner {
718719
rand_bytes_index: AtomicCounter,
719720
}
720721

722+
impl PartialEq for InMemorySigner {
723+
fn eq(&self, other: &Self) -> bool {
724+
self.funding_key == other.funding_key &&
725+
self.revocation_base_key == other.revocation_base_key &&
726+
self.payment_key == other.payment_key &&
727+
self.delayed_payment_base_key == other.delayed_payment_base_key &&
728+
self.htlc_base_key == other.htlc_base_key &&
729+
self.commitment_seed == other.commitment_seed &&
730+
self.holder_channel_pubkeys == other.holder_channel_pubkeys &&
731+
self.channel_parameters == other.channel_parameters &&
732+
self.channel_value_satoshis == other.channel_value_satoshis &&
733+
self.channel_keys_id == other.channel_keys_id
734+
}
735+
}
736+
721737
impl Clone for InMemorySigner {
722738
fn clone(&self) -> Self {
723739
Self {

lightning/src/util/atomic_counter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ compile_error!("We need at least 32-bit pointers for atomic counter (and to have
55

66
use core::sync::atomic::{AtomicUsize, Ordering};
77

8+
#[derive(Debug)]
89
pub(crate) struct AtomicCounter {
910
// Usize needs to be at least 32 bits to avoid overflowing both low and high. If usize is 64
1011
// bits we will never realistically count into high:

0 commit comments

Comments
 (0)