lnwallet: mark channel as frozen based on ShimIntent

In this commit, we make the internal channel funding flow aware of
frozen channels. We also update the testSingleFunderReservationWorkflow
method to ensure that the created channels have the proper type bit set.
This commit is contained in:
Olaoluwa Osuntokun committed 2020-03-23 16:57:00 -07:00
1 parent 8bce48d3cc
commit c85f6bb364
3 files changed
+59 -25

No files matched your search

+9 -2
View File
@@ -171,7 +171,7 @@ func NewChannelReservation(capacity, localFundingAmt btcutil.Amount,
id uint64, pushMSat lnwire.MilliSatoshi, chainHash *chainhash.Hash,
flags lnwire.FundingFlag, commitType CommitmentType,
fundingAssembler chanfunding.Assembler,
pendingChanID [32]byte) (*ChannelReservation, error) {
pendingChanID [32]byte, thawHeight uint32) (*ChannelReservation, error) {
var (
ourBalance lnwire.MilliSatoshi
@@ -306,6 +306,12 @@ func NewChannelReservation(capacity, localFundingAmt btcutil.Amount,
chanType |= channeldb.AnchorOutputsBit
}
// If the channel is meant to be frozen, then we'll set the frozen bit
// now so once the channel is open, it can be interpreted properly.
if thawHeight != 0 {
chanType |= channeldb.FrozenBit
}
return &ChannelReservation{
ourContribution: &ChannelContribution{
FundingAmount: ourBalance.ToSatoshis(),
@@ -334,7 +340,8 @@ func NewChannelReservation(capacity, localFundingAmt btcutil.Amount,
FeePerKw: btcutil.Amount(commitFeePerKw),
CommitFee: commitFee,
},
Db: wallet.Cfg.Database,
ThawHeight: thawHeight,
Db: wallet.Cfg.Database,
},
pushMSat: pushMSat,
pendingChanID: pendingChanID,