config: add new legacy protocol build tag protected sub-config for legacy onion

In this commit, we add a new build tag protected sub-config for legacy
protocol features. The goal of this addition is to be able to default to
new feature within lnd, but expose hooks at the config level to allow
integration tests to force the old behavior to ensure that we're able to
support both the old+new versions.
This commit is contained in:
Olaoluwa Osuntokun committed 2019-08-22 18:53:08 -07:00
1 parent 1345ca2038
commit 653d557fec
4 files changed
+44 -1

No files matched your search

+6 -1
View File
@@ -312,7 +312,12 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
}
globalFeatures := lnwire.NewRawFeatureVector()
globalFeatures.Set(lnwire.TLVOnionPayloadOptional)
// Only if we're not being forced to use the legacy onion format, will
// we signal our knowledge of the new TLV onion format.
if !cfg.LegacyProtocol.LegacyOnion() {
globalFeatures.Set(lnwire.TLVOnionPayloadOptional)
}
var serializedPubKey [33]byte
copy(serializedPubKey[:], privKey.PubKey().SerializeCompressed())