Commit graph

720 commits

Author SHA1 Message Date
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
Matt Corallo
19a1a59685
Merge pull request #222 from TheBlueMatt/2018-10-pre-commit-disconnect
Fix and test update_add_htlc but disconnect pre-commitment_signed
2018-10-27 10:46:04 -04:00
Matt Corallo
3609ba5c20
Merge pull request #217 from TheBlueMatt/2018-10-msg-resp-overhaul
Send ChannelManager messages out-of-band to ensure ordered delivery
2018-10-27 10:45:53 -04:00
Matt Corallo
f1eb4639f8
Merge pull request #225 from TheBlueMatt/2018-10-214-redo
Keys Interface Simplification
2018-10-27 10:45:43 -04:00
Matt Corallo
cfff650261 Bump version to 0.0.6 2018-10-27 09:58:10 -04:00
Matt Corallo
7f91572e2e Add very basic test of ChannelManager serialization round-trip 2018-10-27 09:58:10 -04:00
Matt Corallo
4a51f4f073 fix broken state comparison (thanks @yuntai!) 2018-10-27 09:58:10 -04:00
Matt Corallo
a2fb3ccc08 Implement and document Channel/ChannelManager (de)serialization 2018-10-27 09:58:10 -04:00
Matt Corallo
6ed5a829bb Fix + test disconnect/reconnect prior to FundingLocked 2018-10-27 09:58:10 -04:00
Matt Corallo
c0c139cdc2 Fix and test update_add_htlc but disconnect pre-commitment_signed 2018-10-27 09:42:04 -04:00
Matt Corallo
294ad32523 Avoid reentrancy of send_data from PeerHandler::read_bytes.
This greatly simplifies clients of PeerHandler, and because almost
all response messages have already been moved to process_events
this doesn't change much effeciency-wise.
2018-10-27 09:42:04 -04:00
Antoine Riard
5180686b1d Integrate destination_script from KeysInterface in ChannelManager/Channel
Drop channel_monitor_claim_key from ChannelKeys
2018-10-27 09:42:04 -04:00
Matt Corallo
b2bd64d2eb Store+expose bits of Channel[Monitor] to figure out local state 2018-10-27 09:42:04 -04:00
Matt Corallo
249aa77550 Send channel_reestablish out-of-band to ensure ordered deliver 2018-10-27 09:42:04 -04:00
Antoine Riard
32a9378909 Integrate shutdown_pubkey from KeysInterface in ChannelManager/Channel
Drop channel_close_key from ChannelKeys
2018-10-27 09:42:04 -04:00
Matt Corallo
6f08779b04 Track ChannelMonitor-watched-outpoints (+ remove now-uesless Mutex) 2018-10-27 09:42:04 -04:00
Matt Corallo
e2de49ddc4 Respond to channel_reestablish out-of-band for ordered delivery 2018-10-27 09:42:04 -04:00
Antoine Riard
e361fed0f1 Integrate KeysInterface to ChannelManager with Arc 2018-10-27 09:42:04 -04:00
Matt Corallo
56513f2927 Track last_block_hash in ChannelMonitor and expose it on deser
Also make block_connected take a &mut self to ensure serialized
state will always be self-consistent.
2018-10-27 09:42:04 -04:00
Matt Corallo
4342114345 Send RAA/CS messages out-of-band to ensure ordered delivery 2018-10-27 09:42:04 -04:00
Antoine Riard
6d5dc6c9b4 Implement KeysInterface for KeysManager util 2018-10-27 09:42:04 -04:00
Matt Corallo
612e2801f8 Redo ChannelMonitor deserialization to avoid read_to_end()
This slightly changes the serialization format, but we're still
early enough that that's OK.
2018-10-27 09:42:04 -04:00
Matt Corallo
812f255d7c Send shutdown/closing_signed msgs out-of-band for ordered delivery 2018-10-27 09:42:04 -04:00
Matt Corallo
f0490118b3 impl some additional (de)serializers, including a u48 wrapper type 2018-10-27 09:42:04 -04:00
Matt Corallo
e382a7b4b3 Send announcement_signatures msgs out-of-band for ordered delivery 2018-10-27 09:42:04 -04:00
Matt Corallo
4eafd37d20 impl Readable/Writable for Route 2018-10-27 09:42:04 -04:00
Matt Corallo
c962a27156 Send funding_signed messages out-of-band to ensure ordered delivery 2018-10-27 09:42:04 -04:00
Matt Corallo
74cec623fd Add a BIG lock to ChannelManager
During normal operation we should never need to take this, so we
use a RwLock that allows normal parallelism until we want to
serialize out our ChannelManager, at which point we can take the
write-mode lock.
2018-10-27 09:42:04 -04:00
Matt Corallo
608d517f92 Send AcceptChannel responses out-of-band to ensure ordered delivery 2018-10-27 09:42:04 -04:00
Matt Corallo
47fe673c57 Give ChannelMonitor a logger via new ReadableArgs trait 2018-10-27 09:42:04 -04:00
Matt Corallo
e397cb9960 Split Event, move MessageSendEvent push() inside channel_state lock 2018-10-27 09:42:04 -04:00
Matt Corallo
062a02da1a Add a second Readable trait for state args, clean macros slightly 2018-10-27 09:42:04 -04:00
Matt Corallo
bb43b98e8f Store [u8; 32]s instead of SharedSecrets (for deserialization) 2018-10-27 09:42:04 -04:00
Antoine Riard
d33cb3cca5 Add a KeysInterface which provides keys from user
Move ChannelKeys into keysinterface for generate a set of it from
master_seed and change return type to panic on bogus data
2018-10-27 09:34:45 -04:00
Antoine Riard
8c235d9e28 Generate Events from ChannelMonitor to indicate spendable ouputs
Extend KeyStorage with delayed_payment_base_key and per_commitment_point
to derive local_delayed private key
2018-10-27 09:34:28 -04:00
Matt Corallo
70b026c3c5
Merge pull request #224 from TheBlueMatt/2018-10-221-whitespace
#221 with a few trailing spaces removed
2018-10-25 21:21:54 -04:00