Commit graph

1164 commits

Author SHA1 Message Date
Matt Corallo
73dce207dd Track the full list of outpoints a chanmon wants monitoring for.
Upon deserialization/reload we need to be able to register each
outpoint which spends the commitment txo which a channelmonitor
believes to be on chain. While our other internal tracking is
likely sufficient to regenerate these, its much easier to simply
track all outpouts we've ever generated, so we do that here.
2020-02-18 18:20:33 -05:00
Matt Corallo
473f611d11
Merge pull request #440 from TheBlueMatt/2020-01-feature-sanity
Fix a bug in required feature checks
2020-02-17 23:47:06 +00:00
Matt Corallo
4f59b8e03f
Merge pull request #499 from moneyball/patch-1
add clarity to the language
2020-02-17 20:06:11 +00:00
Steve Lee
40e722d721
fixes per rloomba feedback 2020-02-15 11:45:11 -08:00
Matt Corallo
fc03ab1534
Merge pull request #501 from TheBlueMatt/2020-02-rescan-clarify
Clarify rescan rules for block_connected somewhat
2020-02-15 01:36:56 +00:00
Steve Lee
067dd3be52
fixes per arik feedback 2020-02-13 18:43:58 -08:00
Matt Corallo
ca4c970467 Clarify rescan rules for block_connected somewhat 2020-02-13 12:56:13 -05:00
Steve Lee
2314b0a25a
add clarity to the language 2020-02-12 19:36:08 -08:00
Matt Corallo
4ac9ed2f00 Add some basic sanity tests for feature flags 2020-02-12 17:16:42 -05:00
Matt Corallo
a3ddb9fb19 Avoid treating option_upfront_shutdown (req) as unknown_required.
This fixes the bitmask in requires_unknown_bits.
2020-02-12 17:13:50 -05:00
Matt Corallo
bae2338b4d
Merge pull request #470 from ariard/2020-01-contributing-draft
First draft, don't-cover-everything-but-yet-a-good-start-CONTRIBUTING.md
2020-02-12 19:31:26 +00:00
Matt Corallo
2514530a53
Merge pull request #496 from TheBlueMatt/2020-02-461-extra-mut
Remove unnecessary mut introduced in 0c595a7ff6
2020-02-12 18:53:36 +00:00
Antoine Riard
34871ea288 Add a first draft CONTRIBUTING.md 2020-02-12 13:34:10 -05:00
Matt Corallo
f137139672 Remove unnecessary mut introduced in 0c595a7ff6 2020-02-12 13:03:41 -05:00
Matt Corallo
c906f28432
Merge pull request #461 from ariard/2020-remove-duplicata
Remove some duplicata of broadcast txn from ChannelMonitor
2020-02-12 17:38:21 +00:00
Antoine Riard
494219e388 Remove duplicata of broadcast txn from ChannelMonitor
Previously, if new ouputs were found to be watched as part
of channel operations, the block was rescan which triggers
again parser and generation of transactions already issued.

This commit first modifies the test framework without
altering further ChannelMonitor.

