]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
4 years agoempty_commit: PR 523 follows
Matt Corallo [Thu, 20 Feb 2020 20:07:04 +0000 (15:07 -0500)]
empty_commit: PR 523 follows

4 years agoFix typo in lightning-net-tokio crate description.
Matt Corallo [Mon, 3 Feb 2020 23:47:38 +0000 (18:47 -0500)]
Fix typo in lightning-net-tokio crate description.

4 years agoFix (and test) net-tokio outbound conns without a threaded env
Matt Corallo [Fri, 28 Feb 2020 16:55:34 +0000 (11:55 -0500)]
Fix (and test) net-tokio outbound conns without a threaded env

4 years agoFix long-standing race in net-tokio reading after a disconnect event
Matt Corallo [Mon, 24 Feb 2020 19:17:04 +0000 (14:17 -0500)]
Fix long-standing race in net-tokio reading after a disconnect event

If rust-lightning tells us to disconnect a socket after we read
some bytes from the socket, but before we actually give those bytes
to rust-lightning, we may end up calling rust-lightning with a
Descriptor that isn't registered anymore.

Sadly, there really isn't a good way to solve this, and it should
be a pretty quick event, so we just busy-wait.

4 years agoRewrite lightning-net-tokio using async/await and tokio 0.2
Matt Corallo [Sat, 1 Feb 2020 17:27:30 +0000 (12:27 -0500)]
Rewrite lightning-net-tokio using async/await and tokio 0.2

This is a rather major rewrite, using async/await and tokio 0.2,
which cleans up the code a ton as well as adds significantly to
readability.

4 years agoSwap read_event read type for a slice isntead of a Vec
Matt Corallo [Sat, 1 Feb 2020 01:57:01 +0000 (20:57 -0500)]
Swap read_event read type for a slice isntead of a Vec

It looks like we don't currently use the Vec as a Vec, and can
happily take a slice, which makes things easier on the calling
side.

4 years agoOnly run lightning-net-tokio build on Rust 1.39.0+ on Travis.
Matt Corallo [Sat, 1 Feb 2020 17:37:50 +0000 (12:37 -0500)]
Only run lightning-net-tokio build on Rust 1.39.0+ on Travis.

This disables building the lightning-net-tokio crate on 1.34.2 on
Travis in anticiption of relying on async/await for
lightning-net-tokio, with the nice side-effect of reducing the
amount of work done on our slowest Travis job.

This also adds 1.39.0 to Travis as that is the new MSRV for
lightning-net-tokio.

4 years agoempty_commit: PR 472 follows
Matt Corallo [Thu, 20 Feb 2020 20:02:01 +0000 (15:02 -0500)]
empty_commit: PR 472 follows

4 years agoMerge pull request #517 from ccdle12/2020-02-per-channel-config
Matt Corallo [Sat, 29 Feb 2020 03:10:54 +0000 (03:10 +0000)]
Merge pull request #517 from ccdle12/2020-02-per-channel-config

Add an override optional UserConfig per new outbound channel

4 years agoMerge pull request #507 from moneyball/patch-2
Matt Corallo [Sat, 29 Feb 2020 02:59:34 +0000 (02:59 +0000)]
Merge pull request #507 from moneyball/patch-2

Add project tracking and conventions we want to adopt

4 years agomade fixes per val and matt feedback
Steve Lee [Sat, 29 Feb 2020 01:01:16 +0000 (17:01 -0800)]
made fixes per val and matt feedback

4 years agoAdd an override optional UserConfig per new outbound channel
Christopher Coverdale [Tue, 25 Feb 2020 12:03:25 +0000 (12:03 +0000)]
Add an override optional UserConfig per new outbound channel

4 years agoMerge pull request #520 from TheBlueMatt/2020-02-events-in-monitors
Matt Corallo [Fri, 28 Feb 2020 20:10:38 +0000 (20:10 +0000)]
Merge pull request #520 from TheBlueMatt/2020-02-events-in-monitors

Move events into ChannelMonitor from ManyChannelMonitor

4 years agoAdd comment noting that ChannelMonitor events are serialized 2020-02-events-in-monitors
Matt Corallo [Fri, 28 Feb 2020 19:35:34 +0000 (14:35 -0500)]
Add comment noting that ChannelMonitor events are serialized

