mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
route: assume modern TLV support if we don't see a node_announcement.
This is in preparation for removing support (next release?). Changelog-Changed: Protocol: We now assume nodes support TLV onions (non-legacy) unless we have a node_announcement which says they don't. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
e7716c86fb
commit
28553e9bea
@@ -107,7 +107,9 @@ static bool dijkstra_to_hops(struct route_hop **hops,
|
|||||||
/* Find other end of channel. */
|
/* Find other end of channel. */
|
||||||
next = gossmap_nth_node(gossmap, c, !(*hops)[num_hops].direction);
|
next = gossmap_nth_node(gossmap, c, !(*hops)[num_hops].direction);
|
||||||
gossmap_node_get_id(gossmap, next, &(*hops)[num_hops].node_id);
|
gossmap_node_get_id(gossmap, next, &(*hops)[num_hops].node_id);
|
||||||
if (gossmap_node_get_feature(gossmap, next, OPT_VAR_ONION) != -1)
|
/* If we don't have a node_announcement, we *assume* modern */
|
||||||
|
if (next->nann_off == 0
|
||||||
|
|| gossmap_node_get_feature(gossmap, next, OPT_VAR_ONION) != -1)
|
||||||
(*hops)[num_hops].style = ROUTE_HOP_TLV;
|
(*hops)[num_hops].style = ROUTE_HOP_TLV;
|
||||||
else
|
else
|
||||||
(*hops)[num_hops].style = ROUTE_HOP_LEGACY;
|
(*hops)[num_hops].style = ROUTE_HOP_LEGACY;
|
||||||
|
|||||||
@@ -2464,6 +2464,8 @@ def test_error_returns_blockheight(node_factory, bitcoind):
|
|||||||
|
|
||||||
@pytest.mark.developer('Needs dev-routes')
|
@pytest.mark.developer('Needs dev-routes')
|
||||||
def test_tlv_or_legacy(node_factory, bitcoind):
|
def test_tlv_or_legacy(node_factory, bitcoind):
|
||||||
|
# Ideally we'd test with l2 NOT var-onion, but then it can no longer connect
|
||||||
|
# to us!
|
||||||
l1, l2, l3 = node_factory.line_graph(3,
|
l1, l2, l3 = node_factory.line_graph(3,
|
||||||
opts={'plugin': os.path.join(os.getcwd(), 'tests/plugins/print_htlc_onion.py')})
|
opts={'plugin': os.path.join(os.getcwd(), 'tests/plugins/print_htlc_onion.py')})
|
||||||
|
|
||||||
@@ -2482,8 +2484,8 @@ def test_tlv_or_legacy(node_factory, bitcoind):
|
|||||||
'cltv_expiry_delta': 6}]]})['bolt11']
|
'cltv_expiry_delta': 6}]]})['bolt11']
|
||||||
l1.rpc.pay(inv)
|
l1.rpc.pay(inv)
|
||||||
|
|
||||||
# Since L1 hasn't seen broadcast, it doesn't know L2 is TLV, but invoice tells it about L3
|
# Since L1 hasn't seen broadcast, it doesn't know L2 isn't TLV, but invoice tells it about L3
|
||||||
l2.daemon.wait_for_log("Got onion.*'type': 'legacy'")
|
l2.daemon.wait_for_log("Got onion.*'type': 'tlv'")
|
||||||
l3.daemon.wait_for_log("Got onion.*'type': 'tlv'")
|
l3.daemon.wait_for_log("Got onion.*'type': 'tlv'")
|
||||||
|
|
||||||
# We need 5 more blocks to announce l1->l2 channel.
|
# We need 5 more blocks to announce l1->l2 channel.
|
||||||
|
|||||||
Reference in New Issue
Block a user