mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 23:53:41 +02:00
channeldb: BigSize migration, store zero-conf, scid-alias bits
This introduces a BigSize migration that is used to expand the width of the ChannelStatus and ChannelType fields. Three channel "types" are added - ZeroConfBit, ScidAliasChanBit, and ScidAliasFeatureBit. ScidAliasChanBit denotes that the scid-alias channel type was negotiated for the channel. ScidAliasFeatureBit denotes that the scid-alias feature bit was negotiated during the *lifetime* of the channel. Several helper functions on the OpenChannel struct are exposed to aid callers from different packages. The RefreshShortChanID has been renamed to Refresh. A new function BroadcastHeight is used to guard access to the mutable FundingBroadcastHeight member. This prevents data races.
This commit is contained in:
@@ -243,7 +243,7 @@ func (c *chanDBRestorer) RestoreChansFromSingles(backups ...chanbackup.Single) e
|
||||
// funding broadcast height to a reasonable value that we
|
||||
// determined earlier.
|
||||
case channel.ShortChanID().BlockHeight == 0:
|
||||
channel.FundingBroadcastHeight = firstChanHeight
|
||||
channel.SetBroadcastHeight(firstChanHeight)
|
||||
|
||||
// Fallback case 2: It is extremely unlikely at this point that
|
||||
// a channel we are trying to restore has a coinbase funding TX.
|
||||
@@ -255,7 +255,7 @@ func (c *chanDBRestorer) RestoreChansFromSingles(backups ...chanbackup.Single) e
|
||||
// unconfirmed one here.
|
||||
case channel.ShortChannelID.TxIndex == 0:
|
||||
broadcastHeight := channel.ShortChannelID.BlockHeight
|
||||
channel.FundingBroadcastHeight = broadcastHeight
|
||||
channel.SetBroadcastHeight(broadcastHeight)
|
||||
channel.ShortChannelID.BlockHeight = 0
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user