Commit graph

251 commits

Author SHA1 Message Date
Matt Corallo
b8b7cb238d Convert fee API to per_kw instead of per_vb
This (a) cuts down a bit on some conversions, reducing chances for
bugsand (b) provides greater accuracy for clients.
2018-07-24 20:34:56 -04:00
Matt Corallo
d61abf6c04 Fix HTLC exclusion balance calculation criteria 2018-07-24 15:11:38 -04:00
Antoine Riard
20fa9d331d Add DisconnectPeer events
Add test for DisconnectPeer event
Update DisconnectPeer with optional ErrorMessage
Manage error for funding_transaction_generated
Add disconnect_socket to SocketDescriptor trait
2018-07-23 14:31:44 -04:00
Matt Corallo
e93c9fbeaf Migrate all Uint256s used for channel_ids to [u8; 32] 2018-07-22 18:55:20 -04:00
Matt Corallo
896f5b8d91 Fix failure sending FundingLocked for non-announced channels 2018-07-22 17:11:20 -04:00
Matt Corallo
4afb0d85fa
Merge pull request #53 from savil/rename-error-msg-to-action
[HandleError] rename msg field to action
2018-07-19 23:30:28 -04:00
Matt Corallo
de523c4ca3
Merge pull request #47 from ariard/block_disconnected_close_chan
Implement channel closing for block_disconnected on ChainListener + test
2018-07-19 23:05:22 -04:00
Savil Srivastava
fd141bbed2 [Error] rename msg field to action
this was a TODO and also briefly discussed in https://github.com/rust-bitcoin/rust-lightning/pull/43#pullrequestreview-135649551

I'm not fully sure how to remove the `Option`, and make it completely required. Would love suggestions. So, have omitted that for now. Plus, better to make smaller, incremental changes.

