clboss/Ln/FeatureBit.hpp
Ken Sedgwick f1b37c5da5
ChannelCreator: prefer spliceable peers within the no-record tier
The track-record pass orders open proposals keepers, no-record,
underperformers.  The no-record tier carries no earnings evidence,
so order it by a capability prior: nodes whose node_announcement
advertises splicing (BOLT 9 option_splice, bits 62/63) come first,
since their channels can later be resized without a close and
reopen.  Keepers and underperformers keep their earnings-based
order, and nothing moves across a tier boundary.

New Ln::feature_bit tests a bit in a BOLT 9 hex bitfield (bit 0 is
the least-significant bit of the last byte), with a unit test.
Spliceability is looked up per candidate via listnodes; an RPC
failure or absent features field counts as not spliceable, so the
lookup cannot block channel creation.  The Track records report
marks spliceable no-record nodes with an (S) suffix.
2026-08-04 11:02:22 -07:00

21 lines
493 B
C++

#ifndef LN_FEATUREBIT_HPP
#define LN_FEATUREBIT_HPP
#include<string>
namespace Ln {
/** Ln::feature_bit
*
* @brief determine whether the given feature bit is set in a
* hex-encoded feature bitfield (BOLT #9 encoding: bit 0 is the
* least-significant bit of the last byte).
*
* @desc returns false for malformed hex, or for bitfields too
* short to contain the bit.
*/
bool feature_bit(std::string const& features_hex, unsigned int bit);
}
#endif /* !defined(LN_FEATUREBIT_HPP) */