Remove duplicate specification of features
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 16 Apr 2020 00:16:45 +0000 (17:16 -0700)
committerJeffrey Czyz <jkczyz@gmail.com>
Wed, 29 Apr 2020 18:09:23 +0000 (11:09 -0700)
commit9dd2be15e90d9fa7369e7f9757cabce81c293602
tree33c5d81891072cfcec041cbae3f3950f567e9d17
parent77b467c845792945a0caf19790e4aff883969258
Remove duplicate specification of features

Features for a given context are duplicated throughout the features
module. Use a macro for defining a Context and the applicable features
such that features only need to be defined for a Context in one place.
The Context provides bitmasks for selecting known and unknown feature
flags.

BOLT 1 and BOLT 9 refer to features as "known" if a peer understands
them. They also use the term "supported" to mean either optional or
required.

Update the features module to use similar terminology.
- Define contexts in terms of required and optional features rather than
  just supported features
- Define known features as those that are optional or required
- Rename supported() constructor to known()

For completeness, clear_optional_bit for each feature is now called
clear_bits and clears both optional and required bits.
fuzz/src/chanmon_consistency.rs
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/features.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/msgs.rs
lightning/src/ln/peer_handler.rs
lightning/src/ln/reorg_tests.rs
lightning/src/ln/router.rs