channeldb: add new frozen channel type bit and thaw height

In this commit, we add a new channel type bit: a frozen channel. A
frozen channel is one that can only be cooperatively closed by the
responder, but not the initiator. This channel type is useful for
certain classes of channel factory like protocols. We then add a new key
on the channel bucket level to store the height after which this
restriction no longer applies.
This commit is contained in:
Olaoluwa Osuntokun committed 2020-03-23 16:56:48 -07:00
1 parent 8fd5d13c75
commit 421d73b72e
2 files changed
+82 -1

No files matched your search

+2 -1
View File
@@ -349,7 +349,7 @@ func createTestChannelState(t *testing.T, cdb *DB) *OpenChannel {
chanID := lnwire.NewShortChanIDFromInt(uint64(rand.Int63()))
return &OpenChannel{
ChanType: SingleFunderBit,
ChanType: SingleFunderBit | FrozenBit,
ChainHash: key,
FundingOutpoint: wire.OutPoint{Hash: key, Index: rand.Uint32()},
ShortChannelID: chanID,
@@ -387,6 +387,7 @@ func createTestChannelState(t *testing.T, cdb *DB) *OpenChannel {
Db: cdb,
Packager: NewChannelPackager(chanID),
FundingTxn: testTx,
ThawHeight: uint32(defaultPendingHeight),
}
}