Test Plan:
`cargo build`
`cargo test`
2018-07-19 20:01:55 -07:00
Antoine Riard
1b8544fd5d Implement channel closing for block_disconnected on ChainListener + test 2018-07-20 02:37:05 +00:00
Matt Corallo
68e6beab7c Expose the script_pubkey being monitored in chain watch (fixes #44) 2018-07-19 22:22:14 -04:00
Matt Corallo
b02176c86b Fix various spec bugs, can now open channels with real nodes!
* commitment transaction number, as used in locktime/sequence
   fields is actually different from commitment transaction number,
   as used for revocation state. This is confusing and never stated
   in the spec, so we have to do the conversion.
 * max_htlc_value_in_flight is never constrained in the spec, but
   we were requiring it be <= channel size. Instead just clamp the
   values the peer sends us when storing.
 * channel_id calculation was incorrect, we now do some crazy
   conversion hops, which we shouldn't, but will need to change our
   types to fix.
 * Our channel_reserve_satoshis value was too low, just change the
   constant and leave the TODO to figure out what it really should
   be for now.
2018-07-19 17:25:47 -04:00
Jean Pierre Dudey
6707db6eae Add MAX_FUNDING_SATOSHIS constant.
This constants defines the maximum value of `open_channel.funding_satoshis`,
currently it's defined to be 2^24 according to the BOLT #2 specification.
Also a test was added to check that the constant is never over 2,1x10^15
(maximum satoshis in bitcoin) if modified.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-06-30 11:13:18 -04:00
Matt Corallo
5fa80d022a
Merge pull request #37 from TheBlueMatt/master
Fix additional 1.22 rustc warning
2018-06-29 18:26:41 -04:00
Matt Corallo
5918df8490
Merge pull request #36 from TheBlueMatt/2018-08-33-cleanups
Cleanups after #33, plus one unrelated bugfix spotted in #33 review
2018-06-29 18:26:25 -04:00
Matt Corallo
1228663b3e Fix additional 1.22 rustc warning 2018-06-29 17:44:55 -04:00
Matt Corallo
56842c2bea Cleanups after #33, plus one unrelated bugfix spotted in #33 review 2018-06-29 17:23:50 -04:00
Matt Corallo
b65aa86ea0
Merge pull request #33 from jeandudey/funding_txo
Use the `TxOutRef` type for the `ChannelMonitor`'s funding_txo field.
2018-06-29 17:23:34 -04:00
Jean Pierre Dudey
d0e9137bc5 Add the OutPoint type for the ChannelMonitor's funding_txo field.
This structure replaces the (Sha256dHash, u16) tuple that was being used
for the funding output.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-06-29 12:12:17 -04:00
Antoine Riard
ef166420b0 Add pruning of preimages no longer needed + tests 2018-06-28 23:19:24 +00:00
Matt Corallo
22342134ef Some with_capacity's 2018-04-26 19:45:36 -04:00
Matt Corallo
a20eef17c9 Fix local route update broadcasts, annouce channel closures 2018-04-24 20:42:24 -04:00
Matt Corallo
2d8afeccdb Rewrite channelmonitor framework and implement a bunch of it 2018-04-24 20:42:24 -04:00
Matt Corallo
8e2974fc2a HTLC Failure message handling 2018-04-24 11:55:08 -04:00
Matt Corallo
53d1518566 Move ChannelKeys creation into channelmanager 2018-04-17 12:43:12 -04:00
Matt Corallo
4d75d4c099 Minor cleanups 2018-04-16 20:35:21 -04:00
Matt Corallo
f5ca346011 Fix commitment transaction number/per_commitment_point tracking 2018-04-16 20:35:21 -04:00
Matt Corallo
374ea1f05e Completely rewrite channel HTLC tracking and processing
It obviously was nonsensical prior, though its now way more
complicated...there's refactoring work to be done here, but it
should at least kinda sorta work now.
2018-04-16 20:35:21 -04:00
Matt Corallo
021b3643cc Hand payment preimages into channel monitors when claimed 2018-04-16 20:35:03 -04:00
Matt Corallo
644119201d Remove useless htlc_redeemscript argument 2018-04-02 18:31:23 -04:00
Matt Corallo
e79e61f595 Clean up channel error handling a ton 2018-04-02 18:31:23 -04:00
Matt Corallo
b21048a1ce Check funding txout format when transaction is confirmed in channel 2018-04-02 18:07:03 -04:00
Matt Corallo
8e79c05a20 Add support for initiating channel closure to Channel{,Manager} 2018-04-02 18:07:03 -04:00
Matt Corallo
c528ff3650 Handle incoming shutdown messages 2018-04-02 18:07:02 -04:00
Matt Corallo
890e3cb165 Update for new rust-bitcoin API, avoid some duplicate hashing 2018-04-02 18:06:59 -04:00
Matt Corallo
7bb290fe3a Stop allowing new commitments without updates/revoke 2018-03-25 17:02:28 -04:00
Matt Corallo
9606f94caf Stop freeing holding cell in updates, fix freeing in revoke 2018-03-25 17:02:28 -04:00
Matt Corallo
89d9f8fb0e Fix update_fee handling, add TODOs 2018-03-25 17:02:28 -04:00
Matt Corallo
d923717216 Expand fake_network_test a bit with multiple in-flight rebalances 2018-03-25 17:02:28 -04:00
Matt Corallo
ab56b81acd Stub out Sha256 calls when fuzzing 2018-03-23 13:16:24 -04:00
Matt Corallo
d18e54bd90 Stub out RNG when fuzzing 2018-03-23 13:16:24 -04:00
Matt Corallo
e9b1af277f Check validity of dust_limit_satoshis in remote messages 2018-03-22 17:43:31 -04:00
Matt Corallo
1bb4f44bd6 Fix reserve check on HTLC receive/send 2018-03-22 17:43:31 -04:00
Matt Corallo
d14e31f512 Remove useless Sha256 copies 2018-03-22 17:42:12 -04:00
Matt Corallo
40ab09f627 Clarify roles in failing HTLCs, impl it, support rebalances 2018-03-22 17:35:30 -04:00
Matt Corallo
4f4c0a8179 Impl a few more msg deserializations, fix a channel panic!() bug 2018-03-19 17:46:37 -04:00
Matt Corallo
f9fc2dfbe2
Merge pull request #3 from RCasatta/fixtry
use ? instead of try macro
2018-03-02 11:21:00 -05:00
Riccardo Casatta
b94365f3f5
use ? instead of try macro 2018-03-01 09:54:56 +01:00
practicalswift
e7d0d8af9f Fix typos 2018-02-27 23:38:52 +01:00
Matt Corallo
770740dbcc Update deps, including significant dep reduction in rust-bitcoin! 2018-02-21 11:35:43 -05:00
Matt Corallo
24e2234be5 Split out channel_monitor_claim_key from shutdown key for privacy 2018-02-21 11:09:22 -05:00