Commit Graph

8869 Commits

Author SHA1 Message Date
Rusty Russell 480f671e91 bitcoin/psbt: psbt_txid needs a tal ctx.
It returns a wally_tx; it's an anti-pattern not to hand in a tal context.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-23 13:52:49 +09:30
Rusty Russell 67fbb349b6 bitcoin/tx: trivial cleanups.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-23 13:52:49 +09:30
Rusty Russell 11ebb84e7d bitcoin/psbt: attach destructors to wally allocations to avoid leaks.
This covers the obvious ones, but the later patches fix this more
seriously.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Some memory leaks in transaction and PSBT manipulate closed.
2020-09-23 13:52:49 +09:30
Rusty Russell 80c705d528 bitcoin/psbt: more const pointers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-23 13:52:49 +09:30
Antoine Poinsot 4b4fe2f4fb dual-openingd: msg_type should be dualopend_wire not u8
clang did the hard work here:

openingd/dualopend.c:958:42: error: result of comparison of constant 'WIRE_DUAL_OPEN_FAIL' (7003) with expression of type 'u8' (aka 'unsigned char') is always false
      [-Werror,-Wtautological-constant-out-of-range-compare]
        if ((msg_type = fromwire_peektype(msg)) == WIRE_DUAL_OPEN_FAIL) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~

Co-Authored-by: the clang compiler
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-09-23 13:46:02 +09:30
Christian Decker de7b41695f db: Fix size mismatch on postgres in a migration
Changelog-Fixed: db: Fixed a broken migration on postgres DBs that had really old channels.
2020-09-23 10:48:31 +09:30
Rusty Russell a08e83522b configure: clean up tmpfile if we fail.
Reported-by: @whitslack
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-21 13:07:01 +02:00
Rusty Russell d56f8b6c5d configure: refuse to create config.vars without any database.
We alter the script to do the move to config.vars right at the end,
which is probably a good idea anyway.

Fixes: #4054
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-19 12:38:54 +09:30
Rusty Russell 34a6294031 lightningd: really remove relative plugins dirs.
We promised this in 0.8.1!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: Plugin: Relative plugin paths are not relative to startup (deprecated v0.7.2.1)
2020-09-18 12:08:07 +09:30
Rusty Russell 288aa397fc lightningd: remove deprecated result for `plugin stop`.
Changelog-Removed: JSON API: `plugin stop` result with an empty ("") key (deprecated 0.8.1)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-18 12:08:07 +09:30
Rusty Russell 00115ee7f0 lightningd: remove deprecated rpc_command hook return.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON API: The hook `rpc_command` returning `{"continue": true}` (deprecated 0.8.1)
2020-09-18 12:08:07 +09:30
Rusty Russell 8aa660e938 lightningd: remove deprecated return for `db_write` hook.
Changelog-Removed: JSON API: The hook `db_write` can no longer return `true` (deprecated in 0.8.1)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-18 12:08:07 +09:30
Rusty Russell 349f245f8c lightningd: remove deprecated per_hop_v0 in htlc hook.
Changelog-Removed: JSON API: `htlc_accepted` hook `per_hop_v0` object removed (deprecated 0.8.0)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-18 12:08:07 +09:30
Rusty Russell 99ff474308 lightningd: remove deprecated plugin entries.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON API: `listconfigs` duplicated "plugin" paths (deprecated 0.8.0)
2020-09-18 12:08:07 +09:30
Matt Whitlock eab14768a8 update SHA256STAMPs using sorted dependencies 2020-09-17 10:23:40 +09:30
Matt Whitlock ec29f04b5f Makefile: sort input filenames to SHA256STAMP
Make's 'wildcard' function returns matching file paths in an
unpredictable order, thereby causing false mismatches in the produced
SHA256STAMPs from system to system. This commit sorts the file paths
given to 'cat' to make the stamps deterministic.

