Rusty Russell
b460590278
plugins: detect and fixup old relative paths.
Note that we move adding the plugin to the plugins list to the end, otherwise
the hook from logging can examine the (uninitialized) plugin.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
5 years ago
Rusty Russell
4fcd94a091
pytest: use absolute paths for plugin arguments.
We're going to change this in the next patch.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
5 years ago
ZmnSCPxj
3e74ca4b86
gossipd/routing.c: Correctly handle a duplicated entry in `exclude` of `getroute`.
5 years ago
ZmnSCPxj
a5fb37298c
tests/test_gossip.py: Add test to check that duplicated exclusions in `getroute` have no lasting effect.
5 years ago
trueptolemy
5ac02907bb
pytest: Add the test for 'forward_event' in test_plugin
6 years ago
trueptolemy
d2423c6f9a
pytest: Add a simple plugin to test 'forward_event'
6 years ago
Rene Pickhardt
dbc0265a5d
added mako dependency to tests/requirements.txt
this should partially fix #2879
this dependency seems to be needed in `tools/generate-wire.py`
5 years ago
Rusty Russell
79d32ec2f2
plugin: notice when plugin has *started* configuring.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
5 years ago
Rusty Russell
df8a6f615b
pytest: test for crash when we do a plugin op and a plugin has not finished init
We try to start it twice, with predictable hilarious results:
DEBUG plugin-manager started(20701) /home/rusty/devel/cvs/lightning/tests/plugins/slow_init.py
DEBUG lightningd(20670): Adding block 101: 0f26301caaae390d1b956c3eb73827d1f87a2af306561348045bf1313b7551b0
INFO plugin-slow_init.py slow_init.py initializing
DEBUG plugin-manager started(20704) /home/rusty/devel/cvs/lightning/tests/plugins/slow_init.py
**BROKEN** lightningd(20670): FATAL SIGNAL 6 (version v0.7.1-146-g7d3b352-modded)
**BROKEN** lightningd(20670): backtrace: common/daemon.c:45 (send_backtrace) 0x55a29c3ec539
**BROKEN** lightningd(20670): backtrace: common/daemon.c:53 (crashdump) 0x55a29c3ec589
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0x7fa281ebcf5f
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0x7fa281ebced7
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0x7fa281e9e534
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0x7fa281e9e40e
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0x7fa281eae011
**BROKEN** lightningd(20670): backtrace: lightningd/json_stream.c:225 (json_stream_output_) 0x55a29c3bff5f
**BROKEN** lightningd(20670): backtrace: lightningd/plugin.c:383 (plugin_write_json) 0x55a29c3e103f
**BROKEN** lightningd(20670): backtrace: ccan/ccan/io/io.c:59 (next_plan) 0x55a29c43316b
**BROKEN** lightningd(20670): backtrace: ccan/ccan/io/io.c:435 (io_do_always) 0x55a29c433df1
**BROKEN** lightningd(20670): backtrace: ccan/ccan/io/poll.c:300 (handle_always) 0x55a29c435865
**BROKEN** lightningd(20670): backtrace: ccan/ccan/io/poll.c:377 (io_loop) 0x55a29c435b3d
**BROKEN** lightningd(20670): backtrace: lightningd/io_loop_with_timers.c:24 (io_loop_with_timers) 0x55a29c3bdfcf
**BROKEN** lightningd(20670): backtrace: lightningd/lightningd.c:830 (main) 0x55a29c3c44b6
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0x7fa281e9fb6a
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0x55a29c3ac0f9
**BROKEN** lightningd(20670): backtrace: (null):0 ((null)) 0xffffffffffffffff
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
5 years ago
darosior
307fb0708e
lightningd/plugin_control: don't control non-dynamic plugins
6 years ago
darosior
9ddc2e0334
Add the 'plugin' subcommands to pylightning and add a test for them
6 years ago
darosior
2683170da8
Test and document 'channel_opened' notification
6 years ago
Simon Vrouwe
af7044d09d
pytest: test_fee_limits, add case where opening channel is denied when feerate is too low
6 years ago
darosior
34533ead68
Plugins: Add a test for the 'invoice_payment' notfication
6 years ago
Rusty Russell
d59e2b1b4b
developer: add --dev-force-bip32-seed to force a specific BIP32 seed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
fb6870c139
param: implement helpers for multiplex commands.
Our previous param support was a bit limited in this case.
We create a dev- command multiplexer, so we can exercise it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Christian Decker
53488e5739
pytest: Strengthen the htlc_accepted tests
We were having a few issues with malformed data in the past, so this time we
really check that stuff.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
6 years ago
Rusty Russell
789d14299b
pytest: mix up order of cancel vs complete in test_funding_cancel_race
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
ee8edfe6a6
pytest: severely reduce scope of test_funding_cancel_race under valgrind.
Otherwise we get timeouts across the board.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
280bd60988
lightningd: allow multiple cancels on a single fundchannel command.
Instead of taking over the ->cmd pointer, append ourselves to a list
of cancels. This fixes the test_funding_cancel_race.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
13dbe6e74b
pytest: stress test funding_cancel vs funding_complete
This fails, because they fight over the fc->cmd pointer, leaving
others hanging.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
54ce4ed1cf
pytest: fail tests if we get any LOG_BROKEN level messages, unless flagged.
And clean up some dev ones which actually happen (mainly by calling
channel_fail_permanent which logs UNUSUAL, rather than
channel_internal_error which logs BROKEN).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
5f02294b5b
lightningd/log: prefix log messages with level.
In particular, this lets us spot UNUSUAL and BROKEN messages easily.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Christian Decker
915c932e2d
pytest: Make sure the channels entries don't get deleted anymore
Signed-off-by: Christian Decker <@cdecker>
6 years ago
Rusty Russell
c303d7d534
gossipd: only do (automatic) store compaction at startup.
Rewriting the gossip_store is much more trivial when we don't have
any pointers into it, so add some simple offline compaction code
and disable the automatic compaction code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
c15d9ed37c
gossip_store: make copy of corrupt gossip_store on failure.
This should help debugging vastly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
8928f0b5f9
gossipd: remove gossip entirely if we hit a problem on load.
The crashes in #2750 are mostly caused by us trying to partially truncate
the store. The simplest fix for release is to discard the whole thing if
we detect a problem.
This is a workaround: it'd be far nicer to try to recover.
Fixes : #2750
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
9bf0467967
pytest: fix test_gossip_store_load_no_channel_update
It wasn't invalid due to a missing channel_update, but in fact was a
bad checksum due to a cut & paste bug. Fix that, and assert it's not
actually truncating.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
47b5f2e837
gossipd: truncate gossip_store.tmp for compaction.
If something went wrong and there was an old one, we were
appending to it!
Reported-by: @SimonVrouwe
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
lisa neigut
92bd3a3587
connect test: use wait_for_log in test_funding_external_wallet
test_funding_external_wallet is flakey because we don't wait for
the channel state to update before asserting that it's changed.
6 years ago
Rusty Russell
5e3690b3c5
gossipd: delete channel_amount from the store when we delete channel_announcement.
Otherwise we slowly build up cruft: compaction simply moves them since
they're not deleted.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
10c503b4b4
gossip_store: clean up a truncated store.
We might have channel_announcements which have no channel_update: normally
these don't get written into the store until there is one, but if the
store was truncated it can happen. We then get upset on compaction, since
we don't have an in-memory representation of the channel_announcement.
Similarly, we leave the node_announcement pending until after that
channel_announcement, leading to a similar case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
adc52b6ee8
pytest: add test for dangling channel_announcement/node_announcement after gossip_store.
This can happen if the store was truncated.
Reported-by: @jb55
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
a35ab51a06
pytest: gossip_store test for channel_amount truncated.
We pass, but this test should have been added a while ago with the
original code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
909f22f117
pytest: gossip_store test for node_announcement before update.
We pass, but this test should have been added a while ago with the fix.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
eb5cc47bdd
gossipd: count deleted records correctly when loading gossip_store.
The result of an incorrect count was that we failed on next compaction.
Fixes : #2743
Fixes : #2742
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
12a523f7c5
pytest: add (xfail) test for store load miscount.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
lisa neigut
c00e0d2936
funding: rename fundchannel_continue -> _complete
Renaming. "complete" more accurately describes what we're doing here.
6 years ago
lisa neigut
3ae78a61fa
tests: finish up test for external funding flow
Add to test for fundchannel with composing and broadcasting
an external transaction.
6 years ago
lisa neigut
5aad642c59
opening: add fundchannel_cancel command
Provide the option to cancel a funding-opening with a peer.
Must either call `fundchannel_cancel` or `fundchannel_continue`
6 years ago
lisa neigut
7ea21c36b1
fundchannel: add txout field to RPC/API
We'll need the outpoint for the funding output.
6 years ago
lisa neigut
b0b813a171
test: add initial tests for starting an external fundchannel
Test for getting through the address generation portion.
6 years ago
lisa neigut
1b2a593b05
tests: default all addresses to bech32
Needed for composing a transaction externally to c-lightning, using
bitcoind util.
6 years ago
Rusty Russell
d817735dc2
lightningd: use ccan/json_out.
This is now a fairly simple transition, which only effects the internals
of json_stream.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
26cdf9d3dc
plugins/pay: don't retry routehint if it contains already-eliminated channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
260febd88b
plugins/pay: fix attempt counter on failure message.
An "attempt" is when we actually try to send, not every route lookup
we do.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
0d2a4830ed
ccan: update to faster and correct crc32c implementation.
I decided to try a faster implementation, only to find our crc32c was
not correct! Ouch.
I removed the crc32c functions from ccan/crc, and added a new crc32c
module which has the Mark Adler x86-64-optimized variants.
We bump gossip_store version again, since csums have changed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
darosior
2436214145
fundchannel: Add some tests to fund channels by utxos
6 years ago
Rusty Russell
db22d2ba9a
pytest: simplify and annotate test_channel_drainage.
Remove gratuitous prints, add explanations of what's going on,
and demonstrate that we can add a final trimmed HTLC but not
a non-trimmed one.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
431401ad35
channeld: don't subtract both reserves from advertized htlc_max.
Subtracting both arbitrarily reduces our capacity, even for ourselves
since the routing logic uses this maximum.
I also changed 'advertise' to 'advertize', since we use american
spelling.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago