Commit Graph

226 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
1fd3aac925
multi: switch from bolt packge to bbolt package for all imports 2018-11-29 20:33:49 -08:00
Olaoluwa Osuntokun
f60012b3f9
Merge pull request #2027 from mrwhythat/no-incoming-push-amounts-option
Option to disable incoming push amounts on channel opening
2018-11-02 17:08:05 -07:00
whythat
2c9a039845 config: add option to disable incoming push amounts in OpenChannel
This is useful for merchant-side prevention of accidental pushes
during channel opening.
2018-11-02 01:54:02 +02:00
Wilmer Paulino
a15be80a45
fundingmanager: identify tx on funding broadcast error 2018-10-26 10:07:36 -07:00
Wilmer Paulino
85cdb18b73
fundingmanager: send NodeAnnouncement to unadvertised channel counterparty
In this commit, we modify the funding manager to send our
NodeAnnouncement to our channel counterparty in the event of an
unadvertised channel. We do this to ensure that our counterparty learns
about some information about us that may aid them in one way or another
(e.g., addresses to reconnect, features supported, etc.).
2018-10-24 19:20:01 -07:00
Conner Fromknecht
10b35a8f20
main: remove disable log in testing + clean up imports 2018-10-05 13:04:45 +09:00
Johan T. Halseth
addb4aed89
funding+server: make FindChannel return OpenChannel instead of LightningChannel 2018-09-28 08:59:27 +02:00
Olaoluwa Osuntokun
b343ef24e7
cmd/lncli+fundingmanager: use a default num min confs for 1 for openchannel 2018-09-08 14:41:03 -07:00
Olaoluwa Osuntokun
0e510c8b5c
funding+peer: don't attempt to deliver messages if the peer is shutting down 2018-08-25 17:30:11 -07:00
Olaoluwa Osuntokun
0b5a403fce
funding: add caller quit channel to waitUntilChannelOpen
In this commit, we add a caller quit channel to waitUntilChannelOpen.
This ensures that the caller won't block forever if it needs to exit
before the funding manager exits, or the channel barrier is actually
closed.
2018-08-25 17:30:04 -07:00
Olaoluwa Osuntokun
a1a6845fb5
Merge pull request #1731 from halseth/link-policy-persist
Correctly apply min_htlc to forwarding policy
2018-08-23 19:21:44 -07:00
Johan T. Halseth
e174fbd759
fundingmanager: use value the _remote_ require us to use in ChannelUpdate
This commit fixes a bug that would make us advertise the remote's
min_htlc value in our channel update.

The min_htlc value is set by a node Alice to limit its exposure to small
HTLCs, and the channel counter party should not forward HTLCs of value
smaller than this to Alice. This means that the value a node Bob should
advertise in its ChannelUpdate, is the min_htlc value the counter party
require all HTLCs to be above.

Instead of populating the ChannelUpdate with the MinHtlc value found in
the remote constraints, we now use the value from the local constraints.
2018-08-23 07:50:17 +02:00
Johan T. Halseth
0c65719613
fundingmgr: check quit channel when sending update
Avoids deadlock during failing fundingmanager tests.
2018-08-23 07:50:16 +02:00
Johan T. Halseth
67d36eb79d
funding: make SendAnnouncement return error chan instead of error 2018-08-23 07:40:41 +02:00
Wilmer Paulino
ae3e66dccc
fundingmanager+lnwallet: allow specifying number of min confs for coin selection 2018-08-16 20:19:30 -07:00
Wilmer Paulino
d76f97d497
fundingmanager+lnwallet: make InitChannelReservation take in req rather than many args 2018-08-16 20:19:25 -07:00
Olaoluwa Osuntokun
bd62ef6411
funding: properly log pubkey of peer within handleInitFundingMsg
Before this commit, we would log the struct of the pubkey, rather than
the serialized compressed version.
2018-08-15 21:41:53 -07:00
Olaoluwa Osuntokun
ad25ae1a07
keychain: ensure we properly set the KeyLocator for keys from DeriveNextKey
In this commit, we fix a slight bug in the existing implementation of
DeriveNextKey for btcwallet. Before this commit, we would only set the
public key, and not also the derivation path. It's important that we
also set the path information, as in the near future we'll be using the
KeyDescriptors returned from this method to create static channel back
ups. With these static backups, the key alone may be insufficient to
re-derive the private key as we may need to fallback to brute forcing in
order to re-derive the key as it's possible we add new key families in
the future.
2018-08-14 19:11:40 -07:00
Olaoluwa Osuntokun
c37c9db2de
funding: properly set auxiliary channel recovery info in close chan summaries 2018-08-14 19:11:40 -07:00
Valentine Wallace
1ffc3bb82e
multi: update to latest RegisterBlockEpochNtfn interface 2018-08-10 01:08:57 -07:00
Olaoluwa Osuntokun
d2612e51bd
Merge pull request #1644 from wpaulino/kw-fees
multi: switch to sat/kw fees
2018-08-09 20:19:28 -07:00
Olaoluwa Osuntokun
d64bb5921e
Merge pull request #1635 from halseth/funding-broadcast-fail
Move funding tx broadcasting to Fundingmanager
2018-08-09 20:04:30 -07:00
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -07:00
Olaoluwa Osuntokun
8aef43360f
funding: update fundingManager to register for conf's using pkScripts 2018-07-31 21:28:51 -07:00
Johan T. Halseth
8b6e7b24aa
fundingmanager: count channels pending open when checking MaxPending 2018-07-31 14:53:22 +02:00
Johan T. Halseth
2a77b57788
lnwallet + funding: move funding tx publish to fundingmgr
This commit moves the responsibility for publishing the funding tx to
the network from the wallet to the funding manager. This is done to
distinguish the failure of completing the reservation within the wallet
and failure of publishing the transaction.

Earlier we could fail to broadcast the transaction, which would cause us
to fail the funding flow. This is not something we can do directly,
since the CompeteReservation call will mark the channel IsPending in the
databas.e
2018-07-31 14:53:21 +02:00
Johan T. Halseth
8865bcf3d9
fundingmanager: delete active reservation after channel is in DB
This commit makes sure we delete a pending channel from the set of
activeReservations within the fundingmanager immediately after the
channel is moved to the openChannelBucket in the DB. Previously we
wouldn't do this before the funding tx was confirmed, making it possible
that failing the funding flow at a later point would try to cancel a
non-existent reservation context.
2018-07-31 14:53:21 +02:00
Wilmer Paulino
38e01b259f
fundingmanager+lnd: remove no longer needed FindPeer and SendToPeer
callbacks

The FindPeer and SendToPeer callbacks are no longer needed within the
fundingManager due to the previous commit allowing us to send messages
to peers directly.
2018-07-19 12:34:12 -07:00
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