Changelog-Fixed: The build system no longer spuriously regenerates generated sources due to differences in `readdir`(3) sort order.
2020-09-17 10:23:40 +09:30
niftynei b4989b9e15 listpeers: show correct amounts for starting funding allocation
With dual-funded channels, it's possible for the funding allocation of
the non-opener to not be zero
2020-09-17 10:15:29 +09:30
niftynei d0e42e2c36 contrib: make bitcoin polling and gossip propagation snappier
Faster stronger better local testing
2020-09-17 10:14:22 +09:30
niftynei 53ba34fe3a doc: correct weight numbers for fundpsbt 2020-09-17 10:14:22 +09:30
niftynei 9f006fdf03 memleak: 'generify' the memleak calling to code for openingd/dualopend
Switch on name of subd(aemon) as to whether to call dualopend or
openingd for memleak results
2020-09-17 10:12:08 +09:30
Christian Decker a88073f6fb repro: Add missing Dockerfiles 2020-09-16 06:27:12 +09:30
Christian Decker 274540f556 repro: Allow dashes in the version number 2020-09-16 06:27:12 +09:30
Christian Decker 15842d056d docker: Bump OS version to debian buster
Since we're planning on standardizing on Python 3.6+ [1] I think it is a good
idea to bump our own docker image to a Debian version that fulfills that
requirement as well.

[1] https://github.com/lightningd/plugins/issues/146
2020-09-16 06:27:12 +09:30
Rusty Russell 817a7533d1 Ready for release!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-15 12:07:58 +09:30
Rusty Russell 5eb121ffc3 common/amount: fix OpenBSD compile warning.
```
cc common/amount.c
common/amount.c:306:15: error: implicit conversion from 'unsigned long long' to
      'double' changes value from 18446744073709551615 to 18446744073709551616
      [-Werror,-Wimplicit-int-float-conversion]
        if (scaled > UINT64_MAX)
                   ~ ^~~~~~~~~~
/usr/include/sys/stdint.h:123:21: note: expanded from macro 'UINT64_MAX'
                                ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake: *** [Makefile:254: common/amount.o] Error 1
bsd$
```

Fixes: #4044
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-14 03:57:17 +09:30
Rusty Russell ea810b7011 lightningd: don't declare local vars stdin and stdout.
OpenBSD uses macros for these, and gets upset.

Fixes: #4044
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-14 03:57:17 +09:30
Sergi Delgado Segura f1d5fdf323 pyln: Sets remote_pubkey for LightningConnection if node is not the initiator
Currently ``LightningConnection.remote_pubkey`` is set to ``None`` if the node is not the handshake initiator. This sets it to ``rs`` in act three from the receiver side
2020-09-12 15:06:08 +09:30
Rusty Russell 26c10ffefe CHANGELOG.md: 0.9.1rc2
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-12 10:26:15 +09:30
Rusty Russell 5bb6af6ba8 doc: note default proxy port.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-11 21:29:01 +09:30
Rusty Russell f658dd0d78 pytest: test connection timeout.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-11 21:27:45 +09:30
Rusty Russell 7f2b332021 connectd: implement connection timeout (60 seconds).
This is simple, and we now can multifundchannel to every node on testnet
(one simply hangs once we connect).

Changelog-Fixed: Protocol: We now hang up if peer doesn't respond to init message after 60 seconds.
2020-09-11 21:27:45 +09:30
Rusty Russell 1deba1c8e4 plugins/pay: handle case where amount_msat is 'null'.
Deprecated, but this can happen:

