multi: remove LocalFeatures and GlobalFeatures
This commit is contained in:
parent
16318c5a41
commit
5e27b5022c
@ -157,8 +157,9 @@ func (d *databaseChannelGraph) addRandChannel(node1, node2 *btcec.PublicKey,
|
|||||||
IP: bytes.Repeat([]byte("a"), 16),
|
IP: bytes.Repeat([]byte("a"), 16),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Features: lnwire.NewFeatureVector(nil,
|
Features: lnwire.NewFeatureVector(
|
||||||
lnwire.GlobalFeatures),
|
nil, lnwire.Features,
|
||||||
|
),
|
||||||
AuthSigBytes: testSig.Serialize(),
|
AuthSigBytes: testSig.Serialize(),
|
||||||
}
|
}
|
||||||
graphNode.AddPubKey(pub)
|
graphNode.AddPubKey(pub)
|
||||||
@ -183,7 +184,9 @@ func (d *databaseChannelGraph) addRandChannel(node1, node2 *btcec.PublicKey,
|
|||||||
IP: bytes.Repeat([]byte("a"), 16),
|
IP: bytes.Repeat([]byte("a"), 16),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Features: lnwire.NewFeatureVector(nil, lnwire.GlobalFeatures),
|
Features: lnwire.NewFeatureVector(
|
||||||
|
nil, lnwire.Features,
|
||||||
|
),
|
||||||
AuthSigBytes: testSig.Serialize(),
|
AuthSigBytes: testSig.Serialize(),
|
||||||
}
|
}
|
||||||
dbNode.AddPubKey(nodeKey)
|
dbNode.AddPubKey(nodeKey)
|
||||||
@ -287,7 +290,9 @@ func (d *databaseChannelGraph) addRandNode() (*btcec.PublicKey, error) {
|
|||||||
IP: bytes.Repeat([]byte("a"), 16),
|
IP: bytes.Repeat([]byte("a"), 16),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Features: lnwire.NewFeatureVector(nil, lnwire.GlobalFeatures),
|
Features: lnwire.NewFeatureVector(
|
||||||
|
nil, lnwire.Features,
|
||||||
|
),
|
||||||
AuthSigBytes: testSig.Serialize(),
|
AuthSigBytes: testSig.Serialize(),
|
||||||
}
|
}
|
||||||
dbNode.AddPubKey(nodeKey)
|
dbNode.AddPubKey(nodeKey)
|
||||||
|
@ -3506,7 +3506,7 @@ func deserializeLightningNode(r io.Reader) (LightningNode, error) {
|
|||||||
return LightningNode{}, err
|
return LightningNode{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fv := lnwire.NewFeatureVector(nil, lnwire.GlobalFeatures)
|
fv := lnwire.NewFeatureVector(nil, lnwire.Features)
|
||||||
err = fv.Decode(r)
|
err = fv.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return LightningNode{}, err
|
return LightningNode{}, err
|
||||||
|
@ -36,7 +36,7 @@ var (
|
|||||||
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
||||||
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
||||||
|
|
||||||
testFeatures = lnwire.NewFeatureVector(nil, lnwire.GlobalFeatures)
|
testFeatures = lnwire.NewFeatureVector(nil, lnwire.Features)
|
||||||
)
|
)
|
||||||
|
|
||||||
func createLightningNode(db *DB, priv *btcec.PrivateKey) (*LightningNode, error) {
|
func createLightningNode(db *DB, priv *btcec.PrivateKey) (*LightningNode, error) {
|
||||||
|
@ -744,7 +744,7 @@ func deserializeLightningNode(r io.Reader) (LightningNode, error) {
|
|||||||
return LightningNode{}, err
|
return LightningNode{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fv := lnwire.NewFeatureVector(nil, lnwire.GlobalFeatures)
|
fv := lnwire.NewFeatureVector(nil, nil)
|
||||||
err = fv.Decode(r)
|
err = fv.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return LightningNode{}, err
|
return LightningNode{}, err
|
||||||
|
@ -25,7 +25,7 @@ var (
|
|||||||
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
||||||
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
||||||
|
|
||||||
testFeatures = lnwire.NewFeatureVector(nil, lnwire.GlobalFeatures)
|
testFeatures = lnwire.NewFeatureVector(nil, nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
func createLightningNode(db *DB, priv *btcec.PrivateKey) (*LightningNode, error) {
|
func createLightningNode(db *DB, priv *btcec.PrivateKey) (*LightningNode, error) {
|
||||||
|
@ -1459,9 +1459,7 @@ func (d *AuthenticatedGossiper) addNode(msg *lnwire.NodeAnnouncement) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
timestamp := time.Unix(int64(msg.Timestamp), 0)
|
timestamp := time.Unix(int64(msg.Timestamp), 0)
|
||||||
features := lnwire.NewFeatureVector(
|
features := lnwire.NewFeatureVector(msg.Features, lnwire.Features)
|
||||||
msg.Features, lnwire.GlobalFeatures,
|
|
||||||
)
|
|
||||||
node := &channeldb.LightningNode{
|
node := &channeldb.LightningNode{
|
||||||
HaveNodeAnnouncement: true,
|
HaveNodeAnnouncement: true,
|
||||||
LastUpdate: timestamp,
|
LastUpdate: timestamp,
|
||||||
|
@ -85,30 +85,6 @@ const (
|
|||||||
maxAllowedSize = 32764
|
maxAllowedSize = 32764
|
||||||
)
|
)
|
||||||
|
|
||||||
// LocalFeatures is a mapping of known connection-local feature bits to a
|
|
||||||
// descriptive name. All known local feature bits must be assigned a name in
|
|
||||||
// this mapping. Local features are those which are only sent to the peer and
|
|
||||||
// not advertised to the entire network. A full description of these feature
|
|
||||||
// bits is provided in the BOLT-09 specification.
|
|
||||||
var LocalFeatures = map[FeatureBit]string{
|
|
||||||
DataLossProtectRequired: "data-loss-protect",
|
|
||||||
DataLossProtectOptional: "data-loss-protect",
|
|
||||||
InitialRoutingSync: "initial-routing-sync",
|
|
||||||
GossipQueriesRequired: "gossip-queries",
|
|
||||||
GossipQueriesOptional: "gossip-queries",
|
|
||||||
}
|
|
||||||
|
|
||||||
// GlobalFeatures is a mapping of known global feature bits to a descriptive
|
|
||||||
// name. All known global feature bits must be assigned a name in this mapping.
|
|
||||||
// Global features are those which are advertised to the entire network. A full
|
|
||||||
// description of these feature bits is provided in the BOLT-09 specification.
|
|
||||||
var GlobalFeatures = map[FeatureBit]string{
|
|
||||||
TLVOnionPayloadRequired: "tlv-onion",
|
|
||||||
TLVOnionPayloadOptional: "tlv-onion",
|
|
||||||
StaticRemoteKeyOptional: "static-remote-key",
|
|
||||||
StaticRemoteKeyRequired: "static-remote-key",
|
|
||||||
}
|
|
||||||
|
|
||||||
// Features is a mapping of known feature bits to a descriptive name. All known
|
// 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
|
// feature bits must be assigned a name in this mapping, and feature bit pairs
|
||||||
// must be assigned together for correct behavior.
|
// must be assigned together for correct behavior.
|
||||||
|
@ -28,7 +28,7 @@ var (
|
|||||||
Port: 9000}
|
Port: 9000}
|
||||||
testAddrs = []net.Addr{testAddr}
|
testAddrs = []net.Addr{testAddr}
|
||||||
|
|
||||||
testFeatures = lnwire.NewFeatureVector(nil, lnwire.GlobalFeatures)
|
testFeatures = lnwire.NewFeatureVector(nil, lnwire.Features)
|
||||||
|
|
||||||
testHash = [32]byte{
|
testHash = [32]byte{
|
||||||
0xb7, 0x94, 0x38, 0x5f, 0x2d, 0x1e, 0xf7, 0xab,
|
0xb7, 0x94, 0x38, 0x5f, 0x2d, 0x1e, 0xf7, 0xab,
|
||||||
|
@ -1971,7 +1971,7 @@ func (s *server) initTorController() error {
|
|||||||
Addresses: newNodeAnn.Addresses,
|
Addresses: newNodeAnn.Addresses,
|
||||||
Alias: newNodeAnn.Alias.String(),
|
Alias: newNodeAnn.Alias.String(),
|
||||||
Features: lnwire.NewFeatureVector(
|
Features: lnwire.NewFeatureVector(
|
||||||
newNodeAnn.Features, lnwire.GlobalFeatures,
|
newNodeAnn.Features, lnwire.Features,
|
||||||
),
|
),
|
||||||
Color: newNodeAnn.RGBColor,
|
Color: newNodeAnn.RGBColor,
|
||||||
AuthSigBytes: newNodeAnn.Signature.ToSignatureBytes(),
|
AuthSigBytes: newNodeAnn.Signature.ToSignatureBytes(),
|
||||||
|
Loading…
Reference in New Issue
Block a user