rust-lightning
5 years agoFix peer_handler message serialization 2018-09-ser-rework
Matt Corallo [Sun, 16 Sep 2018 17:16:43 +0000 (13:16 -0400)]
Fix peer_handler message serialization

Fixes a bug introduced in 3e89106163b941aa4dc4ff92bdb484b7bbcf50c4
where messages were being encoded with their size instead of their
type.
Also utilizes the new size_hinting in peer_handler

5 years agoUtilize Writer size hinting in message fuzz targets and check them
Matt Corallo [Fri, 14 Sep 2018 22:05:13 +0000 (18:05 -0400)]
Utilize Writer size hinting in message fuzz targets and check them

5 years agoAdd size_hint in ser and call size_hint in all message serializers
Matt Corallo [Fri, 14 Sep 2018 21:54:59 +0000 (17:54 -0400)]
Add size_hint in ser and call size_hint in all message serializers

5 years agoSplit out Vec<u8> and Vec<Signature> ser impls cause there's 2
Matt Corallo [Sun, 16 Sep 2018 02:06:13 +0000 (22:06 -0400)]
Split out Vec<u8> and Vec<Signature> ser impls cause there's 2

Should resolve any performance issues with Vec<u8> serialization.

5 years agoSimplify serialization a bit by removing the useless newtypes
Matt Corallo [Fri, 14 Sep 2018 21:50:48 +0000 (17:50 -0400)]
Simplify serialization a bit by removing the useless newtypes

5 years agoExpose (de)serialziers as we'll need them and I don't like warnings
Matt Corallo [Fri, 14 Sep 2018 20:43:47 +0000 (16:43 -0400)]
Expose (de)serialziers as we'll need them and I don't like warnings

5 years agoMerge pull request #178 from TheBlueMatt/2018-09-channel_reestablish
Matt Corallo [Sat, 15 Sep 2018 15:36:59 +0000 (11:36 -0400)]
Merge pull request #178 from TheBlueMatt/2018-09-channel_reestablish

Handle peer disconnect tracking/channel_reestablish

5 years agoConstify 2**48-1 and add some additional comments in Channel 2018-09-channel_reestablish
Matt Corallo [Fri, 14 Sep 2018 19:54:06 +0000 (15:54 -0400)]
Constify 2**48-1 and add some additional comments in Channel

5 years agoAdd a simple channel_reestablish test
Matt Corallo [Thu, 13 Sep 2018 22:19:27 +0000 (18:19 -0400)]
Add a simple channel_reestablish test

5 years agoTrack peer-disconnection in Channel and handle channel_reestablish
Matt Corallo [Sat, 8 Sep 2018 20:02:46 +0000 (16:02 -0400)]
Track peer-disconnection in Channel and handle channel_reestablish

5 years agoAdd a Disconnected ChannelState and check/handle it everywhere
Matt Corallo [Sat, 8 Sep 2018 20:01:29 +0000 (16:01 -0400)]
Add a Disconnected ChannelState and check/handle it everywhere

Setting/removing it comes next

5 years agoAdd channel_reestablish + peer_connected events to channel handler
Matt Corallo [Fri, 7 Sep 2018 19:51:40 +0000 (15:51 -0400)]
Add channel_reestablish + peer_connected events to channel handler

5 years agoClarify update_fail/fulfill_htlc holding cell allowed Errs
Matt Corallo [Tue, 11 Sep 2018 18:27:17 +0000 (14:27 -0400)]
Clarify update_fail/fulfill_htlc holding cell allowed Errs

Specifically, there really should be no Errs, but in case there is
some case where duplicate HTLC removes are possible, return
IgnoreError and debug_assert to see if fuzzing can find them.

5 years agoDrop channels on disconnection if we haven't funded them yet
Matt Corallo [Fri, 7 Sep 2018 19:11:52 +0000 (15:11 -0400)]
Drop channels on disconnection if we haven't funded them yet

5 years agoRemove/fail uncommitted HTLCs upon peer disconnection
Matt Corallo [Wed, 5 Sep 2018 22:32:55 +0000 (18:32 -0400)]
Remove/fail uncommitted HTLCs upon peer disconnection

5 years agoMerge pull request #179 from TheBlueMatt/2018-09-pre-178-cleanups
Matt Corallo [Sat, 15 Sep 2018 14:50:57 +0000 (10:50 -0400)]
Merge pull request #179 from TheBlueMatt/2018-09-pre-178-cleanups

