File tree 1 file changed +12
-1
lines changed 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -478,6 +478,9 @@ pub(crate) const MIN_AFFORDABLE_HTLC_COUNT: usize = 4;
478
478
/// * `EXPIRE_PREV_CONFIG_TICKS` = convergence_delay / tick_interval
479
479
pub ( crate ) const EXPIRE_PREV_CONFIG_TICKS : usize = 5 ;
480
480
481
+ /// Number of blocks needed for an output from a coinbase transaction to be spendable.
482
+ pub ( crate ) const COINBASE_MATURITY : u32 = 100 ;
483
+
481
484
// TODO: We should refactor this to be an Inbound/OutboundChannel until initial setup handshaking
482
485
// has been completed, and then turn into a Channel to get compiler-time enforcement of things like
483
486
// calling channel_id() before we're set up or things like get_outbound_funding_signed on an
@@ -5373,7 +5376,15 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5373
5376
5374
5377
self . channel_state = ChannelState :: FundingCreated as u32 ;
5375
5378
self . channel_id = funding_txo. to_channel_id ( ) ;
5376
- self . funding_transaction = Some ( funding_transaction) ;
5379
+ self . funding_transaction = Some ( funding_transaction. clone ( ) ) ;
5380
+
5381
+ // If the funding transaction is a coinbase transaction, we need to set the minimum depth to 100
5382
+ // We can skip this if it is a zero-conf channel.
5383
+ if funding_transaction. is_coin_base ( ) &&
5384
+ self . minimum_depth . unwrap_or ( 0 ) > 0 &&
5385
+ self . minimum_depth . unwrap_or ( 0 ) < COINBASE_MATURITY {
5386
+ self . minimum_depth = Some ( COINBASE_MATURITY ) ;
5387
+ }
5377
5388
5378
5389
Ok ( msgs:: FundingCreated {
5379
5390
temporary_channel_id,
You can’t perform that action at this time.
0 commit comments