4 years agoDrop stale doc comment + TODO describing MessageSendEvents
Matt Corallo [Fri, 28 Feb 2020 19:28:13 +0000 (14:28 -0500)]
Drop stale doc comment + TODO describing MessageSendEvents

4 years agoMove events into ChannelMonitor from ManyChannelMonitor
Matt Corallo [Wed, 12 Feb 2020 21:55:04 +0000 (16:55 -0500)]
Move events into ChannelMonitor from ManyChannelMonitor

This is the next step after "Move pending-HTLC-updated ChannelMonitor
from ManyChannelMonitor", moving our events into ChannelMonitor as
well and leaving only new-outputs-to-watch in the return value for
ChannelMonitor::block_connected (which is fine as those are
duplicatively tracked in the ChannelMonitor directly, so
losing/replaying them is acceptable).

4 years agoImplement Readable/Writeable for Events
Matt Corallo [Wed, 12 Feb 2020 22:02:03 +0000 (17:02 -0500)]
Implement Readable/Writeable for Events

As noted in the docs, Events don't round-trip fully, but round-trip
in a way that is useful for ChannelManagers, specifically some events
don't make sense anymore after a restart.

4 years agoMerge pull request #522 from valentinewallace/chanmgr-fee-est-arc-to-deref
Matt Corallo [Fri, 28 Feb 2020 19:08:43 +0000 (19:08 +0000)]
Merge pull request #522 from valentinewallace/chanmgr-fee-est-arc-to-deref

Update ChannelManager's FeeEstimator from Arc to Deref.

4 years agoMerge pull request #521 from TheBlueMatt/2020-02-ping-connection-possible
Matt Corallo [Thu, 27 Feb 2020 21:12:23 +0000 (21:12 +0000)]
Merge pull request #521 from TheBlueMatt/2020-02-ping-connection-possible

Dont treat a timer tick as no_connection_possible

4 years agoDont treat a timer tick as no_connection_possible and log 2020-02-ping-connection-possible
Matt Corallo [Mon, 24 Feb 2020 23:47:38 +0000 (18:47 -0500)]
Dont treat a timer tick as no_connection_possible and log

In testing, due to other patches, I managed to flood the send queue
with messages and cause us not to be able to send pings, thus
getting a peer disconnected for ping timeout. To my surprise, this
also force-closed all of my channels with that peeer.

Obviously a ping timeout does not indicate that no future connection
with said peer will be possible, and we shouldn't be force-closing
channels as a result.

This also logs when a peer is disconnected to ping timeout to make
debug easier.

4 years agoAdd logging on receipt of unknown message types.
Matt Corallo [Mon, 24 Feb 2020 23:38:55 +0000 (18:38 -0500)]
Add logging on receipt of unknown message types.

This should make peer disconnection easier to debug.

4 years agoUpdate ChannelManager's FeeEstimator from Arc to Deref.
Valentine Wallace [Thu, 27 Feb 2020 16:33:03 +0000 (11:33 -0500)]
Update ChannelManager's FeeEstimator from Arc to Deref.

4 years agoMerge pull request #518 from valentinewallace/chanmgr-keysmgr-arc-to-deref
Matt Corallo [Thu, 27 Feb 2020 19:29:35 +0000 (19:29 +0000)]
Merge pull request #518 from valentinewallace/chanmgr-keysmgr-arc-to-deref

multi: update ChannelManager's keys manager from Arc to Deref

4 years agomulti: update ChannelManager's keys manager from Arc to Deref
Valentine Wallace [Wed, 26 Feb 2020 21:00:26 +0000 (16:00 -0500)]
multi: update ChannelManager's keys manager from Arc to Deref

4 years agoMerge pull request #489 from TheBlueMatt/2020-02-chan-updates
Matt Corallo [Thu, 27 Feb 2020 01:03:28 +0000 (01:03 +0000)]
Merge pull request #489 from TheBlueMatt/2020-02-chan-updates

Move to a Monitor-Update return from copying around ChannelMonitors

4 years agoDrop TODO which was implemented long ago 2020-02-chan-updates
Matt Corallo [Fri, 21 Feb 2020 22:10:03 +0000 (17:10 -0500)]
Drop TODO which was implemented long ago

