0

When creating a custom route, if you use the queryroutes from lnd it sometimes with tlv_payload set to either True or False. How does the node figure whether to set this flag?

I cant seem to find it in the source code. Clearly when using RPC calls such as 'getnodeinfo' the feature bit set from the node does not come through. So is this possible that the feature set per node is not exposed via RPC?

3

The tlv_payload is a modification to the way onion packets are created between the 1.0 version and the 1.1 version (current working version) of the BOLT specs. The (optional) feature is named var_onion_optin in BOLT#9.

In V1.0 of the spec, there was a fixed structure for sending onion payloads to hops along a route, which contained a short_channel_id, a cltv_expiry and an amount_to_forward. In the latest version, implementations can add custom data to be forwarded in addition to the previously required ones. These contain a type and length encoded as a compact size integer, and the value of length bytes is serialized afterwards. Hence Type-Length-Value, or TLV.

Nodes which support the newer format advertise the var_onion_optin feature when they broadcast a node_announcement message, by setting bit #9 in the features field of this message.

In the lnd codebase, the feature folder contains the logic for feature bit vectors. It appears from manager.go that LND now treats the tlv_payload as enabled by default unless it is disabled as part of the config. Older versions of LND will obviously not support the feature and will use the legacy hop_data payload format.

| improve this answer | |
  • Thanks Mark, so the core information is stored in the node_announcements. How does one get this info? There does not seem to be an RPC/CLI command which can get this info? Or rather is it stored on disk anywhere? – Oonah Jan 4 at 12:27
  • It uses bbolt for storage. The channeldb folder in lnd contains all of the database code. I'm not too familiar with lnd so not sure where it stores data by default, but I imagine it uses some standard directory like XDG_DATA_HOME. – Mark H Jan 4 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.