mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
gossipd: don't expose private channels for routeboost.
We don't create unannouncable channels, but other implementations can. Not only is it rude to expose these via invoices, it's probably not useable anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1538,6 +1538,10 @@ static struct io_plan *get_incoming_channels(struct io_conn *conn,
|
||||
const struct half_chan *hc;
|
||||
struct route_info *ri;
|
||||
|
||||
/* Don't leak private channels. */
|
||||
if (!is_chan_public(c))
|
||||
continue;
|
||||
|
||||
hc = &c->half[half_chan_to(node, c)];
|
||||
|
||||
if (!is_halfchan_enabled(hc))
|
||||
|
||||
@@ -117,11 +117,19 @@ def test_invoice_preimage(node_factory):
|
||||
l2.rpc.invoice(123456, 'inv2', '?', preimage=invoice_preimage)
|
||||
|
||||
|
||||
def test_invoice_routeboost(node_factory):
|
||||
def test_invoice_routeboost(node_factory, bitcoind):
|
||||
"""Test routeboost 'r' hint in bolt11 invoice.
|
||||
"""
|
||||
l1, l2 = node_factory.line_graph(2, announce=True, fundamount=10**4)
|
||||
l1, l2 = node_factory.line_graph(2, fundamount=10**4)
|
||||
|
||||
# Won't get reference to route until channel is public.
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv0", description="?")
|
||||
assert 'warning_capacity' in inv
|
||||
|
||||
bitcoind.generate_block(5)
|
||||
wait_for(lambda: [c['public'] for c in l2.rpc.listchannels()['channels']] == [True, True])
|
||||
|
||||
# Check routeboost.
|
||||
# Make invoice and pay it
|
||||
inv = l2.rpc.invoice(msatoshi=123456, label="inv1", description="?")
|
||||
# Check routeboost.
|
||||
|
||||
Reference in New Issue
Block a user