Antoine Riard
383bd90a48
Add test of claiming HTLC-Timeout outputs based on a revoked commitment
...
tx
2018-09-12 23:51:02 +00:00
Antoine Riard
3e149b1fb6
Implement claiming of revoked HTLC transactions by ChannelMonitor
...
Refactor check_spend_remote_transaction in part to check_spend_remote_htlc to
avoid lock mess in block_connected. We need
remote_commitment_txn_on_chain to match remote HTLC tx
2018-09-12 23:50:58 +00:00
Antoine Riard
d84c084df7
Implement set_their_delayed_payment_base_key in ChannelMonitor
...
Needed to build redeemscript on HTLC-Success/HTLC-Timeout tx from
remote revoked commitment tx
2018-09-12 23:17:20 +00:00
Matt Corallo
648a31b91a
Merge pull request #171 from TheBlueMatt/2018-09-ser-fixes
...
Correct MAX_BUF_SIZE in serialization
2018-09-12 15:53:14 -04:00
Matt Corallo
d7ed4c63e7
Correct MAX_BUF_SIZE in serialization
...
I think this might have been my fault due to faulty review
feedback, but fuzzer caught trivial crash here where you try to
send a ping message larger than 16KB (but smaller than the
max-length 64KB) and you crash as message serialization is unwrap()
2018-09-12 13:22:42 -04:00
Matt Corallo
c3e225597d
Fix some double-indentation in util/ser
2018-09-12 13:22:42 -04:00
Matt Corallo
f27c74b35c
Merge pull request #167 from TheBlueMatt/2018-09-dup-htlc
...
Allow duplicate-payment_hash HTLCs for HTLC forwards
2018-09-12 13:07:13 -04:00
Matt Corallo
b2f31c5256
Merge pull request #170 from TheBlueMatt/2018-09-119-rebased
...
#119 squashed
2018-09-12 11:22:06 -04: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
Yuntai Kyong
28a612f9f3
Migrate fuzz router/channel target to Readable
...
and be more specific about DecodeError::InvalidValue
2018-09-12 10:19:36 -04:00
Yuntai Kyong
3e89106163
migrate peer_handler to use Writeable
...
added inplace byte_utils
2018-09-12 10:19:36 -04:00
Yuntai Kyong
63cb37d346
Add fuzz targets for Writeable messages/migrate fuzz test
2018-09-12 10:19:36 -04:00
Yuntai Kyong
89475381bb
Implement Writeable for messages
2018-09-12 10:18:52 -04:00
Yuntai Kyong
1b8504a3f3
Implement Writer/Reader
...
with additional variants in DecodeError
2018-09-12 10:18:02 -04:00
Matt Corallo
3b49837862
Split HTLC tracking into separate Inbound/Outbound types
...
This isnt as simplifying as I'd hoped, but still increases
compile-time checking, which is nice, and removes one of two
panic!()s.
2018-09-11 15:02:10 -04:00
Matt Corallo
bde48b2c15
Merge pull request #165 from TheBlueMatt/2018-09-pre-disconnect-misc
...
Further minor misc changes from reconnect work
2018-09-11 15:01:35 -04:00
Matt Corallo
a2d4889e32
panic on invalid calls to Channel::send_commitment instead of Err
2018-09-09 11:36:00 -04:00
Matt Corallo
33fa278f33
Do not allow sending HTLCs when the first hop is disconnected
2018-09-09 11:36:00 -04:00
Matt Corallo
8cad2ffa9b
Sync get_update_fail_htlc, get_update_fulfill_htlc state err result
...
Both get_update_fail_htlc and get_update_fulfill_htlc should never
be called before any HTLC could have been accepted (ie
pre-ChannelFunded) nor should they ever be called
post-ShutdownComplete as the Channel object should be destroyed at
that point. Previously get_update_fulfill_htlc would panic, but
get_update_fail_htlc would return an Err. For now make them both
panic but we can revisit this if we want to have fewer panics in
the future.
2018-09-09 11:36:00 -04:00
Matt Corallo
673912e769
Add force_close_channel call command to full_stack_target
2018-09-09 11:36:00 -04:00
Matt Corallo
f71ff8f0ac
Merge pull request #164 from TheBlueMatt/2018-09-channel-connection-cleanups
...
Minor cleanups
2018-09-09 11:35:42 -04:00
Matt Corallo
e9fed4973b
Disallow duplicate Init messages from peers
2018-09-08 14:43:42 -04:00
Matt Corallo
bf46a5f721
Fix PeerManager::get_peer_node_ids to filter according to docs
2018-09-08 13:59:39 -04:00
Matt Corallo
6dab6b185d
Disconnect duplicate node_id connections after Noise handshake
2018-09-08 13:59:39 -04:00
Matt Corallo
c2bbeb5814
Update add_update_monitor docs to indicate registration req.
...
It wasn't entirely clear from the existing docs that it is the
responsibility of the implementor of ManyChannelMonitor to
register the relevant outpoint.
2018-09-08 10:33:32 -04:00
Matt Corallo
beee006365
Document Channel::get_funding_redeemscript precondition
2018-09-08 10:30:10 -04:00
Matt Corallo
6c07555cad
Merge pull request #159 from ariard/channel_monitor
...
Add registration of commitment tx's outputs from check_spend_remote_transaction
2018-09-08 10:29:29 -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
Matt Corallo
bfb9b46fb2
Refactor/dont re-enter block_conencted on duplicate watch calls
...
Previously we'd hit an infinite loop if a block_connected call
always resulted in the same ChainWatchInterface registrations.
While we're at it, we also split ChainWatchUtil in two to make
things a bit more flexible for users, though not sure if that
actually matters, and make the matching more aggressive in testing,
even if we pick the more performant option at runtime.
2018-09-08 02:30:28 +00:00
Matt Corallo
90b545ffe3
Narrow ChainWatchInterface::install_watch_script
2018-09-08 02:30:28 +00:00
Matt Corallo
68d0fcd12e
Merge pull request #162 from ariard/channel_manager_refactor_all
...
Channel manager refactor all (following & end)
2018-09-07 19:43:08 -04: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
Matt Corallo
6016ca1870
Merge pull request #160 from ariard/channel_manager_refactor_all
...
Channel manager refactor all
2018-09-07 10:19:28 -04:00
Matt Corallo
9d39c9324d
Merge pull request #156 from TheBlueMatt/2018-09-funding_created_action
...
Ensure funding_created always returns Some(_) HandleError::action
2018-09-07 10:14:58 -04: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
Matt Corallo
5adf125f42
Remove unused import in router_target
2018-09-06 12:39:36 -04:00
Matt Corallo
ed650ec530
Ensure funding_created always returns Some(_) HandleError::action
2018-09-06 11:38:48 -04:00
Matt Corallo
6132a8e648
Merge pull request #154 from ariard/funding_created_refactor
...
Refactor handle_funding_created to wrapper error handling function
2018-09-06 11:12:10 -04:00
Antoine Riard
e67b715e52
Refactor handle_funding_created to wrapper error handling function
2018-09-06 11:07:44 -04:00