Commit Graph

11809 Commits

Author SHA1 Message Date
Christian Decker 59494571d2 py: Update poetry dependencies 2022-08-30 18:17:32 +02:00
Christian Decker 4d2e983dba py: Pin grpcio dependencies, they were locking up 2022-08-30 18:16:49 +02:00
Christian Decker e35747d167 fixup! REMOVEME: Just figuring out which dep is causing lockups 2022-08-30 18:14:21 +02:00
Christian Decker 5efc6fe23b fixup! REMOVEME: Just figuring out which dep is causing lockups 2022-08-30 17:19:18 +02:00
Christian Decker bfe06d5320 REMOVEME: Just figuring out which dep is causing lockups 2022-08-30 17:08:44 +02:00
Christian Decker 4a4b0eb00a py: Add mistune==2.0.4 as dependency 2022-08-30 16:53:58 +02:00
Christian Decker f7f9803075 REMOVEME: Limit to test_grpc_wrong_auth 2022-08-30 16:48:36 +02:00
Christian Decker fbf2b545f3 REMOVEME: Trim down CI builds to repro quicker 2022-08-30 15:20:59 +02:00
niftynei f1e9eae1ec
mrkd: use local updated copy of mrkd.py (which uses newer mistune)
Mistune updated from 0.8.4 to 2+ a while ago, however the pypi version
of mrkd was never updated to the newer API. This started breaking
recently.

In this commit we bring the quite simple mrkd file in-house, and update
it to work with the newer mistune API.

Diff between previously generated manpages and current can be found
here:

https://gist.github.com/niftynei/e2c0e4c83b899911def8a57b30f68928

Note that all the emails have been changed from

	fI< to the 'correct' <fI

(This puts the underline for the link inside the starting bracket,
not outside it)
2022-08-28 18:38:35 -05:00
niftynei ab1bf96c64
doc: add missing '7' to a reference 2022-08-28 18:38:35 -05:00
niftynei a8122a8bff
doc: put space between last line and SHA comment
It'll mess things up otherwise when we move over to our custom mrkd
clone
2022-08-28 18:38:35 -05:00
Alex Myers 0abe2e3af1 pytest: Add debugging to test_gossip_store_compact_on_load
This flake has been difficult to reproduce, so let's dump the gossip
store to aid in debugging. See issue #5410.

Changelog-None
2022-08-26 07:03:10 +09:30
niftynei 3ce26735e5 v0.12.0 release changelog 2022-08-23 14:13:25 -04:00
Orb fd8b667e6a use 'postgres' driver (not postgresql). Include plain url to guide, as link is broken on RTD. 2022-08-22 11:21:59 -04:00
greggzigler ce9232af37 Changelog-None 2022-08-22 11:21:19 -04:00
greggzigler c13dffe980 fix MD link where text and url are swapped 2022-08-22 11:21:19 -04:00
niftynei 8cdbe97d91 v0.12.0rc3 - Release Candidate numero tres
Release Candidate 3 for v0.12.0.

Now with more bugfixes!
2022-08-19 18:05:56 -04:00
Rusty Russell 7c9985fd9c channeld: correct reversed shutdown message in billboard.
It was backwards, which made #5496 confusing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `listpeers` `status` "They've sent shutdown" and "We've sent shutdown" were backwards.
2022-08-19 11:04:37 -04:00
Christian Decker aabf38a11d ci: Fix the Mac OS build test 2022-08-19 10:44:21 -04:00
adi2011 8f78a76d1a tests/test_misc.py: check logs for already existing channel. 2022-08-19 10:27:09 -04:00
adi2011 0b737fd7e5 doc: Typo 2022-08-19 10:27:09 -04:00
adi2011 23b675922f lightningd/opening_control.c: Skip over channels which are already stored, and don't create new peer if it already exits. Changelog-None 2022-08-19 10:27:09 -04:00
Rusty Russell 9219e778a1 doc: update usage of lightning-invoice.
The new parameter name (this version) is amount_msat: msatoshi is
deprecated.   The doc/schemas/invoice.request.json has this correct
(but we don't generate teh *usage* line from that yet!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-18 15:53:14 -04:00
Ken Sedgwick 82f7035524 Renumber hsmd_derive_secret for consistency with other hsmd messages 2022-08-16 15:04:49 -05:00
Christian Decker 65549a2931 ld: Fix a log message assuming that the `channel->scid` was set
This is no longer true after we introduce `zeroconf`, so use the alias
local alias instead if not set.

Signed-off-by: Christian Decker <@cdecker>
2022-08-16 14:52:52 -05:00
Christian Decker ab1ca7f159 pytest: Reproduce a crash when we have multiple channels and 0conf
This is a case where we assume that the `channel->scid` is set, which
is no longer true with `zeroconf`

Changelog-None: Zeroconf was not yet released at the time the discovery was made

Reported-by: Yaacov Akiba Slama <@yaslama>
Reported-by: Roei Erez <@roeierez>
2022-08-16 14:52:52 -05:00
niftynei 1a25651182 bkpr-recorder: fatal if there's an error with a database statement
We were silently failing when NULLS FIRST wasn't found on older boxes
(running sqlite3 < v3.30.1)
2022-08-16 12:32:08 -05:00
niftynei fdfca9e721 sqlite3: no NULLS FIRST
sqlite3 added NULLS FIRST to their schema as of v3.30.1 but some older
boxes aren't updated (notably the author's own node box).