4 years agoDrop Clone from ChannelMonitor.
Matt Corallo [Wed, 12 Feb 2020 20:47:04 +0000 (15:47 -0500)]
Drop Clone from ChannelMonitor.

This removes the somewhat-easy-to-misuse Clone from ChannelMonitors,
opening us up to being able to track Events in ChannelMonitors with
less risk of misuse.

Sadly it doesn't remove the Clone requirement for ChannelKeys,
though gets us much closer - we now just need to request a second
copy once when we go to create the ChannelMonitors.

4 years agoRm ChannelMonitor merge capabilities in favor of explicit add/update
Matt Corallo [Tue, 11 Feb 2020 23:34:29 +0000 (18:34 -0500)]
Rm ChannelMonitor merge capabilities in favor of explicit add/update

This removes the ability to merge ChannelMonitors in favor of
explicit ChannelMonitorUpdates. It further removes
ChannelManager::test_restore_channel_monitor in favor of the new
ChannelManager::channel_monitor_updated method, which explicitly
confirms a set of updates instead of providing the latest copy of
each ChannelMonitor to the user.

This removes almost all need for Channels to have the latest
channel_monitor, except for broadcasting the latest local state.

4 years agoCreate ChannelMonitors with basic_channel_info and funding_info set
Matt Corallo [Sat, 8 Feb 2020 22:45:40 +0000 (17:45 -0500)]
Create ChannelMonitors with basic_channel_info and funding_info set

This removes most of the reliance on ChannelMonitor Clone, creating
them in Channel only at the time when we need to start monitoring
the chain.

4 years agoUse ChannelMonitorUpdate in fallen-behind handling during reestablish
Matt Corallo [Sat, 8 Feb 2020 22:22:58 +0000 (17:22 -0500)]
Use ChannelMonitorUpdate in fallen-behind handling during reestablish

This is a rather huge diff, almost entirely due to removing the
type parameter from ChannelError which was added in
c20e930b31e973e0fb290322c9ac425002e3b672 due to holding the
ChannelKeys in ChannelMonitors.

4 years agoSet ChannelMonitor basic_channel_info on funding, not on accept
Matt Corallo [Sat, 8 Feb 2020 21:17:59 +0000 (16:17 -0500)]
Set ChannelMonitor basic_channel_info on funding, not on accept

This prepares for only creating the ChannelMonitor on funding by
removing any channel_monitor calls from Channel open/accept-time to
funding-signed time.

4 years agoUse ChannelMonitorUpdates in commitment signing fns in Channel
Matt Corallo [Sat, 8 Feb 2020 01:08:31 +0000 (20:08 -0500)]
Use ChannelMonitorUpdates in commitment signing fns in Channel

This is a rather big step towards using the new ChannelMonitorUpdate
flow, using it in the various commitment signing and commitment
update message processing functions in Channel. Becase they all
often call each other, they all have to be updated as a group,
resulting in the somewhat large diff in this commit.

In order to keep the update_ids strictly increasing by one for
ease of use on the user end, we have to play some games with the
latest_monitor_update_id field, though its generally still pretty
readable, and the pattern of "get an update_id at the start, and
use the one we got at the start when returning, irrespective of
what other calls into the Channel during that time did" is
relatively straightforward.

4 years agoImpl (de)serialization for bitcoin::Transaction.
Matt Corallo [Sat, 8 Feb 2020 01:05:37 +0000 (20:05 -0500)]
Impl (de)serialization for bitcoin::Transaction.

There is little risk of misusing this as there's not much in the
way of other ways you may want to serialize bitcoin::Transaction

4 years agoUpdate Channel::funding_signed to use ChannelMonitorUpdate
Matt Corallo [Thu, 6 Feb 2020 18:53:56 +0000 (13:53 -0500)]
Update Channel::funding_signed to use ChannelMonitorUpdate

This is the first of several steps to update ChannelMonitor updates
to use the new ChannelMonitorUpdate objects, demonstrating how the
new flow works in Channel.

4 years agoAdd types for updating ChannelMonitors without copying them.
Matt Corallo [Thu, 6 Feb 2020 00:39:31 +0000 (19:39 -0500)]
Add types for updating ChannelMonitors without copying them.

This is the first step in migrating ChannelMonitor updating logic
to use incremental Update objects instead of copying the
ChannelMonitors themselves and insert_combine()ing them.