```
==1578== Conditional jump or move depends on uninitialised value(s)
==1578== at 0x12B30E: amount_msat_add (amount.c:224)
==1578== by 0x11270B: add_amount_sent (pay.c:1734)
==1578== by 0x112D89: listsendpays_done (pay.c:1831)
==1578== by 0x114F4B: handle_rpc_reply (libplugin.c:555)
==1578== by 0x115704: rpc_read_response_one (libplugin.c:685)
==1578== by 0x115821: rpc_conn_read_response (libplugin.c:705)
==1578== by 0x148E40: next_plan (io.c:59)
==1578== by 0x1499BD: do_plan (io.c:407)
==1578== by 0x1499FB: io_ready (io.c:417)
==1578== by 0x14BBC1: io_loop (poll.c:445)
==1578== by 0x117A82: plugin_main (libplugin.c:1322)
==1578== by 0x113ABC: main (pay.c:2096)
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-11 12:48:48 +09:30
Rusty Russell dcf45b47b3 Travis: spread the load a little more.
Commit cec755f796 reduced from 14 runners to 10,
but we're seeing some timeouts again.  So turn it up to 11.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-11 09:18:28 +09:30
Rusty Russell 9b41d608ee CHANGELOG.md: v0.9.1-rc1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-10 20:04:09 +09:30
Christian Decker f5dd393113 pyln: Bump proto version to match pyln-bolt*
Since pyln-bolt* specify the 0.8.4 version which we didn't upload, and the
requirements.txt specify ==0.8.4, we need to backfill that version, even if we
could just bump it directly to 0.9.1.
2020-09-10 20:01:41 +09:30
Vincenzo Palazzo f62d7bbe45 Added additional fix to code formatting and English spelling.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2020-09-10 17:27:51 +09:30
Vincenzo Palazzo 9fbeb9bcdc delpay: code style changes and fixed docs
Changelog-Added: JSON-RPC: delpay a new method to delete the payment completed or failed.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2020-09-10 17:27:51 +09:30
ZmnSCPxj jxPCSnmZ 0eb1e7e0ca plugins/libplugin-pay.c: Add new payee_incoming_limit to limit number of HTLCs based on payee connectivity.
Fixes: #3926

(probably)

Changelog-Fixed: pay: Also limit the number of splits if the payee seems to have a low number of channels that can enter it, given the max-concurrent-htlcs limit.
2020-09-10 16:50:52 +09:30
ZmnSCPxj jxPCSnmZ deced56344 plugins/libplugin-pay.c: Add facility to have paymods request lowering of the estimated max HTLCs. 2020-09-10 16:50:52 +09:30
ZmnSCPxj jxPCSnmZ d15717b576 plugins/libplugin-pay.c: Keep p->invoice->routes valid when the routehints paymod mutates it.
The routehints paymod shares the storage of the array d->routehints and
p->invoice->routes, but once it operates, it possibly leaves it as a stale
pointer to memory it used to have.

Since other paymods may be interested in the invoice details, including
the routehints in the invoice, we should ensure the p->invoice->routes
remains valid whenever we try mutating that array.
2020-09-10 16:50:52 +09:30
ZmnSCPxj jxPCSnmZ 2d86014e53 tests/test_pay.py: Test for overload of number of HTLCs at the payee. 2020-09-10 16:50:52 +09:30
Rusty Russell 191355e0e7 pay: fix handling of legacy vs tlv encoding.
As revealed by the failure of tests in #3936, where we ended up trying
to send a partial payment using legacy style, we are not handling
style properly.

1. BOLT9 has features, so we can *know* that the destination supports
   MPP.  We may not have seen a node_announcement.
2. We can't assume that nodes inside routehints support TLV.
3. We can't assume direct peers support TLV.

The keysend code tried to fix this up, so I'm not sure that this caused
the issue in #3968, though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `pay` will now make reliable multi-part payments to nodes it doesn't have a node_announcement for.
2020-09-10 16:50:32 +09:30
ZmnSCPxj jxPCSnmZ 9587425f2d plugins/spender/fundchannel.c: Make fundchannel a thin layer around multifundchannel.
Changelog-Changed: protocol: `fundchannel` now shuffles inputs and outputs, and no longer follows BIP69.
2020-09-10 15:28:50 +09:30
ZmnSCPxj jxPCSnmZ f6c145d2df plugins/spender/multifundchannel.c: Move multifundchannel to the spenderp plugin. 2020-09-10 15:28:50 +09:30
Rusty Russell 976c6e5c83 json_add_tok: simplify, don't try to canonicalize.
I'm not sure why we were turning strings into bools, etc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-10 15:28:50 +09:30
niftynei 165d039f6c elements: consolidate fee outputs into a single fee output
In the case that you've got more than one fee output already on a
psbt, we consolidate them into a single fee output (the first)
2020-09-10 12:31:36 +09:30
niftynei 9771273c4d elements: these can coin moves can arrive in either order 2020-09-10 12:31:36 +09:30
niftynei 81a7a6742a elements: use normalization for elements fee output
This will update the fee output if it exists, rather than unilaterally
adding a new one.

Also, if the fee output already exists, we should make sure that it
doesn't interfere with the outnums of the other outputs
2020-09-10 12:31:36 +09:30
niftynei eab7fcf8e5 test_utxopsbt: account for fee output diff when elements 2020-09-10 12:31:36 +09:30
niftynei 4311c658d0 test_txprepare: skip over fee outputs (elements) 2020-09-10 12:31:36 +09:30