Refactor ChannelState to decouple state flags from states
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Tue, 24 Oct 2023 23:54:20 +0000 (16:54 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Tue, 5 Dec 2023 23:05:05 +0000 (15:05 -0800)
commit9092c591f110944e26bba1e8be452bb7a4339960
treed46ae20560ee658b80aa54849727ce6fd68e4a57
parent99429940122372145e2652a0f42f28fb0e88b5f5
Refactor ChannelState to decouple state flags from states

Previously, our `ChannelState` contained bits for both states and flags.
To make matters worse, some of the flags could apply to multiple states.
This led to its API being very cumbersome, having to apply masks in most
scenarios to check for certain states. As LDK grows and more features
are added requiring more states/flags, the need for a simpler API
arises.

This refactor aims to improve this by decoupling the state flags from
the `ChannelState` enum. Each state that requires flags will now have
its own flags type, to ensure flags can only be applied to their
intended state. All of this is done while maintaining backwards and
forwards compatibility.
lightning/src/ln/channel.rs