Matt Corallo
662485a4dd
Use new ChannelError in funding_locked, filling out more handling
2018-09-30 20:05:39 -04:00
Matt Corallo
625e2b3532
Use new ChannelError type in accept_channel
2018-09-30 20:05:39 -04:00
Matt Corallo
aa2021dff5
Introduce a Channel-specific Err type and return it in a few places
...
This is way simpler than writing out the whole ErrorAction mess and
we can just convert it as appropriate in ChannelManager.
2018-09-30 20:05:38 -04:00
Matt Corallo
6c1123cafd
Merge pull request #199 from TheBlueMatt/2018-09-184-fixed-monitor
...
Fix simple to_local revoked output claim and rebase #184
2018-09-29 21:09:50 -04:00
Matt Corallo
af29adcfdc
Macro-out checking a tx validly spends another (and add one more)
2018-09-29 20:28:15 -04:00
Antoine Riard
09831934d1
Test htlc outputs single tx claim due to timeout case
2018-09-29 20:28:15 -04:00
Antoine Riard
a805567683
Test htlc outputs shared tx claim case
2018-09-29 20:28:15 -04:00
Matt Corallo
ae8bd1ba48
Fix and test simple remote-revoked-commitment-output claiming
2018-09-29 20:27:05 -04:00
Matt Corallo
1d1c5da13d
Add 2-inbound-in-flight update_fee test (that we wouldn't generate)
2018-09-29 20:01:36 -04:00
Matt Corallo
b9a155d75f
Annotate test_update_fee to make events more clear
2018-09-29 20:01:36 -04:00
Matt Corallo
3833cc3736
Add test for out-of-order update_fee commitment_signed/RAA
2018-09-29 20:01:36 -04:00
Matt Corallo
3f0bc24f1e
Add test for send_commitment pending non-committed feerate updates
2018-09-29 20:01:36 -04:00
Matt Corallo
75f6804fc4
Note that update_fee is likely not gonna be our final API
2018-09-29 20:01:36 -04:00
Yuntai Kyong
a610e275c6
Add update_fee tests
2018-09-29 20:01:32 -04:00
Yuntai Kyong
f1ca469e9f
Expose updating fee on an individual channel
2018-09-29 19:58:09 -04:00
Yuntai Kyong
1dbc6fb0ef
Implement update_fee handling
2018-09-29 19:58:08 -04:00
Matt Corallo
2b9ee0995f
Macro out one-monitor-added check in network tests (thanks @yuntai)
...
Originally suggested by Yuntai Kyong <yuntai.kyong@gmail.com> in
some new tests.
2018-09-29 17:05:43 -04:00
Matt Corallo
2d33b92381
Macro out getting payment_preimage/hash in network tests
2018-09-29 17:05:43 -04:00
Matt Corallo
8d706789e7
Avoid double-panic in ChannelManager when tests fail
2018-09-28 18:55:31 -04:00
Matt Corallo
28e67db327
Handle temporary_channel_id collision in fuzztarget mode
2018-09-26 11:06:28 -04:00
Matt Corallo
6e1318b0e2
Make docs look nicer by adding explicit spacing
2018-09-20 12:58:10 -04:00
Matt Corallo
c43e535bc0
Simplify DecodeError enum by removing some useless distinctions
2018-09-20 10:46:12 -04:00
Matt Corallo
3aeec96470
Add module and all-pub-things docs and deny missing docs
2018-09-19 23:07:02 -04:00
Matt Corallo
da6171d50d
Remove fuzz channel_target.
...
It has bitrotted a lot and doesn't really make sense given all the
precondition enforcement that is in channelmanager, sadly.
2018-09-19 22:47:07 -04:00
Matt Corallo
c91f72c131
Drop MsgEncodable in favor of default fns on Writeable
2018-09-16 14:33:50 -04:00
Matt Corallo
8c460c1239
Remove uses of MsgDecodable from ChannelManager
2018-09-16 14:33:50 -04:00
Matt Corallo
c003d043de
Add a simple channel_reestablish test
2018-09-15 10:53:16 -04:00
Matt Corallo
28c5f6f309
Track peer-disconnection in Channel and handle channel_reestablish
2018-09-15 10:53:16 -04:00
Matt Corallo
12a50627a3
Add channel_reestablish + peer_connected events to channel handler
2018-09-15 10:53:16 -04:00
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