Commit Graph

198 Commits

Author SHA1 Message Date
Wilmer Paulino
9cedef9245
fundingmanager: send messages to peers directly
In this commit, we modify the existing message sending functionality
within the fundingmanager. Due to each mesage send requiring to hold the
server's lock to retrieve the peer, we might run into a case where the
lock is held for a larger than usual amount of time and would therefore
block on sending the message within the fundingmanager. We remedy this
by taking a similar approach to some recent changes within the gossiper.
We now keep track of each peer within the internal fundingmanager
messages and send messages directly to them.
2018-07-19 12:34:11 -07:00
Wilmer Paulino
e669e90017
fundingmanager: retrieve peer before resuming funding flow 2018-07-19 12:34:10 -07:00
Wilmer Paulino
6504a9cfa8
fundingmanager+peer: modify fundingErrorMsg to use peer key 2018-07-19 12:32:31 -07:00
Wilmer Paulino
6b1982f50f
fundingmanager+lnd: modify WatchNewChannel callback to take in peer key 2018-07-19 12:32:30 -07:00
Wilmer Paulino
8c92df0f47
fundingmanager: return ErrFundingManagerShuttingDown on shutdown 2018-07-19 12:32:13 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Wilmer Paulino
a7e0d3f57b
fundingmanager: determine our dust limit based on active chain
In this commit, we fix an issue where we would always assume the dust
limit was Bitcoin's dust limit, rather than the active chain. This would
lead to issues when attempting to open channels on the Litecon chain.
2018-07-06 12:28:09 -07:00
Wilmer Paulino
b1ba83bf2b
peer: prevent processing close msg if channel is not found 2018-06-25 13:13:12 -07:00
Johan T. Halseth
b56d922ce2
fundingmanager: properly stop channel on error 2018-06-19 12:48:38 +01:00
Olaoluwa Osuntokun
8f68d0e605
funding+htlcswitch: enforce min fee rate of 253 sat/kw on commitments
In this commit, we add and enforce a min fee rate for commitment
transactions created, and also any updates we propose to the remote
party. It's important to note that this is only a temporary patch, as
nodes can dynamically raise their min fee rate whenever their mempool is
saturated.

Fixes #1330.
2018-06-05 17:50:50 -07:00
Johan T. Halseth
cdaafc4a23
fundingmanager: hold mutex during ctx cancellation
This commit changes cancelReservationCtx to gold the resMtx from start
to finish. Earlier it would lock at different times only when accessing
the maps, meaning that other goroutines (I'm looking at you
PeerTerminationWatcher) could come in and grab the context in between
locks, possibly leading to a race.
2018-06-01 09:19:01 +02:00
Johan T. Halseth
d20cb8e2f6
fundingmanager: send on resCtx.err in failFundingFlow
This commit moves the responsibility of sending a funding error on the
reservation error channel inside failFundingFlow, reducing the places we
need to keep track of sending it.
2018-06-01 08:55:07 +02:00
Johan T. Halseth
9090344329
fundingmanager: simplify handleErrorMsg 2018-06-01 08:55:07 +02:00
Johan T. Halseth
7d38e35cdc
fundingmanager: send error directly in CancelPeerReservations
The error channel should never be nil, and it should always be buffered.
Because of this we can send directly on the channel.
2018-06-01 08:55:07 +02:00
Johan T. Halseth
b63ee1a410
fundingmanager: fail funding flow on confirmation timeout 2018-06-01 08:55:07 +02:00
Johan T. Halseth
ccf9cd47ef
fundingmanager: delete empty peer in deleteReservationCtx 2018-06-01 08:55:06 +02:00
Johan T. Halseth
6ee58ec1b0
fundingmanager: don't block on pendingChannels chan send 2018-06-01 08:55:06 +02:00
Johan T. Halseth
5ddb154a45
fundingmanager: use non-zero channel ID 2018-06-01 08:55:06 +02:00
Wilmer Paulino
e363766394
multi: increase max funding and payment amount 60x under Litecoin 2018-05-25 00:11:20 -04:00
Wilmer Paulino
3a982063a0
fundingmanager+lnwallet: ensure proposed channel reserve is above dust limit 2018-05-14 14:20:20 -04:00
Wilmer Paulino
2e076ba21e
fundingmanager+lnd: propose remote channel reserve above dust limit 2018-05-14 14:20:19 -04:00
Conner Fromknecht
2f52e29a5b
fundingmanager: remove sid arg from ReportShortChanID 2018-05-09 16:07:52 -07:00
Johan T. Halseth
c3f0e608ec
fundingmanager: remove ArbiterChan 2018-05-02 08:43:31 +02:00
Conner Fromknecht
5c43e0ad02
fundingmanager: fixes range-goroutine scoping bug
This commit fixes an issue in funding manager startup,
where a goroutine reads from a range value. The method in
question could cause a channel to be announced at the
wrong time.

