Merge pull request #943 from lightning-signer/2021-06-signet
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Tue, 8 Jun 2021 01:52:38 +0000 (01:52 +0000)
committerGitHub <noreply@github.com>
Tue, 8 Jun 2021 01:52:38 +0000 (01:52 +0000)
Add proper signet support for invoices

lightning/src/chain/mod.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs

index e4bb66c7e755905058fa7b0f44520046773b5601..8f27e40baeaf1e3b5d43dade8a05da0bb08dfdcb 100644 (file)
@@ -239,6 +239,7 @@ pub trait Filter {
 ///
 /// [`ChannelMonitor`]: channelmonitor::ChannelMonitor
 /// [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
+#[derive(Clone, PartialEq, Hash)]
 pub struct WatchedOutput {
        /// First block where the transaction output may have been spent.
        pub block_hash: Option<BlockHash>,
index 07293a102ea2ea7df99b9a1514c875b4cd98976f..f8c8c15be95ad660f2803125092a6bcac288f8ee 100644 (file)
@@ -1428,9 +1428,6 @@ impl<Signer: Sign> Channel<Signer> {
                if msg.channel_reserve_satoshis > self.channel_value_satoshis {
                        return Err(ChannelError::Close(format!("Bogus channel_reserve_satoshis ({}). Must not be greater than ({})", msg.channel_reserve_satoshis, self.channel_value_satoshis)));
                }
-               if msg.dust_limit_satoshis > msg.channel_reserve_satoshis {
-                       return Err(ChannelError::Close(format!("Bogus channel_reserve ({}) and dust_limit ({})", msg.channel_reserve_satoshis, msg.dust_limit_satoshis)));
-               }
                if msg.channel_reserve_satoshis < self.holder_dust_limit_satoshis {
                        return Err(ChannelError::Close(format!("Peer never wants payout outputs? channel_reserve_satoshis was ({}). dust_limit is ({})", msg.channel_reserve_satoshis, self.holder_dust_limit_satoshis)));
                }
index c3fe8090ae483b9bf23bed19284ef3593a60f8c8..13a993fd965596dc41e12a387bc178ea31372b35 100644 (file)
@@ -498,6 +498,7 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
 /// Typically, the block-specific parameters are derived from the best block hash for the network,
 /// as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
 /// are not needed when deserializing a previously constructed `ChannelManager`.
+#[derive(Clone, Copy, PartialEq)]
 pub struct ChainParameters {
        /// The network for determining the `chain_hash` in Lightning messages.
        pub network: Network,
@@ -509,7 +510,7 @@ pub struct ChainParameters {
 }
 
 /// The best known block as identified by its hash and height.
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, PartialEq)]
 pub struct BestBlock {
        block_hash: BlockHash,
        height: u32,