The default behavior for sqlite3 is to sort nulls first however, this
is *really* only needed for postgres.

As a simple fix (which will allow older boxes to not upgrade their
sqlite yet), simply strip out the NULLS FIRST keywords from sqlite3
queries.

Reported-By: Simon Vrouwe @SimonVrouwe
Fixes: #5517
2022-08-16 12:32:08 -05:00
niftynei 4e7f89f211 signpsbt: don't crash if HSM doesn't like your psbt, just return err
Changelog-Changed: JSON-RPC: `signpsbt` no longer crashes if it doesn't like what your PSBT is
2022-08-13 12:57:03 -05:00
niftynei 4984014578 signpsbt: add utxo info to inputs
If you build a PSBT externally from CLN and attempt to sign for the
output, we would crash. Now we don't crash.

Changelog-Changed: JSON-RPC: `signpsbt` will now add redeemscript + witness-utxo to the PSBT for an input that we can sign for, before signing it.

Fixes #5499 ?
2022-08-13 12:57:03 -05:00
niftynei 63f8c74da9 psbt: dont crash when printing psbt to log
We call `tal_wally_start` and then `tal_wally_start` again in
`type_to_string` for psbt.

end the last tal before calling type to string.

Fixes: #5499
Reported-By: @fiatjaf

lightning_hsmd: FATAL SIGNAL 6 (version v0.11.0.1-231-gddf8fbd-modded)
0x5574ca0d87ef send_backtrace
	common/daemon.c:33
0x5574ca0d8877 crashdump
	common/daemon.c:46
0x7f76ef63e8df ???
	???:0
0x7f76ef68e36c ???
	???:0
0x7f76ef63e837 ???
	???:0
0x7f76ef628534 ???
	???:0
0x5574ca0df55e tal_wally_start
	common/utils.c:27
0x5574ca0e4024 psbt_to_b64
	bitcoin/psbt.c:687
0x5574ca0e4093 fmt_wally_psbt_
	bitcoin/psbt.c:694
0x5574ca0df4b9 type_to_string_
	common/type_to_string.c:32
0x5574ca0d5139 sign_our_inputs
	hsmd/libhsmd.c:486
0x5574ca0d5206 handle_sign_withdrawal_tx
	hsmd/libhsmd.c:1029
0x5574ca0d63c4 hsmd_handle_client_message
	hsmd/libhsmd.c:1575
0x5574ca0ce763 handle_client
	hsmd/hsmd.c:671
0x5574ca100032 next_plan
	ccan/ccan/io/io.c:59
0x5574ca1004b9 do_plan
	ccan/ccan/io/io.c:407
0x5574ca100552 io_ready
	ccan/ccan/io/io.c:417
0x5574ca101daf io_loop
	ccan/ccan/io/poll.c:453
0x5574ca0ceb7b main
	hsmd/hsmd.c:739
0x7f76ef62928f ???
	???:0
0x7f76ef629349 ???
	???:0
0x5574ca0cda04 ???
	../sysdeps/x86_64/start.S:115
2022-08-13 12:57:03 -05:00
niftynei 04cb6316d5 CHANGELOG: v0.12.0rc2 2022-08-10 18:48:41 -05:00
Ken Sedgwick 0878002fe6 Fix derived_secret, use correct size of secretstuff.derived secret
[ Updated tests to match -- RR]
2022-08-10 12:41:27 -05:00
Rusty Russell eb006dcadd wallet: fix incorrect column-width access.
Postgresql actually checks, and fails.

It's unclear why this field is an INTEGER (and u32) when it's a BIGINT 
in db here (it's an INTEGER in the channels table, just a BIGINT in the
channel_funding_inflights table).

Changelog-Fixed: db: postgresql crash on startup when dual-funding lease open is pending with "s32 field doesn't match size: expected 4, actual 8"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-10 10:34:12 -05:00
Rusty Russell b173b29346 pytest: test loading lease_chan_max_msat from channel_funding_inflights
It crashes with:

```
s32 field doesn't match size: expected 4, actual 8
```