Pre-reconnect ChannelManager test cleanups

5 years agoMerge pull request #183 from yuntai/201809-unwrap-getopenchannel
Matt Corallo [Sat, 15 Sep 2018 14:48:54 +0000 (10:48 -0400)]
Merge pull request #183 from yuntai/201809-unwrap-getopenchannel

unwrap channel.get_open_channel

5 years agounwrap channel.get_open_channel
Yuntai Kyong [Fri, 14 Sep 2018 22:26:03 +0000 (07:26 +0900)]
unwrap channel.get_open_channel

5 years agoSplit claim and fail payment functions to be able to skip one hop 2018-09-pre-178-cleanups
Matt Corallo [Thu, 13 Sep 2018 22:17:56 +0000 (18:17 -0400)]
Split claim and fail payment functions to be able to skip one hop

5 years agoMove all-events check into framework instead of per-test
Matt Corallo [Thu, 13 Sep 2018 22:04:46 +0000 (18:04 -0400)]
Move all-events check into framework instead of per-test

5 years agoSplit up send_commitment into a const and non-const version
Matt Corallo [Sat, 8 Sep 2018 20:00:30 +0000 (16:00 -0400)]
Split up send_commitment into a const and non-const version

5 years agoRemove unused import and uneccessary mut
Matt Corallo [Fri, 14 Sep 2018 20:24:08 +0000 (16:24 -0400)]
Remove unused import and uneccessary mut

5 years agoMerge pull request #180 from TheBlueMatt/2018-09-htlc-tx-unwrap-fix
Matt Corallo [Fri, 14 Sep 2018 20:19:38 +0000 (16:19 -0400)]
Merge pull request #180 from TheBlueMatt/2018-09-htlc-tx-unwrap-fix

Ignore HTLC txn we dont know how to claim instead of unwrap()ing and Do not fail-backwards LocalAnnounced HTLCs upon force-close.

5 years agoTweak + extend full_stack_target sample to incl HTLC tx broadcasts 2018-09-htlc-tx-unwrap-fix
Matt Corallo [Fri, 14 Sep 2018 17:47:46 +0000 (13:47 -0400)]
Tweak + extend full_stack_target sample to incl HTLC tx broadcasts

5 years agoTest that we do not fail-backwards HTLCs that the remote on-chained
Matt Corallo [Fri, 14 Sep 2018 19:19:03 +0000 (15:19 -0400)]
Test that we do not fail-backwards HTLCs that the remote on-chained

5 years agoMake the commitment signed dance a macro in ChannelManager tests
Matt Corallo [Thu, 13 Sep 2018 21:25:59 +0000 (17:25 -0400)]
Make the commitment signed dance a macro in ChannelManager tests

5 years agoDo not fail-backwards LocalAnnounced HTLCs upon force-close.
Matt Corallo [Fri, 14 Sep 2018 17:35:56 +0000 (13:35 -0400)]
Do not fail-backwards LocalAnnounced HTLCs upon force-close.

This is completely unsafe as we have provided the remote side with
a commitment_signed which they can broadcast, including the HTLC
transaction, and then could claim it on-chain after we've failed it
backwards!

5 years agoIgnore HTLC txn we dont know how to claim instead of unwrap()ing
Matt Corallo [Fri, 14 Sep 2018 03:54:15 +0000 (23:54 -0400)]
Ignore HTLC txn we dont know how to claim instead of unwrap()ing

This fixes a crash introduced in 3e149b1fb6624eef99b055bde772842f36
and introduces a test which will tickle the bug.

5 years agoMerge pull request #177 from TheBlueMatt/2018-09-163-cleanups
Matt Corallo [Fri, 14 Sep 2018 00:18:21 +0000 (20:18 -0400)]
Merge pull request #177 from TheBlueMatt/2018-09-163-cleanups

Optimize some ChannelMonitor stuff after #163

5 years agoClean up and clarify tx broadcast checks in channelmonitor tests 2018-09-163-cleanups
Matt Corallo [Thu, 13 Sep 2018 17:51:23 +0000 (13:51 -0400)]
Clean up and clarify tx broadcast checks in channelmonitor tests

This effecitlvey reverts the refactors in 383bd90a481bc146b3a3b1d8,
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.