This adds most of the scaffolding and updates relevant comments to
refer to the new architecture, without changing how any actual
updates occur.

4 years agoUse Channel::funding_txo instead of its channel_monitor.funding_txo
Matt Corallo [Thu, 6 Feb 2020 05:03:32 +0000 (00:03 -0500)]
Use Channel::funding_txo instead of its channel_monitor.funding_txo

Currently Channel relies on its own internal channel_monitor copy
to keep track of funding_txo information, which is both a bit
awkward and not ideal if we want to get rid of the ChannelMonitor
copy in Channel.

Instead, just duplicate it (its small) and keep it directly in
Channel, allowing us to remove the (super awkward)
ChannelMonitor::unset_funding_txo().

4 years agoTrack counterparty's commitment secrets in Channel directly.
Matt Corallo [Fri, 7 Feb 2020 22:48:46 +0000 (17:48 -0500)]
Track counterparty's commitment secrets in Channel directly.

In the process of removing a local ChannelMonitor in each Channel,
we need to track our counterpartys' commitment secrets so that we
can check them locally instead of calling our channel monitor to
do that work for us.

4 years agoSwap out ChannelMonitor remote secret tracking for a struct.
Matt Corallo [Fri, 7 Feb 2020 21:05:24 +0000 (16:05 -0500)]
Swap out ChannelMonitor remote secret tracking for a struct.

In order to drop the ChannelMonitor from Channel, we need to track
remote per_commitment_secrets outside of the monitor to validate new
ones as they come in.

This just moves the current code from ChannelMonitor into a new
CounterpartyCommitmentSecrets struct in chan_utils.

4 years agoClarify the in-flight HTLC state-tracking structs a bit.
Matt Corallo [Wed, 1 Jan 2020 20:56:03 +0000 (15:56 -0500)]
Clarify the in-flight HTLC state-tracking structs a bit.

This also renames PendingForwardHTLCInfo to PendingHTLCInfo since
it now also encompasses Pending *Received* HTLCs.

4 years agoMerge pull request #509 from valentinewallace/chanmgr-tx-broadcaster-to-deref
Matt Corallo [Wed, 26 Feb 2020 03:13:16 +0000 (03:13 +0000)]
Merge pull request #509 from valentinewallace/chanmgr-tx-broadcaster-to-deref

multi: update ChannelManager tx broadcaster from Arc to Deref

4 years agomulti: update ChannelManager tx broadcaster from Arc to Deref
Valentine Wallace [Thu, 20 Feb 2020 19:14:12 +0000 (14:14 -0500)]
multi: update ChannelManager tx broadcaster from Arc to Deref

4 years agoMerge pull request #515 from TheBlueMatt/2020-02-further-peer-docs
Matt Corallo [Mon, 24 Feb 2020 19:57:42 +0000 (19:57 +0000)]
Merge pull request #515 from TheBlueMatt/2020-02-further-peer-docs

Further clean up some comments wrt the peer socket handling API

4 years agoFurther clean up some comments wrt the peer socket handling API 2020-02-further-peer-docs
Matt Corallo [Mon, 24 Feb 2020 16:54:15 +0000 (11:54 -0500)]
Further clean up some comments wrt the peer socket handling API

4 years agoMerge pull request #512 from TheBlueMatt/2020-02-peer_handler-docs
Matt Corallo [Fri, 21 Feb 2020 19:02:21 +0000 (19:02 +0000)]
Merge pull request #512 from TheBlueMatt/2020-02-peer_handler-docs

Fix incorrect docs/disconnect handling in peer_handler

4 years agoMerge pull request #474 from TheBlueMatt/2020-02-htlc-updated-in-monitors
Matt Corallo [Fri, 21 Feb 2020 18:50:45 +0000 (18:50 +0000)]
Merge pull request #474 from TheBlueMatt/2020-02-htlc-updated-in-monitors

Move pending-HTLC-updated ChannelMonitor from ManyChannelMonitor

4 years agoFix incorrect docs around disconnect in peer_handler + rename fns 2020-02-peer_handler-docs
Matt Corallo [Thu, 20 Feb 2020 20:12:42 +0000 (15:12 -0500)]
Fix incorrect docs around disconnect in peer_handler + rename fns