Reported-by: @zerofeerouting
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-10 10:34:12 -05:00
niftynei 9d3bf4a1b5 bkpr: let channel reconnect, flake? 2022-08-10 10:30:45 -05:00
niftynei 72a30fc750 bkpr: dont flake, wait til pay done before mining blocks 2022-08-10 10:30:45 -05:00
niftynei 256044081f bkpr: remove duplicate log stmt 2022-08-10 10:30:45 -05:00
niftynei 23cd58402a bkpr: create accounts for zero sat channels
we weren't making records for 'missed' accounts that had a zero balance
at snapshot time (if peer opens channel and is unused)

Fixes: #5502
Reported-By: https://github.com/niftynei/cln-logmaid
2022-08-10 10:30:45 -05:00
Rusty Russell 1ff8e1bacb doc: note that setchannel maxhtlc/minhtlc only apply to *forwards*.
Reported-by: Warren Togami
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:38:57 -05:00
Rusty Russell fcba09dc33 doc: document that sendonion doesn't have to specify (but can!) the first_hop channel.
This was always the case, though it was ignored.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:33:24 -05:00
Rusty Russell 054339e0cb lightningd: obey first hop channel id.
Reported-by: Warren Togami
Changelog-Changed: `sendpay` and `sendonion` now obey the first hop "channel" short_channel_id, if specified.
Changelog-Deprecated: `sendpay` and `sendonion` could take a bogus first hop "channel" short_channel_id
2022-08-09 16:33:24 -05:00
Rusty Russell 9543204b79 pytest: don't use bogus scids for first hop of route.
This was a legacy from when it was redundant: with multiple channels, it
no longer is!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:33:24 -05:00
Rusty Russell 8a9ce55345 lightningd: don't route private channels via real scid.
Again, we should use the real channel_type, but we approximate.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: private channels will only route using short-channel-ids if channel opened with option_scid_alias-supporting peer.
2022-08-09 16:31:36 -05:00
Rusty Russell cfe6b06fb5 lightnind: use aliases in routehints for private channels.
We *should* remember the channel type, since this is only required
if they set the channel_type to include option_scid_alias.

However, since we support channel upgrade, channel_type really needs
a new table.  I have a patch for that, from my abandoned original
"fastopen" branch for aliases, but it's too big a chance for rc2 IMHO.

Meanwhile, we allow exposeprivatechannels's scids to be either real or
the aliases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: invoice routehints will use fake short-channel-ids for private channels if channel opened with option_scid_alias-supporting peer.
2022-08-09 16:31:36 -05:00
Rusty Russell b479e9a9fa pytest: test that we implement option_scid_alias privacy.
Spoiler: we don't! :(

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:31:36 -05:00
Rusty Russell 25b4249f54 doc: fix decode schema for bolt11 routehints.
I decode a routehint in the next patch, and it barfed:

```
>       assert only_one(l1.rpc.decode(inv['bolt11'])['routes'])['short_channel_id'] == alias23

tests/test_opening.py:1515: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
contrib/pyln-client/pyln/client/lightning.py:321: in wrapper
    return self.call(name, payload=args)
contrib/pyln-testing/pyln/testing/utils.py:691: in call
    schemas[1].validate(res)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = Validator(schema={'$schema': 'http://json-...ft-07/schema#', 'allOf': [{'if': {'properties': {'type': {'enum': [...], ...iption': 'if this is f... diagnostics!', 'type': 'boolean'}}, 'required': ['type', 'valid'], ...}, format_checker=None)
args = ({'amount_msat': 10msat, 'created_at': 1659923931, 'currency': 'bcrt', 'description': 'desc', ...},), kwargs = {}
error = <ValidationError: "1msat is not of type 'u32'">

    def validate(self, *args, **kwargs):
        for error in self.iter_errors(*args, **kwargs):
>           raise error
E           jsonschema.exceptions.ValidationError: 1msat is not of type 'u32'
E           
E           Failed validating 'type' in schema['allOf'][6]['then']['properties']['routes']['items']['items']['properties']['fee_base_msat']:
E               {'description': 'the base fee for payments', 'type': 'u32'}
E           
E           On instance['routes'][0][0]['fee_base_msat']:
E               1msat

```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:31:36 -05:00
niftynei 016ce2b925 build: ignore docker/image build directories
Changelog-None
2022-08-09 11:57:18 +09:30
niftynei 3fcf60ab7c bkpr: track channel rebalances, display in listincome
Track rebalances, and report income events for them.

Previously `listincome` would report:
	- invoice event, debit, outgoing channel
	- invoice_fee event, debit, outgoing channel
	- invoice event, credit, inbound channel

Now reports:
	- rebalance_fee, debit, outgoing channel
	(same value as invoice_fee above)

Note: only applies on channel events; if a rebalance falls to chain
we'll use the older style of accounting.

Changelog-None
2022-08-09 11:57:18 +09:30
Christian Decker da0b651803 pay: Use safe list traversal when completing suspended payments
When traversing the list we call `command_finished` which modifies the
list we are traversing. This ensures we don't end up advancing in the
list iteration.

Reported-by: Rusty Russell <@rustyrussell>
2022-08-08 11:52:29 -05:00