5 years agoThere can only be one input in matched txn in ChannelMonitor
Matt Corallo [Thu, 13 Sep 2018 15:35:23 +0000 (11:35 -0400)]
There can only be one input in matched txn in ChannelMonitor

This lets us simplify a few tidbits of loop.

5 years agoOptimize check_spend_remote HTLC a tad by avoiding indirections
Matt Corallo [Thu, 13 Sep 2018 15:34:26 +0000 (11:34 -0400)]
Optimize check_spend_remote HTLC a tad by avoiding indirections

Instead of hopping a pointer, we're only ever going to return one
Transaction at max, so skip the Vec. Also avoid
re-pubkey-converting the revocation key.

5 years agoMerge pull request #163 from ariard/claim_revoked_htlc_tx
Matt Corallo [Thu, 13 Sep 2018 17:53:47 +0000 (13:53 -0400)]
Merge pull request #163 from ariard/claim_revoked_htlc_tx

Implement claiming of revoked HTLC transactions by ChannelMonitor

5 years agoMerge pull request #175 from TheBlueMatt/2018-09-173-whitespace-err
Matt Corallo [Thu, 13 Sep 2018 17:11:51 +0000 (13:11 -0400)]
Merge pull request #175 from TheBlueMatt/2018-09-173-whitespace-err