ChannelMonitor refactoring is introduced in a latter commit.
2020-02-12 00:37:19 -05:00
Matt Corallo
3c9e8c9d77
Merge pull request #434 from TheBlueMatt/2019-12-var-len-onion
TLV-based Variable Length Onion
2020-02-11 22:49:39 +00:00
Matt Corallo
bec0a260e8 Define a BLOCK_SIZE constant for chacha20 2020-02-11 16:27:38 -05:00
Matt Corallo
65a2bcf46c Swap out 20*65 for a constant, given onion hops are now of var len 2020-02-11 16:27:38 -05:00
Matt Corallo
bfe59a753e Use RouteHop's new node_features to send TLV-encoded onion hops
This implements the new TLV variable-length encoding for onion hop
data, opting to send it if the RouteHop's node_features indicates
support. It also uses the new process_inline method in ChaCha20 to
optimize a few things (though it grows a new TODO for a
probably-important optimization).
2020-02-11 16:27:38 -05:00
Matt Corallo
c94e53d9dd Add support for variable-length onion payload reads using TLV 2020-02-11 16:27:38 -05:00
Matt Corallo
c326061108 Add macros for building TLV (de)serializers.
There's quite a bit of machinery included here, but it neatly
avoids any dynamic allocation during TLV deserialization, and the
calling side looks nice and simple. The macro-generated code is
pretty nice, though has some redundant if statements (I haven't
checked if they get optimized out yet, but I can't imagine they
don't).
2020-02-11 13:48:56 -05:00
Matt Corallo
85c8410f89 Expose VecWriter outside of util::ser since peer_handler uses it 2020-02-11 13:48:56 -05:00
Matt Corallo
66c4ed2d68 Add new streams and serialization wrappers for TLV types.
This adds a number of new stream adapters to track and/or calculate
the number of bytes read/written to an underlying stream, as well
as wrappers for the two (?!) variable-length integer types that TLV
introduces.
2020-02-11 13:48:56 -05:00
Matt Corallo
f990aacccb Add a ChaChaReader adapter to read an encrypted stream & use it
This prepares for variable-length per-hop-data by wrapping the full
hop_data field in a decrypting stream, with a few minor
optimizations and redundant allocations to boot.
2020-02-11 13:48:56 -05:00
Matt Corallo
8f3750304b Move BogusHopData generation into test instead of OnionHopData.
This, as it should be, restricts OnionHopData to only being able to
represent valid states, while still allowing for tests to generate
bogus hop data fields to test deserialization.
2020-02-11 13:48:56 -05:00
Matt Corallo
c2a47d1b4c Pull hmac out of OnionHopData.
Its a bit awkward to have an hmac field covering the struct that
its in, and there is little difference in removing it, so just pull
it out and use a [u8; 32] where we care about the hmac.
2020-02-11 13:48:56 -05:00
Matt Corallo
36c725fe1c Flatten OnionHopData struct with the Realm0 struct.
Previously OnionHopData contained a OnionRealm0HopData field however
instead of bumping the realm number, it has been replaced with a
length, used to indicte the length of a TLV-formatted object.

Because a TLV-formatted hop data can contain the same information as
a realm-0 hop data, we flatten the field and simply keep track of
what format it was in.
2020-02-11 13:48:56 -05:00
Matt Corallo
87a0018e3e Better document msg fuzz target behavior and be slightly more strict 2020-02-11 13:48:56 -05:00
Matt Corallo
1619d08163
Merge pull request #491 from TheBlueMatt/2020-02-one-conf-lock
Fix one-confirmation funding_locked generation
2020-02-11 05:36:01 +00:00
Matt Corallo
b7f4f764af
Merge pull request #490 from jkczyz/2020-02-initial-routing-sync
Refactor logic for setting initial_routing_sync feature bit
2020-02-10 22:18:48 +00:00
Matt Corallo
ff24530318 Add some trace logging for funding_locked and announcement_sigs 2020-02-10 17:09:24 -05:00
Matt Corallo
8c0ec5c20d Add test for 1-conf channels 2020-02-10 17:09:24 -05:00
Matt Corallo
b02ccbb92f Fix sending funding_locked with 1 conf.
We previously tracked funding transaction confirmation by marking
funding_tx_confirmations to 1 when we see it in a block and
incrementing each block thereafter if its non-0. To avoid
double-incrementing the first confirmation, we did the increment
(and funding_locked check) after doing the first-confirmation
checks. Thus, we'd never hit the funding_locked case during the
first confirmation.

To address this, we simply swap the order of the checks, though
bumping the funding_tx_confirmations increment up to the top.

Reported-by: Igor Cota <igor@codexapertus.com>
2020-02-10 17:09:21 -05:00
Jeffrey Czyz
72de9cc178 Add a test for Router's should_request_full_sync 2020-02-10 12:01:35 -08:00
Jeffrey Czyz
71021fc9d8 Move Router test setup to a helper function 2020-02-10 11:54:46 -08:00
Jeffrey Czyz
d3fb619020 Move initial_routing_sync decision to the Router
PeerManager determines whether the initial_routing_sync feature bit
should be set when sending Init messages to peers. Move this to the
Router as it is better able to determine if a full sync is needed.
2020-02-10 11:13:41 -08:00
Matt Corallo
88b7dcd7e4
Merge pull request #445 from TheBlueMatt/2020-01-fuzz-enforcer-fix
Fix EnforcingChannelKeys panic when our counterparty burns their $.
2020-02-10 18:47:44 +00:00
Matt Corallo
6f5a48b9d1
Merge pull request #487 from moneyball/master
remove unnecessary reference to LDK
2020-02-10 17:52:29 +00:00
Steve Lee
2c82222693 Update README.md 2020-02-09 19:08:35 -08:00
Matt Corallo
6dd6f1ffde Merge pull request #479 from moneyball/master
Updated the status of the project
2020-02-08 21:21:07 +00:00
Matt Corallo
2ecec2eacf Merge pull request #478 from arik-so/remove_decodeerror_macro
remove decode_error macro only used once
2020-02-08 21:20:20 +00:00
Matt Corallo
1443509d77 Test that EnforcingChannelKeys doesn't panic on duplicate RAAs 2020-02-07 20:03:00 -05:00
Matt Corallo
60fad62633 Fix EnforcingChannelKeys panic when our counterparty burns their $.
If our counterparty burns their funds by revoking their current
commitment transaction before we've sent them a new one, we'll step
forward the remote commitment number. This would be otherwise fine
(and may even encourage them to broadcast their revoked state(s) on
chain), except that our new EnforcingChannelKeys expects us to not
jump forward in time. Since it isn't too important that we punish
our counterparty in such a corner-case, we opt to just close the
channel in such a case and move on.
2020-02-07 20:03:00 -05:00
Steve Lee
01b643399a
Update README.md 2020-02-07 13:34:23 -08:00
Steve Lee
2eeb500d19
Updated the status of the project
It needs review and completion of the missing BOLT specification parts.
2020-02-06 21:43:47 -08:00
Arik Sosman
360ed11c59
remove decode_error macro only used once 2020-02-06 14:17:44 -08:00
Matt Corallo
2ec7c77036
Merge pull request #463 from jkczyz/2020-01-wire-encode
Encapsulate message wire encoding into a module
2020-02-05 21:18:42 +00:00
Jeffrey Czyz
0e6b207b97 Use a tuple struct for MessageType 2020-02-05 12:14:45 -08:00
Jeffrey Czyz
326076f5e8 Move message type parity logic to the wire module
Create a MessageType abstraction and use it throughout the wire module's
external interfaces. Include an is_even method for clients to determine
how to handle unknown messages.
2020-02-05 12:13:13 -08:00