Commit graph

755 commits

Author SHA1 Message Date
Antoine Riard
e22220d79f Add test_claim_on_remote_sizeable_push_msat
Contrary to sizeable push_msat on local
commitment tx, the output go to a P2WPKH
2018-11-19 20:42:52 -05:00
Antoine Riard
1255885a80 Add check_spend_closing_transaction ChannelMonitor
Aims to send back closing output descriptor to user wallet
2018-11-19 20:40:07 -05:00
Antoine Riard
3518f1f85d Add test_static_spendable_outputs_preimage_tx
Aims to covered both keysinterace preimage tx case and
detection of second remote commitment tx

Split DynamicDescriptor between *P2WSH and *P2WKH
2018-11-19 20:39:38 -05:00
Matt Corallo
3a066ccbf2 Ensure fuzz release builds use codegen-units=1 and LTO 2018-11-18 16:17:06 -05:00
Matt Corallo
e67d8c6314 Don't unwrap() get_channel_update result in HTLC router
This fixes a bug in 78232f2aed found
by fuzzer - if the channel isn't yet fully established we will call
get_channel_update(), get an Err result, and then unwrap() it. If
this actually happens it means someone on the network is making up
short_channel_ids and trying to route over them, but that shouldn't
result in us crashing
2018-11-18 16:17:06 -05:00
Matt Corallo
b4fc5b65e0 Fix pre-noise peer disconnect panic on non-Err disconnect
366e79615b fixed the same crash for
Errs that come up during handshake, but was incomplete and should
have just dropped the node_id being different based on
inbound/outbound. This patch does so and actually fixes the issue.

Found by fuzzer.
2018-11-18 12:59:02 -05:00
Matt Corallo
b14baa03ab
Merge pull request #253 from TheBlueMatt/2018-11-misc-tweaks
Misc Tweaks
2018-11-16 11:47:50 -05:00
Antoine Riard
1b33064554 Split provide_their_next_commitment_point from provide_secret
We needed it to be able to track remote_per_commitment_point
after channel opening and funds locking
2018-11-15 19:08:27 -05:00
Antoine Riard
f053169363 Add test_claim_sizeable_push_msat
Aims to cover both claiming of sizeable_push_msat and
spendable output generation for to_local output
2018-11-15 19:08:27 -05:00
Antoine Riard
f88f826b28 Add TxOut in DynamicOutput 2018-11-15 19:07:34 -05:00
Antoine Riard
8c638ffc81 Track local_commitment_tx at funding_created
Goal to claim sizeable push_msat and in event of
local commitment tx being broadcast without htlcs
2018-11-15 19:07:34 -05:00
Antoine Riard
04e6be9f00 Implement spendable output to_local output on local commitment tx 2018-11-15 19:07:34 -05:00
Matt Corallo
2258d2b6d3
Merge pull request #249 from stevenroose/bitcoin-0.15
Update to rust-bitcoin v0.15
2018-11-16 06:37:44 +13:00
Matt Corallo
968720344c Panic if funding transaction has non-witness inputs 2018-11-15 12:25:09 -05:00
Matt Corallo
ed006f5e46 Clarify get_update_*_htlc docs and tweak one case slightly 2018-11-15 12:22:16 -05:00
Matt Corallo
4a697dbdf2 Expand test_funding_peer_disconnect somewhat by being non-symmetric
I thought I found a bug in one-side-funded-first reconnect, but
seems I can't reproduce it here. Either way worth improving the
test coverage.
2018-11-15 12:22:16 -05:00
Philip Robinson
a51dbb4a4d Check affordability of new fee during update_fee call #204 2018-11-14 14:14:10 +02:00
Steven Roose
7ff7561f2d Update to rust-bitcoin v0.15 2018-11-14 11:43:54 +00:00
Matt Corallo
3c44d6beca
Merge pull request #248 from TheBlueMatt/2018-11-monitor-test-split
Split up channel_monitor_network_test a little bit
2018-11-14 09:20:54 +10:30
Matt Corallo
2be7c5debe
Merge pull request #247 from TheBlueMatt/2018-11-202-redux
Handle-initial_routing_sync-requests-from-peers-in-their-Init-messages
2018-11-14 07:18:40 +10:30
Matt Corallo
44f56f84b6 Split up channel_monitor_network_test a little bit 2018-11-09 15:01:53 +10:30
Schalk van Heerden
8d7b498974 Handle-initial_routing_sync-requests-from-peers-in-their-Init-messages 2018-11-09 13:53:13 +10:30
Antoine Riard
fa2ac8cd84 Add test justice tx on revoked htlc_success
Extend channel_monitor_network_test to cover
all check_spend_remote_htlc cases
2018-11-08 02:21:28 +00:00
Matt Corallo
74f59a2177
Merge pull request #242 from yuntai/201811-malformed
Fail channel when BADONION is not set
2018-11-05 16:14:34 -05:00
Yuntai Kyong
05b580e10b fail channel when BADONION is not set. 2018-11-05 21:10:17 +09:00
Matt Corallo
0e098d4bab
Merge pull request #241 from TheBlueMatt/2018-10-peer-free-panic
Fix pre-noise outbound peer disconnect panic found by fuzzer
2018-11-02 23:59:59 -04:00
Matt Corallo
af89de3d86
Merge pull request #233 from TheBlueMatt/2018-10-shutdown-updates
Shutdown Updates
2018-11-02 23:07:54 -04:00
Matt Corallo
182affc03b Test the various shutdown handling updates 2018-11-02 22:26:51 -04:00
Matt Corallo
224fb05cc5 Rebroadcast shutdown on channel_reestablish (and reprocess them) 2018-11-02 22:26:51 -04:00
Matt Corallo
527d036c1b Delay closing_signed until update_fee exchanges complete
See https://github.com/lightningnetwork/lightning-rfc/issues/499
for a bit more about the ambiguity we're addressing here.