The way PeerHandler was written, it was supposed to remove from
self.peers iff the API docs indicate that disconnect_event should
NOT be called (and otherwise rely on disconnect_event to do so).

Sadly, the implementation was way out of whack with reality - in
the implementation, essentially anywhere where PeerHandler
originated the disconnection, the peer was removed and no
disconnect_event was expected. The docs, however, indicated that
disconnect_event should nearly only be called, only not doing so
when the initial handshake message never completed.

We opt to change the docs, mostly, as well as clean up the
ping/pong handling somewhat and rename a few functions to clarify
what they actually do.

4 years agoTest basic HTLC claim behavior from monitor -> manager on reorg 2020-02-htlc-updated-in-monitors
Matt Corallo [Tue, 18 Feb 2020 22:57:15 +0000 (17:57 -0500)]
Test basic HTLC claim behavior from monitor -> manager on reorg

4 years agoMove pending-HTLC-updated ChannelMonitor from ManyChannelMonitor
Matt Corallo [Tue, 4 Feb 2020 04:46:29 +0000 (23:46 -0500)]
Move pending-HTLC-updated ChannelMonitor from ManyChannelMonitor

This is important for a number of reasons:
 * Firstly, I hit this trying to implement rescan in the demo
   bitcoinrpc client - if individual ChannelMonitors are out of
   sync with each other, we cannot add them all into a
   ManyChannelMonitor together and then rescan, but need to rescan
   them individually without having to do a bunch of manual work.
   Of the three return values in ChannelMonitor::block_connected,
   only the HTLCsource stuff that is moved here makes no sense to
   be exposed to the user.
 * Secondly, the logic currently in ManyChannelMonitor cannot be
   reproduced by the user! HTLCSource is deliberately an opaque
   type but we use its data to decide which things to keep when
   inserting into the HashMap. This would prevent a user from
   properly implementing a replacement ManyChannelMonitor, which is
   unacceptable.
 * Finally, by moving the tracking into ChannelMonitor, we can
   serialize them out, which prevents us from forgetting them when
   loading from disk, though there are still other races which need
   to be handled to make this fully safe (see TODOs in
   ChannelManager).

This is safe as no two entries can have the same HTLCSource across
different channels (or, if they did, it would be a rather serious
bug), though note that, IIRC, when this code was added, the
HTLCSource field in the values was not present.

We also take this opportunity to rename the fetch function to match
our other event interfaces, makaing it clear that by calling the
function the set of HTLCUpdates will also be cleared.

4 years agoMerge pull request #514 from TheBlueMatt/2020-02-no-lto-travis-fuzz
Matt Corallo [Fri, 21 Feb 2020 01:30:17 +0000 (01:30 +0000)]
Merge pull request #514 from TheBlueMatt/2020-02-no-lto-travis-fuzz

Skip lto on travis when building fuzz targets as it takes 30 min

4 years agoSkip lto on travis when building fuzz targets as it takes 30 min 2020-02-no-lto-travis-fuzz
Matt Corallo [Fri, 21 Feb 2020 01:02:26 +0000 (20:02 -0500)]
Skip lto on travis when building fuzz targets as it takes 30 min

4 years agoMerge pull request #510 from TheBlueMatt/2020-02-fewer-fuzz-rustc-warns
Matt Corallo [Thu, 20 Feb 2020 22:29:10 +0000 (22:29 +0000)]
Merge pull request #510 from TheBlueMatt/2020-02-fewer-fuzz-rustc-warns

Silence new rustc warnings re: extra ()s, dyn, and unused params

4 years agoMerge pull request #511 from TheBlueMatt/2020-02-test-pub-in-test-only
Matt Corallo [Thu, 20 Feb 2020 21:12:10 +0000 (21:12 +0000)]
Merge pull request #511 from TheBlueMatt/2020-02-test-pub-in-test-only

Only expose constants exposed for testing in cfg(test)

4 years agoOnly expose constants exposed for testing in cfg(test) 2020-02-test-pub-in-test-only
Matt Corallo [Fri, 17 Jan 2020 19:15:07 +0000 (14:15 -0500)]
Only expose constants exposed for testing in cfg(test)

4 years agoSilence new rustc warnings re: extra ()s, dyn, and unused params 2020-02-fewer-fuzz-rustc-warns
Matt Corallo [Thu, 16 Jan 2020 18:54:38 +0000 (13:54 -0500)]
Silence new rustc warnings re: extra ()s, dyn, and unused params