raise APIError from send_payment (#173 without whitespace nit)

5 years agoraise APIError from send_payment 2018-09-173-whitespace-err
Yuntai Kyong [Wed, 12 Sep 2018 20:23:12 +0000 (05:23 +0900)]
raise APIError from send_payment

add APIError::RouteError

5 years agoMerge pull request #174 from yuntai/201809-funding_created_sig
Matt Corallo [Thu, 13 Sep 2018 14:31:06 +0000 (10:31 -0400)]
Merge pull request #174 from yuntai/201809-funding_created_sig

verify incoming sig first to fail earlier

5 years agoverify incoming sig first and fail earlier
Yuntai Kyong [Thu, 13 Sep 2018 13:31:51 +0000 (22:31 +0900)]
verify incoming sig first and fail earlier

5 years agoAdd test of claiming HTLC-Timeout outputs based on a revoked commitment
Antoine Riard [Tue, 11 Sep 2018 01:44:50 +0000 (01:44 +0000)]
Add test of claiming HTLC-Timeout outputs based on a revoked commitment
tx

5 years agoImplement claiming of revoked HTLC transactions by ChannelMonitor
Antoine Riard [Tue, 11 Sep 2018 01:40:53 +0000 (01:40 +0000)]
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

5 years agoImplement set_their_delayed_payment_base_key in ChannelMonitor
Antoine Riard [Tue, 11 Sep 2018 01:37:31 +0000 (01:37 +0000)]
Implement set_their_delayed_payment_base_key in ChannelMonitor

Needed to build redeemscript on HTLC-Success/HTLC-Timeout tx from
remote revoked commitment tx

5 years agoMerge pull request #171 from TheBlueMatt/2018-09-ser-fixes
Matt Corallo [Wed, 12 Sep 2018 19:53:14 +0000 (15:53 -0400)]
Merge pull request #171 from TheBlueMatt/2018-09-ser-fixes

Correct MAX_BUF_SIZE in serialization

5 years agoCorrect MAX_BUF_SIZE in serialization 2018-09-ser-fixes
Matt Corallo [Wed, 12 Sep 2018 17:21:13 +0000 (13:21 -0400)]
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()

5 years agoFix some double-indentation in util/ser
Matt Corallo [Wed, 12 Sep 2018 17:20:20 +0000 (13:20 -0400)]
Fix some double-indentation in util/ser

5 years agoMerge pull request #167 from TheBlueMatt/2018-09-dup-htlc
Matt Corallo [Wed, 12 Sep 2018 17:07:13 +0000 (13:07 -0400)]
Merge pull request #167 from TheBlueMatt/2018-09-dup-htlc

 Allow duplicate-payment_hash HTLCs for HTLC forwards

5 years agoMerge pull request #170 from TheBlueMatt/2018-09-119-rebased
Matt Corallo [Wed, 12 Sep 2018 15:22:06 +0000 (11:22 -0400)]
Merge pull request #170 from TheBlueMatt/2018-09-119-rebased

#119 squashed

5 years agoAdd simple test for duplicate-payment_hash HTLC tracking 2018-09-dup-htlc
Matt Corallo [Tue, 11 Sep 2018 19:04:41 +0000 (15:04 -0400)]
Add simple test for duplicate-payment_hash HTLC tracking

5 years agoAvoid cross-test statics in ChannelManager network tests
Matt Corallo [Sun, 9 Sep 2018 01:02:42 +0000 (21:02 -0400)]
Avoid cross-test statics in ChannelManager network tests

5 years agoAllow duplicate-payment_hash HTLCs for HTLC forwards
Matt Corallo [Tue, 11 Sep 2018 18:20:40 +0000 (14:20 -0400)]
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

5 years agoMigrate fuzz router/channel target to Readable 2018-09-119-rebased
Yuntai Kyong [Wed, 12 Sep 2018 10:00:10 +0000 (19:00 +0900)]
Migrate fuzz router/channel target to Readable

and be more specific about DecodeError::InvalidValue

5 years agomigrate peer_handler to use Writeable
Yuntai Kyong [Mon, 10 Sep 2018 07:13:26 +0000 (16:13 +0900)]
migrate peer_handler to use Writeable

added inplace byte_utils

5 years agoAdd fuzz targets for Writeable messages/migrate fuzz test
Yuntai Kyong [Sat, 1 Sep 2018 07:21:39 +0000 (16:21 +0900)]
Add fuzz targets for Writeable messages/migrate fuzz test

5 years agoImplement Writeable for messages
Yuntai Kyong [Sat, 1 Sep 2018 07:20:26 +0000 (16:20 +0900)]
Implement Writeable for messages

5 years agoImplement Writer/Reader
Yuntai Kyong [Sat, 1 Sep 2018 07:18:56 +0000 (16:18 +0900)]
Implement Writer/Reader

with additional variants in DecodeError

5 years agoSplit HTLC tracking into separate Inbound/Outbound types
Matt Corallo [Sun, 9 Sep 2018 16:53:57 +0000 (12:53 -0400)]
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.

5 years agoMerge pull request #165 from TheBlueMatt/2018-09-pre-disconnect-misc
Matt Corallo [Tue, 11 Sep 2018 19:01:35 +0000 (15:01 -0400)]
Merge pull request #165 from TheBlueMatt/2018-09-pre-disconnect-misc

Further minor misc changes from reconnect work

5 years agopanic on invalid calls to Channel::send_commitment instead of Err 2018-09-pre-disconnect-misc
Matt Corallo [Sat, 8 Sep 2018 19:59:18 +0000 (15:59 -0400)]
panic on invalid calls to Channel::send_commitment instead of Err

5 years agoDo not allow sending HTLCs when the first hop is disconnected
Matt Corallo [Sat, 8 Sep 2018 19:53:05 +0000 (15:53 -0400)]
Do not allow sending HTLCs when the first hop is disconnected

5 years agoSync get_update_fail_htlc, get_update_fulfill_htlc state err result
Matt Corallo [Thu, 6 Sep 2018 23:12:32 +0000 (19:12 -0400)]
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.

5 years agoAdd force_close_channel call command to full_stack_target
Matt Corallo [Thu, 6 Sep 2018 21:23:09 +0000 (17:23 -0400)]
Add force_close_channel call command to full_stack_target

5 years agoMerge pull request #164 from TheBlueMatt/2018-09-channel-connection-cleanups
Matt Corallo [Sun, 9 Sep 2018 15:35:42 +0000 (11:35 -0400)]
Merge pull request #164 from TheBlueMatt/2018-09-channel-connection-cleanups

Minor cleanups

5 years agoDisallow duplicate Init messages from peers 2018-09-channel-connection-cleanups
Matt Corallo [Sat, 8 Sep 2018 18:43:15 +0000 (14:43 -0400)]
Disallow duplicate Init messages from peers

5 years agoFix PeerManager::get_peer_node_ids to filter according to docs
Matt Corallo [Sat, 8 Sep 2018 17:57:20 +0000 (13:57 -0400)]
Fix PeerManager::get_peer_node_ids to filter according to docs

5 years agoDisconnect duplicate node_id connections after Noise handshake
Matt Corallo [Sat, 8 Sep 2018 17:56:45 +0000 (13:56 -0400)]
Disconnect duplicate node_id connections after Noise handshake

5 years agoUpdate add_update_monitor docs to indicate registration req.
Matt Corallo [Sat, 8 Sep 2018 14:32:39 +0000 (10:32 -0400)]
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.

5 years agoDocument Channel::get_funding_redeemscript precondition
Matt Corallo [Thu, 6 Sep 2018 21:13:41 +0000 (17:13 -0400)]
Document Channel::get_funding_redeemscript precondition

5 years agoMerge pull request #159 from ariard/channel_monitor
Matt Corallo [Sat, 8 Sep 2018 14:29:29 +0000 (10:29 -0400)]
Merge pull request #159 from ariard/channel_monitor

Add registration of commitment tx's outputs from check_spend_remote_transaction

5 years agoAdd registration of commitment tx's outputs from
Antoine Riard [Fri, 7 Sep 2018 01:40:41 +0000 (01:40 +0000)]
Add registration of commitment tx's outputs from
check_spend_remote_transaction

Fixup more descriptive var names by Matt Corallo <git@bluematt.me>

5 years agoRefactor/dont re-enter block_conencted on duplicate watch calls
Matt Corallo [Fri, 7 Sep 2018 15:56:41 +0000 (11:56 -0400)]
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.

5 years agoNarrow ChainWatchInterface::install_watch_script
Matt Corallo [Fri, 7 Sep 2018 15:12:22 +0000 (11:12 -0400)]
Narrow ChainWatchInterface::install_watch_script

5 years agoMerge pull request #162 from ariard/channel_manager_refactor_all
Matt Corallo [Fri, 7 Sep 2018 23:43:08 +0000 (19:43 -0400)]
Merge pull request #162 from ariard/channel_manager_refactor_all

Channel manager refactor all (following & end)

5 years agoRefactor handle_update_fee to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:59:45 +0000 (21:59 +0000)]
Refactor handle_update_fee to wrapper error handling function

