Commit Graph

8567 Commits

Author SHA1 Message Date
niftynei 250af67908 elements: run sign + send psbt check for elements tests
Now that we're using an 'elements' witness_utxo and issue 3998 has been
resolved, this should work as expected.
2020-09-10 12:31:36 +09:30
niftynei 273f0991b0 elements: include the value + asset tag for 'PSET's
Not strictly necessary as technically this info is included in the
witness_utxo, but nice to have
2020-09-10 12:31:36 +09:30
niftynei 24578c7fea elementsd: use the elements version of a 'witness utxo'
Elements requires the witness utxo to include the asset and value info,
in order for the signing hash to be constructed correctly

Changelog-Fixed: elementsd: PSBTs include correct witness_utxo struct for elements transactions
2020-09-10 12:31:36 +09:30
Christian Decker bd811fbd1a pyln: Add safe fallback results for hooks
Hooks do not tolerate failures at all. If we return a JSON-RPC error to a hook
call the only thing the main daemon can really do is to crash. This commit
adds a mapping of error to a safe fallback result, including a warning to the
node operator that this should be addressed in the plugin. The warning is
reported as a `**BROKEN**` message, and should therefore fail any testing done
on the plugin.

Changelog-Fixed: pyln: Fixed HTLCs hanging indefinitely if the hook function raises an exception. A safe fallback result is now returned instead.
2020-09-10 10:27:24 +09:30
Christian Decker 3d6c4e93b3 pytest: Add a test to reproduce #3748 2020-09-10 10:27:24 +09:30
Michael Schmoock 160c564e5f fix: suppress duplicated channel_state_changed events 2020-09-10 10:24:06 +09:30
Michael Schmoock ddc759c49e test: plugin channel_state_changed notification 2020-09-10 10:24:06 +09:30
Michael Schmoock 218a9efaec pyln-testing: add get_channel_id helper 2020-09-10 10:24:06 +09:30
Michael Schmoock 45a0e049e3 doc: plugin channel_state_changed 2020-09-10 10:24:06 +09:30
Michael Schmoock d86855d1f7 feat: adds channel_state_changed notification
This notification will be raised whenever a channel state changes.
The payload includes the channel and peer identifiers and the
old and the new state.

Example payload:

```
{
    "channel_state_changed": {
        "peer_id": "03bc9337c7a28bb784d67742ebedd30a93bacdf7e4ca16436ef3798000242b2251",
        "channel_id": "a2d0851832f0e30a0cf778a826d72f077ca86b69f72677e0267f23f63a0599b4",
        "short_channel_id" : "561820x1020x1",
        "old_state": "CHANNELD_NORMAL",
        "new_state": "AWAITING_UNILATERAL"
    }
}
```

Changelog-Added: Plugins: channel_state_changed notification
2020-09-10 10:24:06 +09:30
Antoine Poinsot b80ad95f1c channel_control: fix an use-after-free
As the cmd gets freed on a received error, the node id in which we iterate in `process_check_funding_broadcast`
may gets freed while we are using it.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-09-10 10:23:35 +09:30
Antoine Poinsot 2a9e847055 tools: remove headerversions.o on clean
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-09-10 10:23:35 +09:30
Michael Schmoock dd60332d91 chore: adds experimental wiregen to gitignore
Changelog-None
2020-09-09 20:46:46 +09:30
Rusty Russell c76cfe9c5c Makefile: fix typo which can cause build failures.
And add secp_recovery to headers, while we're at it.