4 years agoMerge pull request #506 from arik-so/ping_encryption_fix
Matt Corallo [Thu, 20 Feb 2020 19:50:20 +0000 (19:50 +0000)]
Merge pull request #506 from arik-so/ping_encryption_fix

Encrypt ping messages before sending them

4 years agoRemove unused code in peer handler test utility method.
Arik Sosman [Thu, 20 Feb 2020 01:57:03 +0000 (17:57 -0800)]
Remove unused code in peer handler test utility method.

4 years agoMerge pull request #508 from maxgiraldo/2020-02-sp-grammar
Matt Corallo [Thu, 20 Feb 2020 00:10:15 +0000 (00:10 +0000)]
Merge pull request #508 from maxgiraldo/2020-02-sp-grammar

docs(CONTRIBUTING): fix spelling and grammar

4 years agoFix ping message sent on timer ticks to be encrypted so the peer can decrypt it inste...
Arik Sosman [Tue, 18 Feb 2020 22:16:33 +0000 (14:16 -0800)]
Fix ping message sent on timer ticks to be encrypted so the peer can decrypt it instead of shutting down the connection.

4 years agodocs(CONTRIBUTING): fix spelling and grammar
Max Giraldo [Wed, 19 Feb 2020 21:56:43 +0000 (16:56 -0500)]
docs(CONTRIBUTING): fix spelling and grammar

Fix some minor spelling and grammar mistakes.

4 years agoMerge pull request #502 from rloomba/rloomba/add_unregister_listener
Matt Corallo [Wed, 19 Feb 2020 19:02:47 +0000 (19:02 +0000)]
Merge pull request #502 from rloomba/rloomba/add_unregister_listener

[chaininterface] Add ability for BlockNotifier to unregister listeners

4 years agoAdd project tracking and conventions we want to adopt
Steve Lee [Wed, 19 Feb 2020 01:04:55 +0000 (17:04 -0800)]
Add project tracking and conventions we want to adopt

4 years agoMerge pull request #503 from TheBlueMatt/2020-02-chanmon-ser-roundtrip
Matt Corallo [Wed, 19 Feb 2020 00:26:47 +0000 (00:26 +0000)]
Merge pull request #503 from TheBlueMatt/2020-02-chanmon-ser-roundtrip

Fix Two Bugs around ChannelManager serialization round-trip

4 years agoMerge pull request #455 from TheBlueMatt/2020-01-monitor-reload-watch
Matt Corallo [Wed, 19 Feb 2020 00:06:26 +0000 (00:06 +0000)]
Merge pull request #455 from TheBlueMatt/2020-01-monitor-reload-watch

Track the full list of outpoints a chanmon wants monitoring for

4 years agoAllow deserialization of new Channels before we've seen a block 2020-02-chanmon-ser-roundtrip
Matt Corallo [Sat, 15 Feb 2020 17:12:50 +0000 (12:12 -0500)]
Allow deserialization of new Channels before we've seen a block

Previously, if we have a live ChannelManager (that has seen blocks)
and we open a new Channel, if we serialize that ChannelManager
before a new block comes in, we'll fail to deserialize it. This is
the result of an overly-ambigious last_block_connected check which
would see 0s for the new channel but the previous block for the
ChannelManager as a whole.

We add a new test which catches this error as well as hopefully
getting some test coverage for other similar issues in the future.

4 years agoFix serialization rt bug in Channel and test in functional_tests
Matt Corallo [Mon, 17 Feb 2020 18:50:46 +0000 (13:50 -0500)]
Fix serialization rt bug in Channel and test in functional_tests

Previously, when attempting to write out a channel with some
RemoteAnnounced pending inbound HTLCs, we'd write out the count
without them, but write out some of their fields. We should drop
them as intended as they will need to be reannounced upon
reconnection.

This was found while attempting to simply reproduce a different
bug by adding tests for ChannelManager serialization rount-trip at
the end of each functional_test (in Node::drop). That test is
included here to prevent some classes of similar bugs in the future.

4 years agoAdd comment describing how ChannelMonitor::block_connected is called 2020-01-monitor-reload-watch
Matt Corallo [Mon, 10 Feb 2020 22:44:56 +0000 (17:44 -0500)]
Add comment describing how ChannelMonitor::block_connected is called

