channeldb: don't use iota for the ChannelType enum

This commit modifies the ChannelType enum to no longer use iota as
changes in the definition would cause the values to shift, breaking the
long-term stability required for persistence. Instead, we now select
values manually to indicate the particular channel type.
This commit is contained in:
Olaoluwa Osuntokun 2016-11-16 11:45:10 -08:00
parent 08a852bf90
commit 3e4981d15f
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -103,14 +103,17 @@ var (
type ChannelType uint8 type ChannelType uint8
const ( const (
// NOTE: iota isn't used here for this enum needs to be stable
// long-term as it will be persisted to the database.
// SingleFunder represents a channel wherein one party solely funds the // SingleFunder represents a channel wherein one party solely funds the
// entire capacity of the channel. // entire capacity of the channel.
SingleFunder = iota SingleFunder = 0
// DualFunder represents a channel wherein both parties contribute // DualFunder represents a channel wherein both parties contribute
// funds towards the total capacity of the channel. The channel may be // funds towards the total capacity of the channel. The channel may be
// funded symmetrically or asymmetrically. // funded symmetrically or asymmetrically.
DualFunder DualFunder = 1
) )
// OpenChannel encapsulates the persistent and dynamic state of an open channel // OpenChannel encapsulates the persistent and dynamic state of an open channel