multi: convert the existing channeldb.ChannelType uint8 into a bit field

In this commit, we convert the existing `channeldb.ChannelType` type
into a _bit field_. This doesn't require us to change the current
serialization or interpretation or the type as it is, since all the
current defined values us a distinct bit. This PR lays the ground work
for any future changes that may introduce new channel types (like anchor
outputs), and also any changes that may modify the existing invariants
around channels (if we're the initiator, we always have the funding
transaction).
This commit is contained in:
Olaoluwa Osuntokun
2019-10-30 19:24:49 -07:00
parent fcf81ed8ff
commit a73ee28e46
14 changed files with 42 additions and 39 deletions

View File

@ -274,7 +274,7 @@ func CreateTestChannels(tweaklessCommits bool) (
IdentityPub: aliceKeys[0].PubKey(),
FundingOutpoint: *prevOut,
ShortChannelID: shortChanID,
ChanType: channeldb.SingleFunderTweakless,
ChanType: channeldb.SingleFunderTweaklessBit,
IsInitiator: true,
Capacity: channelCapacity,
RemoteCurrentRevocation: bobCommitPoint,
@ -292,7 +292,7 @@ func CreateTestChannels(tweaklessCommits bool) (
IdentityPub: bobKeys[0].PubKey(),
FundingOutpoint: *prevOut,
ShortChannelID: shortChanID,
ChanType: channeldb.SingleFunderTweakless,
ChanType: channeldb.SingleFunderTweaklessBit,
IsInitiator: false,
Capacity: channelCapacity,
RemoteCurrentRevocation: aliceCommitPoint,
@ -305,8 +305,8 @@ func CreateTestChannels(tweaklessCommits bool) (
}
if !tweaklessCommits {
aliceChannelState.ChanType = channeldb.SingleFunder
bobChannelState.ChanType = channeldb.SingleFunder
aliceChannelState.ChanType = channeldb.SingleFunderBit
bobChannelState.ChanType = channeldb.SingleFunderBit
}
aliceSigner := &input.MockSigner{Privkeys: aliceKeys}