4 years agoTest that we don't forget to track any outputs at monitor-load
Matt Corallo [Tue, 21 Jan 2020 03:13:44 +0000 (22:13 -0500)]
Test that we don't forget to track any outputs at monitor-load

This tests, after each functional test, that if we serialize and
reload all of our ChannelMonitors we end up tracking the same set
of outputs as before.

4 years agoTrack the full list of outpoints a chanmon wants monitoring for.
Matt Corallo [Tue, 21 Jan 2020 03:05:29 +0000 (22:05 -0500)]
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.

4 years agoadd functionality for BlockNotifier to unregister a previously registered listener...
Ryan Loomba [Sat, 15 Feb 2020 08:04:09 +0000 (00:04 -0800)]
add functionality for BlockNotifier to unregister a previously registered listener, in order to no longer receive events

4 years agoMerge pull request #440 from TheBlueMatt/2020-01-feature-sanity
Matt Corallo [Mon, 17 Feb 2020 23:47:06 +0000 (23:47 +0000)]
Merge pull request #440 from TheBlueMatt/2020-01-feature-sanity

Fix a bug in required feature checks

4 years agoMerge pull request #499 from moneyball/patch-1
Matt Corallo [Mon, 17 Feb 2020 20:06:11 +0000 (20:06 +0000)]
Merge pull request #499 from moneyball/patch-1

add clarity to the language

4 years agofixes per rloomba feedback
Steve Lee [Sat, 15 Feb 2020 19:45:11 +0000 (11:45 -0800)]
fixes per rloomba feedback

4 years agoMerge pull request #501 from TheBlueMatt/2020-02-rescan-clarify
Matt Corallo [Sat, 15 Feb 2020 01:36:56 +0000 (01:36 +0000)]
Merge pull request #501 from TheBlueMatt/2020-02-rescan-clarify

Clarify rescan rules for block_connected somewhat

4 years agofixes per arik feedback
Steve Lee [Fri, 14 Feb 2020 02:43:58 +0000 (18:43 -0800)]
fixes per arik feedback

4 years agoClarify rescan rules for block_connected somewhat 2020-02-rescan-clarify
Matt Corallo [Thu, 13 Feb 2020 17:55:44 +0000 (12:55 -0500)]
Clarify rescan rules for block_connected somewhat

4 years agoadd clarity to the language
Steve Lee [Thu, 13 Feb 2020 03:36:08 +0000 (19:36 -0800)]
add clarity to the language

4 years agoAdd some basic sanity tests for feature flags 2020-01-feature-sanity
Matt Corallo [Tue, 7 Jan 2020 18:58:50 +0000 (13:58 -0500)]
Add some basic sanity tests for feature flags

4 years agoAvoid treating option_upfront_shutdown (req) as unknown_required.
Matt Corallo [Tue, 7 Jan 2020 02:50:55 +0000 (21:50 -0500)]
Avoid treating option_upfront_shutdown (req) as unknown_required.

This fixes the bitmask in requires_unknown_bits.

4 years agoMerge pull request #470 from ariard/2020-01-contributing-draft
Matt Corallo [Wed, 12 Feb 2020 19:31:26 +0000 (19:31 +0000)]
Merge pull request #470 from ariard/2020-01-contributing-draft

First draft, don't-cover-everything-but-yet-a-good-start-CONTRIBUTING.md

4 years agoMerge pull request #496 from TheBlueMatt/2020-02-461-extra-mut
Matt Corallo [Wed, 12 Feb 2020 18:53:36 +0000 (18:53 +0000)]
Merge pull request #496 from TheBlueMatt/2020-02-461-extra-mut

Remove unnecessary mut introduced in 0c595a7ff69bd177b2e7fa8c1b361

4 years agoAdd a first draft CONTRIBUTING.md
Antoine Riard [Wed, 12 Feb 2020 18:31:37 +0000 (13:31 -0500)]
Add a first draft CONTRIBUTING.md

4 years agoRemove unnecessary mut introduced in 0c595a7ff69bd177b2e7fa8c1b361 2020-02-461-extra-mut
Matt Corallo [Wed, 12 Feb 2020 18:00:43 +0000 (13:00 -0500)]
Remove unnecessary mut introduced in 0c595a7ff69bd177b2e7fa8c1b361

