lnwire+rpcserver: populate feature bits on decodepayreq
This commit is contained in:
3 files changed
+94
No files matched your search
@@ -94,6 +94,11 @@ const (
|
||||
maxAllowedSize = 32764
|
||||
)
|
||||
|
||||
// IsRequired returns true if the feature bit is even, and false otherwise.
|
||||
func (b FeatureBit) IsRequired() bool {
|
||||
return b&0x01 == 0x00
|
||||
}
|
||||
|
||||
// Features is a mapping of known feature bits to a descriptive name. All known
|
||||
// feature bits must be assigned a name in this mapping, and feature bit pairs
|
||||
// must be assigned together for correct behavior.
|
||||
@@ -383,6 +388,15 @@ func (fv *FeatureVector) isFeatureBitPair(bit FeatureBit) bool {
|
||||
return known1 && known2 && name1 == name2
|
||||
}
|
||||
|
||||
// Features returns the set of raw features contained in the feature vector.
|
||||
func (fv *FeatureVector) Features() map[FeatureBit]struct{} {
|
||||
fs := make(map[FeatureBit]struct{}, len(fv.RawFeatureVector.features))
|
||||
for b := range fv.RawFeatureVector.features {
|
||||
fs[b] = struct{}{}
|
||||
}
|
||||
return fs
|
||||
}
|
||||
|
||||
// Clone copies a feature vector, carrying over its feature bits. The feature
|
||||
// names are not copied.
|
||||
func (fv *FeatureVector) Clone() *FeatureVector {
|
||||
|
||||
Reference in new issue
Block a user