<p>The <code>tlv_payload</code> 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 <code>var_onion_optin</code> in BOLT#9.</p>

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

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

<p>In the lnd codebase, the <code>feature</code> folder contains the logic for feature bit vectors. It appears from manager.go that LND now treats the <code>tlv_payload</code> 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 <code>hop_data</code> payload format.</p>

CC BY-SA 4.0
2020-01-04T12:27:54.800Z
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
CC BY-SA 4.0
2020-01-04T13:47:35.157Z
It uses [bbolt](https://github.com/etcd-io/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
CC BY-SA 4.0
2020-01-03T22:46:48.853Z
2020-01-03T22:46:48.853Z
Mark H
<p>When creating a custom route, if you use the <code>queryroutes</code> from lnd it sometimes  with <code>tlv_payload</code> set to either <code>True</code> or <code>False</code>. How does the node figure whether to set this flag? </p>

<p>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? </p>

<bitcoin-core><lightning-network><lightning-network-daemon>
What is the 'tlv_payload' in lnd route?
Oonah
# What is the 'tlv_payload' in lnd route?

(Asked by: username_0 on 2020-01-03)

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?

**Tags:** bitcoin-core, lightning-network, lightning-network-daemon


---

## 1 answers

### Answer by username_1 on 2020-01-03. Score: 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.

> **Comments:**
> **username_0**: 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?  
> **username_1**: It uses [bbolt](https://github.com/etcd-io/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`.  

---