4 years agoMerge pull request #461 from ariard/2020-remove-duplicata
Matt Corallo [Wed, 12 Feb 2020 17:38:21 +0000 (17:38 +0000)]
Merge pull request #461 from ariard/2020-remove-duplicata

Remove some duplicata of broadcast txn from ChannelMonitor

4 years agoRemove duplicata of broadcast txn from ChannelMonitor
Antoine Riard [Thu, 23 Jan 2020 21:45:14 +0000 (16:45 -0500)]
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.

4 years agoMerge pull request #434 from TheBlueMatt/2019-12-var-len-onion
Matt Corallo [Tue, 11 Feb 2020 22:49:39 +0000 (22:49 +0000)]
Merge pull request #434 from TheBlueMatt/2019-12-var-len-onion

TLV-based Variable Length Onion

4 years agoDefine a BLOCK_SIZE constant for chacha20 2019-12-var-len-onion
Matt Corallo [Mon, 10 Feb 2020 23:32:57 +0000 (18:32 -0500)]
Define a BLOCK_SIZE constant for chacha20

4 years agoSwap out 20*65 for a constant, given onion hops are now of var len
Matt Corallo [Mon, 10 Feb 2020 23:28:53 +0000 (18:28 -0500)]
Swap out 20*65 for a constant, given onion hops are now of var len

4 years agoUse RouteHop's new node_features to send TLV-encoded onion hops
Matt Corallo [Sat, 28 Dec 2019 18:44:47 +0000 (13:44 -0500)]
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).

4 years agoAdd support for variable-length onion payload reads using TLV
Matt Corallo [Fri, 27 Dec 2019 22:44:46 +0000 (17:44 -0500)]
Add support for variable-length onion payload reads using TLV

4 years agoAdd macros for building TLV (de)serializers.
Matt Corallo [Mon, 3 Feb 2020 01:44:54 +0000 (20:44 -0500)]
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).

4 years agoExpose VecWriter outside of util::ser since peer_handler uses it
Matt Corallo [Mon, 3 Feb 2020 02:25:33 +0000 (21:25 -0500)]
Expose VecWriter outside of util::ser since peer_handler uses it

4 years agoAdd new streams and serialization wrappers for TLV types.
Matt Corallo [Mon, 3 Feb 2020 01:42:40 +0000 (20:42 -0500)]
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.

4 years agoAdd a ChaChaReader adapter to read an encrypted stream & use it
Matt Corallo [Fri, 27 Dec 2019 22:38:15 +0000 (17:38 -0500)]
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.

4 years agoMove BogusHopData generation into test instead of OnionHopData.
Matt Corallo [Thu, 26 Dec 2019 18:45:44 +0000 (13:45 -0500)]
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.

4 years agoPull hmac out of OnionHopData.
Matt Corallo [Thu, 26 Dec 2019 18:43:43 +0000 (13:43 -0500)]
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.

4 years agoFlatten OnionHopData struct with the Realm0 struct.
Matt Corallo [Tue, 24 Dec 2019 20:52:47 +0000 (15:52 -0500)]
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.

4 years agoBetter document msg fuzz target behavior and be slightly more strict
Matt Corallo [Fri, 27 Dec 2019 22:29:51 +0000 (17:29 -0500)]
Better document msg fuzz target behavior and be slightly more strict

4 years agoMerge pull request #491 from TheBlueMatt/2020-02-one-conf-lock
Matt Corallo [Tue, 11 Feb 2020 05:36:01 +0000 (05:36 +0000)]
Merge pull request #491 from TheBlueMatt/2020-02-one-conf-lock

Fix one-confirmation funding_locked generation

4 years agoMerge pull request #490 from jkczyz/2020-02-initial-routing-sync
Matt Corallo [Mon, 10 Feb 2020 22:18:48 +0000 (22:18 +0000)]
Merge pull request #490 from jkczyz/2020-02-initial-routing-sync

Refactor logic for setting initial_routing_sync feature bit

4 years agoAdd some trace logging for funding_locked and announcement_sigs 2020-02-one-conf-lock
Matt Corallo [Mon, 10 Feb 2020 20:50:47 +0000 (15:50 -0500)]
Add some trace logging for funding_locked and announcement_sigs