From 2470812077dfa09b77c7ff881208a9dcb6174d7a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 1 Aug 2018 16:13:04 -0400 Subject: [PATCH] Fix types in Channel::funding_tx_confirmed_in This should have no effect in a real system but was causing the full_stack_target fuzz test to fail due to a block with a null hash being disconnected. --- src/ln/channel.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ln/channel.rs b/src/ln/channel.rs index 614c13b44..43f913eb2 100644 --- a/src/ln/channel.rs +++ b/src/ln/channel.rs @@ -271,7 +271,7 @@ pub struct Channel { /// to detect unconfirmation after a serialize-unserialize roudtrip where we may not see a full /// series of block_connected/block_disconnected calls. Obviously this is not a guarantee as we /// could miss the funding_tx_confirmed_in block as well, but it serves as a useful fallback. - funding_tx_confirmed_in: Sha256dHash, + funding_tx_confirmed_in: Option, short_channel_id: Option, /// Used to deduplicate block_connected callbacks last_block_connected: Sha256dHash, @@ -401,7 +401,7 @@ impl Channel { last_sent_closing_fee: None, - funding_tx_confirmed_in: Default::default(), + funding_tx_confirmed_in: None, short_channel_id: None, last_block_connected: Default::default(), funding_tx_confirmations: 0, @@ -519,7 +519,7 @@ impl Channel { last_sent_closing_fee: None, - funding_tx_confirmed_in: Default::default(), + funding_tx_confirmed_in: None, short_channel_id: None, last_block_connected: Default::default(), funding_tx_confirmations: 0, @@ -1942,7 +1942,7 @@ impl Channel { } else if self.channel_state < ChannelState::ChannelFunded as u32 { panic!("Started confirming a channel in a state pre-FundingSent?"); } - self.funding_tx_confirmed_in = header.bitcoin_hash(); + self.funding_tx_confirmed_in = Some(header.bitcoin_hash()); //TODO: Note that this must be a duplicate of the previous commitment point they sent us, //as otherwise we will have a commitment transaction that they can't revoke (well, kinda, @@ -1988,7 +1988,7 @@ impl Channel { return true; } } - if header.bitcoin_hash() == self.funding_tx_confirmed_in { + if Some(header.bitcoin_hash()) == self.funding_tx_confirmed_in { self.funding_tx_confirmations = CONF_TARGET as u64 - 1; } false -- 2.39.5