Matt Corallo
5fe598c073
Drop channels on disconnection if we haven't funded them yet
2018-09-15 10:53:16 -04:00
Matt Corallo
f55f055b4e
Remove/fail uncommitted HTLCs upon peer disconnection
2018-09-15 10:53:16 -04:00
Matt Corallo
2be7eda3b5
Merge pull request #179 from TheBlueMatt/2018-09-pre-178-cleanups
...
Pre-reconnect ChannelManager test cleanups
2018-09-15 10:50:57 -04:00
Yuntai Kyong
4e4fa56e2b
unwrap channel.get_open_channel
2018-09-15 07:33:20 +09:00
Matt Corallo
5737b32424
Split claim and fail payment functions to be able to skip one hop
2018-09-14 16:24:30 -04:00
Matt Corallo
4f36f379e7
Move all-events check into framework instead of per-test
2018-09-14 16:24:30 -04:00
Matt Corallo
9252ddbb1d
Remove unused import and uneccessary mut
2018-09-14 16:24:30 -04:00
Matt Corallo
68be3c0353
Test that we do not fail-backwards HTLCs that the remote on-chained
2018-09-14 15:27:54 -04:00
Matt Corallo
f48fe4bd8c
Make the commitment signed dance a macro in ChannelManager tests
2018-09-14 15:27:53 -04:00
Matt Corallo
a55355e641
Ignore HTLC txn we dont know how to claim instead of unwrap()ing
...
This fixes a crash introduced in 3e149b1fb6
and introduces a test which will tickle the bug.
2018-09-14 15:27:39 -04:00
Matt Corallo
66d5d764aa
Clean up and clarify tx broadcast checks in channelmonitor tests
...
This effecitlvey reverts the refactors in 383bd90a48
,
however keeps the actully new test code.
It also writes documentation for the super confusing tx test func
and makes it a bit less permissive.
2018-09-13 14:24:37 -04:00
Matt Corallo
01c8e4f56f
Merge pull request #163 from ariard/claim_revoked_htlc_tx
...
Implement claiming of revoked HTLC transactions by ChannelMonitor
2018-09-13 13:53:47 -04:00
Yuntai Kyong
ec743351b1
raise APIError from send_payment
...
add APIError::RouteError
2018-09-13 11:18:03 -04:00
Antoine Riard
383bd90a48
Add test of claiming HTLC-Timeout outputs based on a revoked commitment
...
tx
2018-09-12 23:51:02 +00:00
Matt Corallo
0a65255bd9
Add simple test for duplicate-payment_hash HTLC tracking
2018-09-12 11:15:51 -04:00
Matt Corallo
6b3cc8bb4d
Avoid cross-test statics in ChannelManager network tests
2018-09-12 11:15:51 -04:00
Matt Corallo
da5d707f49
Allow duplicate-payment_hash HTLCs for HTLC forwards
...
This is required by BOLT 2 to ensure that no attacker can simply
relay every public node a duplicate-payment_hash HTLC for each HTLC
it receives to deduce where an HTLC came from.
Note that this makes the claim logic much less incentive-compatible
as we will not claim all available HTLCs with the same payment_hash
even if we know the preimage! This is OK because, most likely, any
attackers trying to map the network will use small-value payments
and, hopefully, we will move away from constant hashes across an
entire payment at some point in the near future.
This further simplifies the payment transition state a bit, so
hopefully at least we got some readability out of all of this
2018-09-12 11:15:47 -04:00
Matt Corallo
33fa278f33
Do not allow sending HTLCs when the first hop is disconnected
2018-09-09 11:36:00 -04:00
Antoine Riard
4b9adea006
Add registration of commitment tx's outputs from
...
check_spend_remote_transaction
Fixup more descriptive var names by Matt Corallo <git@bluematt.me>
2018-09-08 02:30:28 +00:00
Antoine Riard
f1a26e6aea
Refactor handle_update_fee to wrapper error handling function
2018-09-07 21:59:45 +00:00
Antoine Riard
d6726d6f26
Refactor handle_revoke_and_ack to wrapper error handling function
2018-09-07 21:57:06 +00:00
Antoine Riard
88e561be85
Refactor handle_commitment_signed to wrapper error handling function
2018-09-07 21:51:58 +00:00
Antoine Riard
5662edaf9f
Refactor handle_update_fail_malformed_htlc to wrapper error handling function
2018-09-07 21:46:47 +00:00
Antoine Riard
8544d6f9dd
Refactor handle_update_fail_htlc to wrapper error handling function
2018-09-07 21:42:07 +00:00
Antoine Riard
27869ad0ce
Refactor handle_update_fulfill_htlc to wrapper error handling function
2018-09-07 21:36:55 +00:00
Antoine Riard
321534020e
Refactor handle_update_add_htlc to wrapper error handling function
2018-09-07 21:30:00 +00:00
Antoine Riard
699fb3b64e
Refactor handle_closing_signed to wrapper error handling function
2018-09-07 21:21:05 +00:00
Antoine Riard
4b5b48cb57
Refactor handle_shutdown to wrapper error handling function
2018-09-07 03:10:10 +00:00
Antoine Riard
8dfc3c34bc
Refactor handle_funding_locked to wrapper error handling function
2018-09-07 02:58:01 +00:00
Antoine Riard
cdbd7ce71d
Refactor handle_funding_signed to wrapper error handling function
2018-09-07 02:45:07 +00:00
Antoine Riard
e67b715e52
Refactor handle_funding_created to wrapper error handling function
2018-09-06 11:07:44 -04:00
Matt Corallo
a7ad65b21f
Merge pull request #151 from ariard/channel_manager_refactor
...
Refactor handle_accept_channel to wrapper error handling function
2018-09-06 10:45:41 -04:00
Antoine Riard
8c2f0c31d6
Refactor handle_accept_channel to wrapper error handling function
2018-09-06 10:44:23 -04:00
Matt Corallo
3f5f3def63
Add further clarification TODO in finish_force_close_channel
2018-09-05 20:32:16 -04:00
Matt Corallo
8e4c062f1b
Document+check commitment_signed generation success on send_htlc
...
Because we don't have an HTLCState for
update_add_htlc-generated-but-not-yet-commitment_signed to simplify
the mess of HTLCState match arms, any time a Channel::send_htlc
call returns Ok(Some(_)) we MUST call commitment_signed and it MUST
return success (or close the channel). We mention this in the docs
and panic if its not met in ChannelManager (which lets the fuzz
tester check this).
2018-09-05 19:47:01 -04:00
Matt Corallo
91b23a0754
Reject rumors of channels that are from one node back to itself
2018-09-04 22:56:25 -04:00
Matt Corallo
a71abac55a
Move announcement_signatures handling into new force-close macro
...
Because we've separated out channel closure from ErrorMessage
returning we can return error messages in a few additional cases,
like if the peer sent us a message for a channel they didn't own.
2018-09-04 20:27:58 -04:00
Matt Corallo
2202d139c1
Simplify secp_call! macro in ChannelManager
2018-09-04 20:27:58 -04:00
Matt Corallo
8c709d1b6f
Dont return an Err from Channel::get_accept_channel that can't fail
2018-09-04 20:27:55 -04:00
Antoine Riard
4afbc12568
Refactor handle_open_channel to wrapper error handling function
...
Original version is from Antoine Riard <ariard@student.42.fr>,
the error type and some return type fixes are from
Matt Corallo <git@bluematt.me>
2018-09-04 20:19:13 -04:00
Matt Corallo
c578e4a346
Add ChannelManager-specific HandleError type and macro to use it
...
Original macro is from Antoine Riard <ariard@student.42.fr>,
the error type and additional mappings are from
Matt Corallo <git@bluematt.me>
2018-09-04 20:19:07 -04:00
Matt Corallo
cd9d680986
Merge pull request #145 from TheBlueMatt/2018-09-134-rebased
...
#134 rebased
2018-09-03 18:10:51 -04:00
Matt Corallo
5fb2cc4699
Merge pull request #143 from TheBlueMatt/2018-08-announcement_sigs_erroraction
...
Ensure handle_announcement_signatures always has a ErrorAction
2018-09-03 17:44:57 -04:00
Antoine Riard
4b4d8b6b9e
Add test_invalid_channel_announcemnt + test utilities
...
Fix typo
2018-09-03 17:40:12 -04:00
Antoine Riard
2079fe4ad2
Add ChainWatchInterface in Router
2018-09-03 17:40:05 -04:00
Yuntai Kyong
92274c8800
Remove code fragments with no effect
2018-09-02 21:45:44 +09:00
Matt Corallo
c531cb4faa
Ensure handle_announcement_signatures always has a ErrorAction
2018-08-31 17:00:44 -04:00
Matt Corallo
1661d3c6cb
Add ErrorAction in secp Error -> HandleError conv in ChannelManager
2018-08-31 17:00:43 -04:00
Matt Corallo
3fbbd9e8d2
Remove unused feeest field in ChannelManager tests
2018-08-30 15:11:16 -04:00
Matt Corallo
9902fce585
Correct excess-data handling in ChannelUpdate
2018-08-29 18:01:15 -04:00