Also drop holding cell update_fee the same way we drop holding
cell update_add_htlcs when sending shutdown, resolving a bug.
2018-11-02 22:26:51 -04:00
Matt Corallo
78232f2aed Fail incoming HTLCs sent after we start shutdown, not the chan 2018-11-02 22:26:51 -04:00
Matt Corallo
38584e3efe Avoid double-panic in full_stack_target to assist debugging 2018-11-02 10:54:25 -04:00
Matt Corallo
366e79615b Fix pre-noise outbound peer disconnect panic found by fuzzer
If we make an outbound connection to a peer who we are already
connected to, and the outbound connection fails
pre-noise-completion, we will remove the original peer connection
from our node_id_to_descriptor map.

The fuzzer managed to find this by crashing in Channel's assertions
that we don't do a get_channel_reestablish() when the Channel isn't
already marked disconnected.
2018-11-02 10:50:32 -04:00
Matt Corallo
b030e84ad8 Add logging for (dis)connect in peer_handler/channelmanager 2018-11-02 10:45:29 -04:00
Matt Corallo
a11e27d20e Send closing_signed when appropriate as pending HTLCs clear 2018-11-01 17:08:53 -04:00
Matt Corallo
1993ec0d12 Always send Shutdown resposnes to Shutdown messages
We always require that any changes to Channel state be committed
immediately (within the same lock) so we should never have
uncommitted changes which would prevent us from sending a Shutdown
response.
2018-11-01 17:06:07 -04:00
Matt Corallo
7bb598e525 Refactor out first-closing-sent creation 2018-11-01 17:05:56 -04:00
Matt Corallo
4eb8a4905c Use ChannelError in shutdown handling, clean up, impl err actions 2018-11-01 13:50:03 -04:00
Matt Corallo
11776dbb63 Add warnings reminding users to use SegWit funding inputs 2018-11-01 13:50:03 -04:00
Matt Corallo
d9d8ea3f65
Merge pull request #235 from TheBlueMatt/2018-10-229-redux
Bug fix using same seed sequence for channel key geneartion
2018-10-31 22:44:16 -04:00
Yuntai Kyong
b0f798cfb2 Bug fix using same seed sequence for channel key geneartion 2018-10-31 16:34:51 -04:00
Matt Corallo
827a5255ff
Merge pull request #234 from TheBlueMatt/2018-10-169-redux
169 Tweaked
2018-10-31 16:25:29 -04:00
Schalk van Heerden
a0be4d1758 Added config interface to allow users to specify channel limits 2018-10-31 15:45:30 -04:00
Matt Corallo
9189d0e61d Require at least 1k sat for outbound channels and meet BTC's dust 2018-10-31 15:45:30 -04:00
Matt Corallo
55a74b5dab Use non-funder's funding block wait instead of max with ours
This is both required by the protocol and also makes sense - if
we're the funder we don't mind accepting payment on the channel
after one confirmation because we assume we won't double-spend
ourselves.
2018-10-31 15:45:30 -04:00
Matt Corallo
4d964d4d98
Merge pull request #232 from TheBlueMatt/master
Fix a full_stack_target crash
2018-10-31 15:05:19 -04:00
Matt Corallo
46f573b787 [full_stack_target] don't allow double-confirming txn 2018-10-29 17:16:29 -04:00
Matt Corallo
64bd2eaa7f Give ManyChannelMonitor a logger and trace add_update events 2018-10-29 14:26:05 -04:00
Matt Corallo
b297d5bf76
Merge pull request #226 from TheBlueMatt/2018-10-0.0.6
Bump version to 0.0.6
2018-10-27 10:49:05 -04:00
Matt Corallo
8cc3be9eab
Merge pull request #223 from TheBlueMatt/2018-10-chanmanager-serialize
Implement and document Channel/ChannelManager (de)serialization
2018-10-27 10:46:12 -04:00