Commit graph

1123 commits

Author SHA1 Message Date
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
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
Jeffrey Czyz
7de9f5278c Encapsulate message wire encoding into a module
Lightning messages are identified by a 2-byte type when encoded on the
wire. Rather than expecting callers to know message types when sending
messages to peers, have each message implement a trait defining the
message type. Provide an interface for reading and writing messages
as well as a Message enum for matching the decoded message, including
unknown messages.
2020-02-05 12:11:48 -08:00
Matt Corallo
425e4adbf2
Merge pull request #454 from TheBlueMatt/2020-01-fuzz-mega-value
Panic on txn with value > 21mill in ChannelMonitor::block_connected, Clean up fuzz targets a bit
2020-02-05 01:23:44 +00:00
Matt Corallo
8ee626c9a4
Merge pull request #466 from lightning-signer/chanmon-keys
Add ChannelKeys to ChannelMonitor
2020-02-05 01:17:46 +00:00
Devrandom
c20e930b31 Add ChannelKeys to ChannelMonitor 2020-02-04 16:24:11 -08:00
Devrandom
12e89f6678 move ChannelMonitor.write* in preparation for adding ChannelKeys 2020-02-04 09:10:39 -08:00
Matt Corallo
f70058ea4c
Merge pull request #459 from ariard/2020-01-fix-htlc-height-timer
Fix bumping timer for claiming revoked HTLC outputs
2020-01-25 22:11:27 +00:00
Matt Corallo
af4738b778
Merge pull request #460 from lightning-signer/channel-value
Channel value to ChannelKeys constructor
2020-01-25 21:17:12 +00:00
Matt Corallo
30a12759f1
Merge pull request #458 from TheBlueMatt/2020-01-spendable-docs
Clean up documentation around spendable outputs significantly.
2020-01-25 20:50:10 +00:00
Matt Corallo
4fa6d966df
Merge pull request #443 from valentinewallace/channelmgr-arcs-to-derefs
Drop ChannelManager's ChannelMonitor Arc for Deref
2020-01-25 20:41:10 +00:00
Matt Corallo
6c9180f972 Clean up documentation around spendable outputs significantly.
* Fixed a number of grammar issues
 * Clarified the docs for users who are intimately farmiliar with
   arbitrary lines of text copied from the BOLTs
 * Added a bit more text so that things are easier to read and less
   disjoint.
 * Clarified exactly how the witness stack should look since I had
   to go dig for it.
2020-01-25 15:11:12 -05:00
Valentine Wallace
4833d1acf9 Update ChannelManager's ChannelMonitor Arc to be a Deref
Additional changes:
* Update fuzz crate to match ChannelManager's new API
* Update lightning-net-tokio library to match ChannelManager's new ChannelMonitor Deref API
* Update tests to match ChannelManager's new ChannelMonitor Deref API
2020-01-25 14:39:52 -05:00
Devrandom
db398438ab Remove unnecessary sign_closing_transaction arg 2020-01-23 19:06:57 -08:00
Devrandom
d14ece4ac0 channel value to ChannelKeys constructor 2020-01-23 19:06:57 -08:00
Antoine Riard
e832e365b4 Fix bumping timer for claiming revoked HTLC outputs
Previously, we were using their_to_self_delay instead of
our_to_self_delay which was falsifying test.
2020-01-22 19:55:22 -05:00
Matt Corallo
9a02115437
Merge pull request #457 from ariard/2020-01-fix-append-onchain
Fix spurious calls of broadcast_by_local_state
2020-01-22 20:57:36 +00:00
Matt Corallo
c991643746
Merge pull request #433 from TheBlueMatt/2019-12-features-in-routes
Plumb Features through into Routes
2020-01-22 20:18:30 +00:00
Antoine Riard
70bed378df Fix spurious calls of broadcast_by_local_state 2020-01-22 13:53:12 -05:00
Matt Corallo
617a680984 DRY-up list_channels by having a common lister that takes a filter 2020-01-21 15:09:12 -05:00
Matt Corallo
912f877482 Pass node features through to RouteHops
This exposes the latest Init-context features in the ChannelDetails
passed to the Router during route calculation, which combines those
with the Node-context features tracked from node_announcements to
provide the latest Node-context features in RouteHop structs.

Fields are also added for Channel-context features, though those are
only partially used since no such features are defined today anyway.

These will be useful when determining whether to use new
TLV-formatted onion hop datas when generating onions for peers.
2020-01-21 15:09:12 -05:00
Matt Corallo
a19d71d0b2 Keep track of the Init Features for every connected/channel'd peer
Since we want to keep track of the Init-context features for every
peer we have channels with, we have to keep them for as long as the
peer is connected (since we may open a channel with them at any
point).

We go ahead and take this opportunity to create a new per-peer-state
struct which has two levels of mutexes which is appropriate for
moving channel storage to.