```
./wire/wire.h:7:10: fatal error: secp256k1_recovery.h: No such file or directory
 #include <secp256k1_recovery.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:254: recipe for target 'connectd/test/run-initiator-success.o' failed
make: *** [connectd/test/run-initiator-success.o] Error 1
m
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-09 20:44:22 +09:30
Moller40 4d672077e1 Avoid compile error on macos mojave
Fixing the following error by changing 'enum feerate' to int.

lightningd/bitcoind.c:183:29: error: result of comparison of constant
8 with expression of type 'enum feerate' is always true [-Werror,
-Wtautological-constant-out-of-range-compare]
        for (enum feerate f = 0; f < NUM_FEERATES; f++) {

Changelog-Fixed: compile error on macos
2020-09-09 20:43:27 +09:30
ZmnSCPxj jxPCSnmZ c6186829df tests/test_wallet.py: Simple multiwithdraw tests. 2020-09-09 20:36:08 +09:30
ZmnSCPxj jxPCSnmZ 277ff0f44c plugins/spender/multiwithdraw.c: Implement multiwithdraw command.
Fixes: #2679

Changelog-Added: JSON-RPC: New `multiwithdraw` command to batch multiple onchain sends in a single transaction.  Note it shuffles inputs and outputs, does not use BIP69.
2020-09-09 20:36:08 +09:30
ZmnSCPxj jxPCSnmZ 5d7178d488 bitcoin/psbt.c: Add psbt_insert_output function. 2020-09-09 20:36:08 +09:30
ZmnSCPxj jxPCSnmZ e04febfe0c plugins/spender/: New plugin that will eventually absorb all onchain-spending commands. 2020-09-09 20:36:08 +09:30
Christian Decker 210734f1b6 docs: Update the repro-build docs to the new docker-based system
Changelog-Added: New reproducible build system now uses docker: try it at home with `doc/REPRODUCIBLE.md`!
2020-09-09 20:22:42 +09:30
Christian Decker 70cbdbb363 release: Use correct version name and automatically add the link
The template was using the version with the `v` prefix, whereas the
repro-build script is searching for the version without the prefix
2020-09-09 20:22:42 +09:30
Christian Decker fb4f4bff46 repro: Add config for ubuntu:20.04 2020-09-09 20:22:42 +09:30
Christian Decker c7f5889a32 pytest: Skip test_sign_and_send_psbt for elements
This test is flaky because the generated PSBT seems to not have the change
output adjusted, or it is missing.

Tracking-Issue: ElementsProject/lightning#3998
2020-09-09 20:17:26 +09:30
Christian Decker 0260a4d212 pytest: Skip test_feerates for elements 2020-09-09 20:17:26 +09:30
Christian Decker d46d82eeff pyln-testing: Allow up to 1000 connections to postgresql in tests
This was causing some errors when testing with a lot of parallelism (30+ tests
in parallel)
2020-09-09 20:17:26 +09:30
Christian Decker 0923215834 travis: Add dependencies to cache
These are just the elementsd and bitcoind binaries
2020-09-09 20:17:26 +09:30
Christian Decker d13a5b6f3a travis: Make download of elementsd and bitcoind quiet 2020-09-09 20:17:26 +09:30
Christian Decker cec755f796 travis: Compact heavy-weight valgrind tests and add two new configs
Adding test support for elementsd and for postgres.
2020-09-09 20:17:26 +09:30
Christian Decker 02353912d3 travis: Add support for network and db overrides in the test configs 2020-09-09 20:17:26 +09:30
Christian Decker 15adb914a3 travis: Add postgresql libraries as dependencies 2020-09-09 20:17:26 +09:30
Vincenzo Palazzo 5679ea25f3 Fixed doc refused introduced inside the PR #4010
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2020-09-09 20:12:57 +09:30
niftynei b44e36b99e spec-update: get rid of max-witness-len
We can use a fixed value and close the channel if they don't cover their
amount; this wasn't really helping with anything other than setting a
floor for an expected feerate
2020-09-09 19:54:20 +09:30
niftynei 586b9aa742 spec-update: handle tx_signatures in channeld (accepter side only,really) 2020-09-09 19:54:20 +09:30
niftynei aef5a5a0e5 psbt: psbt_has_serial_id -> psbt_find_serial_id
Cleans up some awkward spots in the code, makes the footprint a bit
neater

Suggested-By: @rustyrussell
2020-09-09 19:54:20 +09:30
niftynei c50f377a85 psbt: pull out changeset logic into common, update API
Greatly simplify the changeset API. Instead of 'diff' we simply generate
the changes.

Also pulls up the 'next message' method, as at some point the
interactive tx protocol will be used for other things as well
(splices/closes etc)

Suggested-By: @rustyrussell
2020-09-09 19:54:20 +09:30
niftynei 5cd06227d7 build: exclude dualopend from non-experimental builds 2020-09-09 19:54:20 +09:30
niftynei 303263d381 psbt: clean up interface for setting metadata on PSBT inputs
it's just neater if it's not all wrapped up together, simplifies the
interface a smidge
2020-09-09 19:54:20 +09:30
niftynei 169b7817dc psbt: only compare a subset of psbt input/output fields
At some point, it's ok to add more extra info to a psbt and still not
have that be counted as 'diff'd.
2020-09-09 19:54:20 +09:30
niftynei b3cbb0b653 tests: plugin for dual-funding tests in ln-prototest
FIXME: requires wallycore
2020-09-09 19:54:20 +09:30
niftynei 8d429ecd06 df: add needed info to any PSBT we produce
dual funding needs the max-witness-len and utxo fields set for every
input. we should add them when we create a 'fundpsbt', so that every
psbt that c-lightning generates is dual-funding ready
2020-09-09 19:54:20 +09:30
niftynei 9c89184c1f dualfund: add feature flag for dual-funding
turn off until we're ready to test both sides
2020-09-09 19:54:20 +09:30
niftynei 59525853ae dual-fund: accepter side implementation on lightningd
wherein we add the dual_open_control functions
2020-09-09 19:54:20 +09:30
niftynei d6558deaa4 opening: pass two messages to channeld to send to peer
v2 of channel establishment, in the accpeter case, now sends 2 messages
to our peer after saving the information to disk (our commitment
signatures and our funding transaction signatures)
2020-09-09 19:54:20 +09:30
niftynei 0643945967 peer-control: send set of messages to start, not just one
The accepter has to send 2 messages over to channeld to send at start --
their commitment_signatures and tx_signatures
2020-09-09 19:54:20 +09:30
niftynei cafdbbcd2d dualopend: new `dualopend` daemon, containing most of accepter side
oof. needs validation.
2020-09-09 19:54:20 +09:30
niftynei 05a6a11860 dual-fund: add interactive dual-funding wires
imported from ??? TODO: FIXME
niftynei/lightning-rfc:nifty/interactive-dual-funding
2020-09-09 19:54:20 +09:30
niftynei 42a38b9808 channel_id: add v2 channel_id derivtion helper
v2 of channel open uses the channel revocation basepoints to calculate
the channel_id, instead of the funding_txid + outnum

Moving away from the funding_txid opens the way for splicing + rbf
2020-09-09 19:54:20 +09:30
niftynei 72a098a4ad openingd: pull out check_configs into a common place
We'll re-use it for dualopend!
2020-09-09 19:54:20 +09:30
niftynei 6607f1d629 openingd: pull out common code, rename some things
We're going to reuse all this code for dualopend, which is coming soon.
2020-09-09 19:54:20 +09:30
niftynei 864f2f3e21 channel_id: save to database, dont derive from funding_txid
v2 channel open uses a different method to derive the channel_id, so now
we save it to the database so that we dont have to remember how to
derive it for each.

includes a migration for existing channels
2020-09-09 19:54:20 +09:30