This may have been a cause for certain channels having
phantom HTLCs before they had even received the funding
locked message from the remote peer.

This is fixed simply by using the locally scoped
variable passed in as an argument to the goroutine.
2018-04-09 16:55:41 -07:00
Johan T. Halseth
ca0b4cb8c5
fundingmanager: preserve remote MinHtlc during funding flow
This commit fixes a bug within the funding manager, where we would use
the wrong min_htlc_value parameter. Instead of attributing the custom
passed value for MinHtlc to the remote's constraints, we would add it to
our own constraints.
2018-04-06 10:02:19 +02:00
Johan T. Halseth
7a4817b066
fundingmanager: preserve custom remoteCsvDelay
This commit fixes a bug that would cause the local and remote commitment
to be incompatible when using custom remote CSV delay when opening a
channel. This would happen because we wouldn't store the CSV value
before we received the FundingAccept message, and here we would use the
default value.

This commit fixes this by making the csv value part of the
reservationWithCtx struct, such that it can be recorded for use when the
FundingAccept msg comes back.
2018-04-06 10:02:19 +02:00
Olaoluwa Osuntokun
b422e4ec1e
lnwallet+funding+lnd: add new config option for min accepted channel size
In this commit we add a new command line option (and a sane default) to
allow users to specify the *smallest* inbound channel that they'll
accept. Having a higher-ish limit lets users limit their channels, and
also avoid a series of very low value "spam" channels.

The new option is --minchansize, and expressed in satoshis. If we
receive an inbound channel request for a value smaller than this, then
we'll immediately reject it.
2018-04-02 16:17:58 -07:00
Olaoluwa Osuntokun
6be6b48e09
Merge pull request #840 from halseth/openchannel-csv-delay
Add CSV delay flag to openchannel
2018-03-31 16:05:08 -07:00
Olaoluwa Osuntokun
956d20ebdc
funding+lnd: ensure we reconnect to new channel peers
In this commit, we fix a minor bug in the prior versions of lnd. Before
this commit, if we received a new inbound connection for channel
creation, the channel was created, and then the peer disconnected, we
wouldn't automatically reconnect.

