Commit Graph

10304 Commits

Author SHA1 Message Date
Rusty Russell 79d7e83f51 --experimental-quick-close to enable quick-close negotiation
Based on a commit by @niftynei, but:
- Separated quickclose logic from main loop.
- I made it indep of anchor_outputs, use and option instead.
- Disable if they've specified how to negotiate.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-09 12:04:48 +09:30
niftynei 23a6c00496 Makefile: import latest spec, which includes quickclose.
It also gets rid of the requirement that close negotiation fee maximum
is the old commitment transaction.  We still do that, however, to
avoid surprising old peers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-09 12:04:48 +09:30
Rusty Russell fb4edc2938 Makefile: update bolt version to include option_anchors_zero_fee_htlc_tx.
This touches a lot of text, mainly to change "if `option_anchor_outputs`"
to "if `option_anchors`"

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-09 12:04:48 +09:30
Rusty Russell 1b2c6964fd Makefile: update spec version
This includes the new bolt11 test vectors, and also removes the
requirement that HTLCs be less than 2^32 msat.  We keep that for now
because Electrum enforced it on receive: in two releases we will stop
that too.

So no longer warn about needing mpp in that case either.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: Protocol: No longer restrict HTLCs to
2021-09-09 12:04:48 +09:30
Rusty Russell 88d55441c5 channeld: allow large HTLCs if peer offers option_support_large_channel
This check is going away anyway (only Electrum enforced it), but we
know that all wumbo peers expect large HTLCs to work today.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: Allow sending large HTLCs if peer offers option_support_large_channel (> 4294967295msat)
2021-09-09 12:04:48 +09:30
Rusty Russell d637680476 Makefile: Update BOLT version to cover bolt11 test vectors with payment secret.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-09 12:04:48 +09:30
Rusty Russell ad31a49455 lightningd/chaintopology: stop callbacks rearming once topology stopped.
Otherwise we get very upset when the plugins go away.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 31f439760f libplugin: make leaks log at LOG_BROKEN so they break CI.
Now we've fixed them, this makes sure CI notices if new leaks appear.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 14002915a1 plugins/libplugin: mark timers as not-a-leak.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 4f4c49c88a libplugin: fix leak of struct command when we don't read it all at once.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Plugins: C plugins would could leak memory on every command (esp. seen when hammering topology's listchannels).
2021-09-08 19:11:47 +02:00
Rusty Russell 127539a993 plugins/topology: use memleak annotation instead of global_gossmap hammer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell a0d531d515 pytest: annotate name_option against leak detection in test_libplugin
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 19413a821f wire/tlvstream: don't leak in tlvstream_set_tu64/tu32/short_channel_id.
Another tiny leak, which happened in keysend which uses these routines.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 68470c8f22 plugins/txprepare: annotate unreleased_txs list against false memleaks.
And fix utx leak in the withdraw case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 2e0179ffcc plugins/bcli: keep a list of current bitcoind requests.
This lets memleak track them, but makes sure they don't leak; using
notleak could cover up a leak here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 02553aa68a plugins/spender: don't use global tal context, use take() instead.
Otherwise it looks like a leak.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell f246896348 spender/openchannel.c: don't leave psbt parts owned by NULL.
They get grafted into clone, so have them parented there.  Otherwise
we get a small leak every time we RBF.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 665748236c plugins/funder: don't use global owner parent; mark policy for memleak.
And free the err string when policy turns out not to be a u64.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell af7ed03921 plugins/bcli: handle memleak.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell b82e5be6e1 libplugin: let plugins add annotations to memleak.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
mar
2021-09-08 19:11:47 +02:00
Rusty Russell dd65a9150a libplugin: if DEVELOPER set, do memleak detection on shutdown.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell bab7778b5b libplugin: allow take() for commands, notif_subs, hook_subs, notif_topics.
Useful for plugins which dynamically generate them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 952471e7a3 libplugin: allow stealing of feature sets, make keysend do that.
Otherwise the NULL parents look like a memleak.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell 1f7fb33563 common/memleak: hoist strmap helper from out of lightningd/memdump.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell a5fee67b91 common/memleak: take over dump_memleak(), allow print pointer.
This will let plugins use it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell b34953dd5e ccan: update to get version where tal_dump goes to stderr.
This is useful for plugins which can't send junk to stdout.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Dustin Dettmer a7d50ca3e7 Critical funder flaw
An explanation for noobs is needed here -- without it they may be confused by some of the documation.
2021-09-08 18:49:50 +02:00
Michael Schmoock e9b801d9c8 pyln-client/gossmap: adds testcase for half channels 2021-09-08 09:34:14 +09:30
Rusty Russell e8e7c4719f pyln-client: fix mypy warnings, fix and test deletion of a channel.
This only happens when a deletion is added by a running gossipd, so
we put a deletion at the end of the store to test it.

mypy noticed that this code was nonsensical, so clearly untested.

The testing noticed that making a nodeid from a string was also buggy.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Michael Schmoock 125752118a pyln-client/gossmap: init GossmapNode and Id also with hexstring
also improves test coverage
Changelog-Added: pyln-client: routines for direct access to the gossip store as Gossmap
2021-09-08 09:34:14 +09:30
Michael Schmoock fa8e74a2ad pyln-client/gossmap: make node and node_id comparable with __lt__ and __eq__ 2021-09-08 09:34:14 +09:30
Michael Schmoock 47efea92c6 pyln-client/gossmap: let half channel have source and destination 2021-09-08 09:34:14 +09:30
Michael Schmoock 2bca76b6e9 pyln-client/gossmap: start internal function names with underscore _ 2021-09-08 09:34:14 +09:30
Michael Schmoock de6c593272 pyln-client/gossmap: have channels link to their nodes instead of id
This is likely easier for programmers and does not use more mem as we
already load all this.
2021-09-08 09:34:14 +09:30
Rusty Russell 4ad4ed8d17 pyln-client/gossmap: make test gossip_store include channel_updates, deletions.
Suggested-by: @mschmook
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell 487facf1f0 pyln-client/gossmap: more fixes, make mypy happier.
Mainly fixing type annotations, but some real fixes:

1. GossmapHalfchannel.from_str() should be a classmethod.
2. update_channel had weird, unusable default values (fields can't be NULL,
   since we use it below).

[ There was one more occurence where isinstance should be used above
type() == xyz comparison. -- MS ]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Michael Schmoock ba2bcac530 pyln-client/gossmap: Don't mix bytes and GossmapNodeId
Do not mix bytes and GossmapNodeId when accessing Gossmap.nodes dicts.

Therefore the definion got GossmapNodeId also needed to be pulled to the
beginning of the file.
2021-09-08 09:34:14 +09:30
Michael Schmoock ac27217114 pyln-client/gossmap: adds __repr__ functions 2021-09-08 09:34:14 +09:30
Michael Schmoock b60d3259bf pyln-client/gossmap: extend testcase 2021-09-08 09:34:14 +09:30
Michael Schmoock b6ed405d8c pyln-client/gossmap: adds channel satoshi capacity
This reads the `gossip_store_channel_amount` that always follows the
`channel_announcement` messages. Therefore it uses an internal variable
_last_scid to know what channel has been added last time.
2021-09-08 09:34:14 +09:30
Michael Schmoock c5c909acd3 pyln-client/gossmap: adds helpers to get channels and nodes 2021-09-08 09:34:14 +09:30
Michael Schmoock fd16535f68 pyln-client/gossmap: adds GossmapHalfchannel objects 2021-09-08 09:34:14 +09:30
Rusty Russell 75126a0997 pyln-client/gossmap: add NodeId class.
This is more efficient than converting them all to Pubkeys: about 3.8
seconds vs 5.4 seconds.  Usually treating them as raw bytes is what we
want anyway.

[ Fixup by Michael Schmoock <michael@schmoock.net> ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell 887fb38e06 pyln-client/gossmap: use ShortChannelId class from pyln.proto, if available.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell 0ce473c656 pyln-proto: expose ShortChannelId and PublicKey.
They're generally useful.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell 4753ca4d35 pyln-client/gossmap: add a little documentation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell e495462c50 pyln-client/gossmap: save deconstructed fields instead of raw msg bytes.
We have to parse them anyway, so why not make them accessible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell 1a5a26d659 pyln.client: new functionality to access Gossmap.
It doesn't do much work, but it does parse the gossmap file and extract
nodes and channels.

[ Fixup by Michael Schmoock <michael@schmoock.net> ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell 07d2639f51 pyln.client: don't try to use module inside setup.py.
This fails once it has dependencies (next patch): instead extract version
manually.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 09:34:14 +09:30
Rusty Russell 6b8d3a05f5 pyln-spec: update to latest version of the spec.
Changelog-Changed: pyln-spec: updated to latest BOLT versions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-07 17:41:28 +09:30