From 3e4981d15f1bc759db938790df6e8b10980cd2c9 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 16 Nov 2016 11:45:10 -0800 Subject: [PATCH] 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. --- channeldb/channel.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/channeldb/channel.go b/channeldb/channel.go index 2d637704..3639b996 100644 --- a/channeldb/channel.go +++ b/channeldb/channel.go @@ -103,14 +103,17 @@ var ( type ChannelType uint8 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 // entire capacity of the channel. - SingleFunder = iota + SingleFunder = 0 // DualFunder represents a channel wherein both parties contribute // funds towards the total capacity of the channel. The channel may be // funded symmetrically or asymmetrically. - DualFunder + DualFunder = 1 ) // OpenChannel encapsulates the persistent and dynamic state of an open channel