In this commit we fix this issue by overloading the WatchNewChannel
method to also accept the peer's ID so we can add it to the set of
persistent connections.
2018-03-30 18:42:40 -07:00
Olaoluwa Osuntokun
71b8195ad0
funding: remove old TODO 2018-03-30 15:57:19 -07:00
Johan T. Halseth
a848a58749
funding: use remoteCsvDelay from openChanReq if specified 2018-03-22 14:54:00 +01:00
Olaoluwa Osuntokun
8127685462
funding+rpc: raise min channel size to 20k satoshis
In this commit, we raise the min channel size to 20k satoshis. This
will be evaluated before we check for dusty commitments. The goal of
this is to ensure ample room for fees at current, and future fee
levels.
2018-03-18 17:10:25 -07:00
Conner Fromknecht
8cecdc54cf
fundingmanager: adds default ltc funding constraints 2018-03-14 16:57:42 -07:00
Olaoluwa Osuntokun
90ecc380ce
funding: fix race conditions in tests by guarding r.lastUpdated w/ a mtx 2018-03-13 18:13:10 -07:00
Olaoluwa Osuntokun
0befe41384
Merge pull request #782 from paddyquinn/master
funding: implement reservation zombie sweeper
2018-03-13 17:07:53 -07:00
PaddyQuinn
75e45b830b funding: implement reservation zombie sweeper
Before previous commits were squashed into this commit, zombie
reservations were cleaned up individually when they timed out.
However, this made the code more complex because each reservation
had its own individual timer and thus it would have required the
timer being cancelled any time the reservation was cancelled,
which would have been harder to maintain. With this commit,
zombie reservations are cleaned up by a zombie sweeper that is
set off by a ticker instead, to make the code more maintainable.
2018-03-12 21:58:51 -04:00
Olaoluwa Osuntokun
f2b676e93c
Merge pull request #790 from halseth/wire-error-handoff
Wire error handoff
2018-03-12 18:56:35 -07:00
Conner Fromknecht
b635b83abd
fundingmanager: rebroadcast iniatior's funding txn on restart
This commit alters the behavior of the fundingmanager to
rebroadcast the funding transaction of all pending-open
channels upon restart. This is applied only to single-funder
channels for which we are the initiator, and helps ensure that
funding txns do not get stuck in the face of failures or restarts.
2018-03-11 13:58:40 -07:00
Johan T. Halseth
f1f1a38663
funding: add method IsPendingChannel 2018-03-11 17:20:28 +01:00
Johan T. Halseth
7252dbd934
funding: add missing mutex around activeReservations 2018-03-11 17:20:28 +01:00
Olaoluwa Osuntokun
800eea931f
build+multi: switch from bolt to bbolt
In this commit, we switch from boltbd/bolt to coreos/bbolt as the
former is no longer being actively maintained.
2018-03-10 19:01:13 -08:00
Olaoluwa Osuntokun
e184bbcb54
funding: don't case to a net.TCPAddr to support tor stream isolation
In this commit, we fix an existing bug in the funding manager, that can
be triggered if the user is connecting to a node over Tor, and then
attempts to open a channel. An existing fix was added for the case that
the receiving node established the channel, but this now makes that case
symmetric.
2018-03-09 14:22:23 -08:00
Olaoluwa Osuntokun
116406c7ec
Merge pull request #769 from Roasbeef/new-lightning-key-derivation
multi: modify key derivation to be fully deterministic, remove p2pkh, wallet now witness only
2018-03-06 17:21:55 -05:00
Olaoluwa Osuntokun
4b20e805fe
multi: update packages due to recent SignDescriptor and WalletController changes 2018-03-06 16:04:03 -05:00
Johan T. Halseth
6942e1479d
funding: only send know errors across wire
This commit changes the failFundingFlow to accept an error, which will
only be sent to the remote the peer if it is among the
ReservationErrors or ErrorCode. This is done to ensure we don't send
errors that contain information we don't want to leak.
2018-03-06 22:02:35 +01:00
Olaoluwa Osuntokun
f7ec490f44
Merge pull request #762 from halseth/fee-estimator
Add types for representing fee rates
2018-02-26 17:22:50 -08:00
John Griffith
63ee31b83f fundingmanager: Added additional check so that pending channels don't
timeout for the channel initiator
2018-02-26 16:44:34 -08:00
Johan T. Halseth
2a9aa092d8
fundingmanager: express fee rates using types, use EstimateFeePerVSize 2018-02-26 22:42:26 +01:00
Johan T. Halseth
b0d1be282c
fundingmanager: cancel reservation if unable to send initial msg to peer 2018-02-23 15:41:32 +01:00
Johan T. Halseth
ff1dc2bbd4
funding: ensure we fail funding flow if unable to query wallet 2018-02-23 15:41:32 +01:00