Since we can't process messages from a given peer in parallel, the
inner lock is a regular mutex, but the outer lock is RW so that we
can process for different peers at the same time with an outer read
lock.
2020-01-19 22:47:08 -05:00
Matt Corallo
d2ba7caf47 Pass peer's Init message through to ChannelManager 2020-01-19 22:47:08 -05:00
Matt Corallo
f263b3793f
Merge pull request #451 from lightning-signer/txkeys
Provide remote channel public keys to signer
2020-01-20 03:46:00 +00:00
Devrandom
b2064927cb Use ChannelPublicKeys in Channel 2020-01-19 18:55:57 -08:00
Devrandom
b65035f5e9 Hide derived fields in TxCreationKeys 2020-01-19 20:40:49 -05:00
Devrandom
42d7738234 Provide remote channel public keys to signer 2020-01-19 20:40:49 -05:00
Matt Corallo
04215c4658 Panic on txn with value > 21mill in ChannelMonitor::block_connected
full_stack_target found a crash where we may overflow ruring fee
calculation if a transaction appears on-chain with massive value
available for us to claim. Since these transactions are clearly
bogus, we shouldn't allow full_stack_target to connect them, but
we also improve the error generated by explicitly panicing on them.
2020-01-19 16:13:47 -05:00
Matt Corallo
a343cf9436 Drop individual fuzz target duplicate_crash tests for file reader
Previously, in each of our fuzz tests we had a dummy test which
had a hard-coded hex string which it passed into the fuzz target
so that when a failing test case was found, its hex could be
copied into the test and you could run cargo test to analyze the
failure. However, this was somewhat unwieldy as converting large
tests back and forth between hex and raw files is quite annoying.

Instead, we replace each of those tests with a test in each target
that looks for files in fuzz/test_cases and runs each file it finds.

Since we're editing every bin target anyway, we also automate adding
no_main to libfuzzer builds with #![cfg_attr].
2020-01-19 16:13:47 -05:00
Matt Corallo
0b5b2828f9
Merge pull request #447 from ariard/2020-01-fix-weight-computation
Bound incoming HTLC witnessScript to min/max limits
2020-01-17 22:32:29 +00:00
Antoine Riard
fbc7885a97 Bound incoming HTLC witnessScript to min/max limits
Fix a crash where previously we weren't able to detect any accepted
HTLC if its witness-encoded cltv expiry was different from expected
ACCEPTED_HTLC_SCRIPT_WEIGHT. This should work for any cltv expiry
included between 0 and 16777216 on mainnet, testnet and regtest.
2020-01-17 16:39:31 -05:00
Matt Corallo
1a870fe8aa Fix crash when a claim tx has some non-witness inputs.
The logger which decides what to refer to an on-chain claim tx was
assuming that all inputs would have a witness. While this was fine
for the one-input case, it broke the fuzzer which was connecting a
consensus-invalid transaction. Further, in the case we have multiple
inputs, some may not have a witness, which we shouldn't crash on.

This fixes 9df0250dbb.
2020-01-17 16:26:48 -05:00
Matt Corallo
f605eb3819
Merge pull request #450 from ariard/2020-01-fix-fst-blk-disconnection
Fix full_stack_target block disconnection
2020-01-17 20:13:46 +00:00
Antoine Riard
865267ac68 Fix full_stack_target mishandling of block disconnection 2020-01-17 14:21:02 -05:00
Antoine Riard
5aa95baa8d Log block disconnection in ChannelMonitor 2020-01-17 14:20:23 -05:00
Matt Corallo
09d2a71352
Merge pull request #448 from lightning-signer/visibility-for-test
Increase visibility for external integration tests
2020-01-16 23:54:09 +00:00
Devrandom
481e221187 increase visibility for external integration tests 2020-01-16 15:07:45 -08:00
Matt Corallo
b59efadb74
Merge pull request #444 from lightning-signer/funding-script
Construct funding redeem script in signer
2020-01-16 22:02:20 +00:00
Devrandom
6200302dc7 construct funding redeem script in signer 2020-01-16 13:18:23 -08:00
Matt Corallo
9c572a98fb
Merge pull request #449 from jkczyz/2020-01-remove-borrow-parts
Remove unnecessary borrow_parts() methods
2020-01-16 20:18:13 +00:00
Jeffrey Czyz
e58440fe45 Remove unnecessary borrow_parts() methods
Accessing a struct through an std::syn::MutexGuard using implicit
dereferencing can confuse the borrow checker. This situation arises when
obtaining mutable references to more than one field of the struct, which
is normally allowed.

https://doc.rust-lang.org/nomicon/borrow-splitting.html

However, when using implicit dereferencing, a mutable reference to the
the entire struct is taken. Thus, attempting to access another field in
this manner will lead to a compilation error.

https://doc.rust-lang.org/error-index.html#E0499

A simple way to avoid this is to first obtain a mutable reference to the
struct using explicit dereferencing.
2020-01-16 10:48:16 -08:00
Matt Corallo
a252f81477
Merge pull request #428 from TheBlueMatt/2019-12-flat-features
Implement Flat Features
2020-01-13 22:53:54 +00:00