5 years agoRefactor handle_revoke_and_ack to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:57:06 +0000 (21:57 +0000)]
Refactor handle_revoke_and_ack to wrapper error handling function

5 years agoRefactor handle_commitment_signed to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:51:58 +0000 (21:51 +0000)]
Refactor handle_commitment_signed to wrapper error handling function

5 years agoRefactor handle_update_fail_malformed_htlc to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:46:47 +0000 (21:46 +0000)]
Refactor handle_update_fail_malformed_htlc to wrapper error handling function

5 years agoRefactor handle_update_fail_htlc to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:42:07 +0000 (21:42 +0000)]
Refactor handle_update_fail_htlc to wrapper error handling function

5 years agoRefactor handle_update_fulfill_htlc to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:36:55 +0000 (21:36 +0000)]
Refactor handle_update_fulfill_htlc to wrapper error handling function

5 years agoRefactor handle_update_add_htlc to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:30:00 +0000 (21:30 +0000)]
Refactor handle_update_add_htlc to wrapper error handling function

5 years agoRefactor handle_closing_signed to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 21:17:28 +0000 (21:17 +0000)]
Refactor handle_closing_signed to wrapper error handling function

5 years agoMerge pull request #160 from ariard/channel_manager_refactor_all
Matt Corallo [Fri, 7 Sep 2018 14:19:28 +0000 (10:19 -0400)]
Merge pull request #160 from ariard/channel_manager_refactor_all

Channel manager refactor all

5 years agoMerge pull request #156 from TheBlueMatt/2018-09-funding_created_action
Matt Corallo [Fri, 7 Sep 2018 14:14:58 +0000 (10:14 -0400)]
Merge pull request #156 from TheBlueMatt/2018-09-funding_created_action

Ensure funding_created always returns Some(_) HandleError::action

5 years agoRefactor handle_shutdown to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 03:10:10 +0000 (03:10 +0000)]
Refactor handle_shutdown to wrapper error handling function

5 years agoRefactor handle_funding_locked to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 02:58:01 +0000 (02:58 +0000)]
Refactor handle_funding_locked to wrapper error handling function

5 years agoRefactor handle_funding_signed to wrapper error handling function
Antoine Riard [Fri, 7 Sep 2018 02:45:07 +0000 (02:45 +0000)]
Refactor handle_funding_signed to wrapper error handling function

5 years agoRemove unused import in router_target 2018-09-funding_created_action
Matt Corallo [Thu, 6 Sep 2018 16:39:19 +0000 (12:39 -0400)]
Remove unused import in router_target

5 years agoEnsure funding_created always returns Some(_) HandleError::action
Matt Corallo [Thu, 6 Sep 2018 15:31:33 +0000 (11:31 -0400)]
Ensure funding_created always returns Some(_) HandleError::action

5 years agoMerge pull request #154 from ariard/funding_created_refactor
Matt Corallo [Thu, 6 Sep 2018 15:12:10 +0000 (11:12 -0400)]
Merge pull request #154 from ariard/funding_created_refactor

Refactor handle_funding_created to wrapper error handling function

5 years agoRefactor handle_funding_created to wrapper error handling function
Antoine Riard [Thu, 6 Sep 2018 00:58:00 +0000 (00:58 +0000)]
Refactor handle_funding_created to wrapper error handling function

5 years agoMerge pull request #155 from SWvheerden/patch-1
Matt Corallo [Thu, 6 Sep 2018 14:50:16 +0000 (10:50 -0400)]
Merge pull request #155 from SWvheerden/patch-1

patch to change temp_channel from deserialise to copy

5 years agochange temp_channel from deserialise to copy
SW van Heerden [Thu, 6 Sep 2018 13:34:33 +0000 (15:34 +0200)]
change temp_channel from deserialise to copy

5 years agoMerge pull request #151 from ariard/channel_manager_refactor
Matt Corallo [Thu, 6 Sep 2018 14:45:41 +0000 (10:45 -0400)]
Merge pull request #151 from ariard/channel_manager_refactor

Refactor handle_accept_channel to wrapper error handling function

5 years agoRefactor handle_accept_channel to wrapper error handling function
Antoine Riard [Wed, 5 Sep 2018 23:45:38 +0000 (23:45 +0000)]
Refactor handle_accept_channel to wrapper error handling function

5 years agoMerge pull request #152 from TheBlueMatt/2018-09-chan-cleanups
Matt Corallo [Thu, 6 Sep 2018 13:51:34 +0000 (09:51 -0400)]
Merge pull request #152 from TheBlueMatt/2018-09-chan-cleanups

Channel cleanups

5 years agoAdd further clarification TODO in finish_force_close_channel 2018-09-chan-cleanups
Matt Corallo [Thu, 6 Sep 2018 00:19:09 +0000 (20:19 -0400)]
Add further clarification TODO in finish_force_close_channel

5 years agoDrop HTLCState::LocalRemovedAwaitingCommitment
Matt Corallo [Wed, 5 Sep 2018 18:47:43 +0000 (14:47 -0400)]
Drop HTLCState::LocalRemovedAwaitingCommitment

This was redundant and was included because the HTLC still needed
to be monitored, but that happens in ChannelMonitor, so there is no
need for it in Channel itself.

5 years agoDocument+check commitment_signed generation success on send_htlc
Matt Corallo [Wed, 5 Sep 2018 18:08:38 +0000 (14:08 -0400)]
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).

5 years agoAlways return an Error Message in invalid sig/key errors in Channel
Matt Corallo [Wed, 5 Sep 2018 18:08:13 +0000 (14:08 -0400)]
Always return an Error Message in invalid sig/key errors in Channel

5 years agoMerge pull request #150 from TheBlueMatt/2018-09-bolt7-compliance
Matt Corallo [Wed, 5 Sep 2018 22:34:10 +0000 (18:34 -0400)]
Merge pull request #150 from TheBlueMatt/2018-09-bolt7-compliance

Finish up #129 BOLT 7 compliance

5 years agoMerge pull request #147 from TheBlueMatt/2018-09-channelmanager-err-macro
Matt Corallo [Wed, 5 Sep 2018 22:33:55 +0000 (18:33 -0400)]
Merge pull request #147 from TheBlueMatt/2018-09-channelmanager-err-macro

Refactor ChannelManager handle functions into a Channel-closing macro

5 years agoHandle partial-response UTXO impls or reorgs in chan_announcements 2018-09-bolt7-compliance
Matt Corallo [Wed, 5 Sep 2018 02:39:04 +0000 (22:39 -0400)]
Handle partial-response UTXO impls or reorgs in chan_announcements

Mostly to add a big comment noting why we aren't "spec-compliant"

5 years agoUtil-func channel removal (fixing a bug in HTLC failure updates)
Matt Corallo [Wed, 5 Sep 2018 02:25:51 +0000 (22:25 -0400)]
Util-func channel removal (fixing a bug in HTLC failure updates)