Commit Graph

6518 Commits

Author SHA1 Message Date
Conner Fromknecht
99dbbf48aa
watchtower/wtwire/error_code: add human-readable descriptors 2019-03-15 02:29:55 -07:00
Conner Fromknecht
9c70f49901
watchtower/wtwire/create_session_reply: remove extra Reject from code 2019-03-15 02:29:42 -07:00
Olaoluwa Osuntokun
36cc1da8ea
Merge pull request #2633 from halseth/autpilot-chansize-allocation
[autopilot] distribute available funds among channels
2019-03-14 12:51:02 -07:00
Johan T. Halseth
fb5b6ff425
autopilot/agent_test: add TestAgentChannelSizeAllocation
TestAgentChannelSizeAllocation tests that the autopilot agent opens
channel of size that stays within the channel budget and size
restrictions.
2019-03-14 08:49:28 +01:00
Johan T. Halseth
b71f4632a6
autopilot/agent_test: define testCtx, setup, other helpers
This commit defines a set of helper methods that are used by many of the existing tests.
2019-03-14 08:49:28 +01:00
Johan T. Halseth
4a1e06b204
autopilot/agent: distribute available funds among channels
This commit fixes a regression in how we allocate funds to attempted
channels. We would earlier stay within the channel size limits, but we
wouldn't account for funds consumed by other channels being opened in
parallel.

We fix this by introducing a loop which greadily tries to distribute the
funds among the channels to open, and reduces the number of channels to
open in case not enough funds are available to satisfy the channel size
limits.
2019-03-14 08:49:28 +01:00
Olaoluwa Osuntokun
c1228ae15f
Merge pull request #2671 from wpaulino/tx-broadcast-err-handling
lnwallet/btcwallet: remove invalid transactions from the wallet when broadcast fails
2019-03-13 21:03:04 -07:00
Wilmer Paulino
7946d0a256
multi: remove ErrDoubleSpend check for PublishTransaction
In this commit, we address a lingering issue within some subsystems that
are responsible for broadcasting transactions. Previously,
ErrDoubleSpend indicated that a transaction was already included in the
mempool/chain. This error was then modified to actually be returned for
conflicting transactions, but its callers were not modified accordingly.
This would lead to conflicting transactions to be interpreted as valid,
when they shouldn't be.
2019-03-13 17:57:19 -07:00
Wilmer Paulino
5c5c542f94
lnwallet/btcwallet: remove unnecessary tx in mempool/chain checks
The checks to determine whether the transaction broadcast failed due to
it already existing in the mempool/chain are no longer needed since the
underlying btcwallet PublishTransaction call will not return an error
when running into these cases.
2019-03-13 17:57:19 -07:00
Olaoluwa Osuntokun
10910318a2
lnd: extract neutrino initialization to new function 2019-03-13 17:20:38 -07:00
Wilmer Paulino
1fe6599fd8 lnd+chainregistry: initialize neutrino light client before wallet setup
In this commit, we slightly refactor the startup of lnd when running
with a Neutrino light client backend. We'll now begin syncing our
backend as soon as lnd starts and passes all configuration checks. Since
this is all done before lnd's wallet setup, the light client will be
syncing in the background while the user notes/inputs their wallet seed.
This is done in order to provide a better UX from the point of the user,
such that most of the chain will already be synced by the time they get
to deposit funds into the wallet.
2019-03-13 16:46:50 -07:00
Olaoluwa Osuntokun
d0757221b4
Merge pull request #2768 from Roasbeef/neutrino-rescan-btcwallet-broadcast-update
multi: update build to latest version of neutrino+btcwallet
2019-03-13 16:39:23 -07:00
Olaoluwa Osuntokun
d86fe393cd
multi: update build to latest version of neutrino+btcwallet
In this commit, we update the build to point to the latest version of
neutrino and btcwallet. The latest version of neutrino includes a number
of bug fixes, and new features like reliably transaction broadcast. The
latest version of btcwallet contains a number of bug fixes related to
properly remove invalid transactions from its database.
2019-03-13 15:03:39 -07:00
Olaoluwa Osuntokun
a24eeb9135
lnrpc/routerrpc: style fix ups 2019-03-12 21:20:21 -07:00
Olaoluwa Osuntokun
ad8849056b
Merge pull request #2497 from joostjager/querysingleroute
lnrpc: deprecate QueryRoutes with more than one route
2019-03-12 21:15:18 -07:00
Wilmer Paulino
3371c5fab0
Merge pull request #2680 from grunch/passwd-length-validation-on-create-wallet
Add password length validation condition on create wallet cli
2019-03-12 12:12:54 -07:00
chokoboko
69d3c47d22 multi: inspect missed errors in scoped if statements 2019-03-11 13:23:21 -07:00
Joost Jager
293971cd03
routerrpc: move query routes into sub server
This commit moves the query routes backend logic from the main
rpc server into the sub server. It is another step towards splitting up
the main rpc server code.

In addition to this, a unit test is added to verify rpc parameter
parsing.
2019-03-11 09:56:16 +01:00
Olaoluwa Osuntokun
cfb5e249b9
Merge pull request #2749 from Roasbeef/bork-force-close
lnwallet: within ForceClose, mark the channel as borked, prevent mutations for borked channels
2019-03-10 15:21:09 -07:00
Olaoluwa Osuntokun
33ad645f8c
lnwallet: update TestChanSyncFailure to pass with new borked update restriction
In this commit, we update the `TestChanSyncFailure` method to pass given
the new behavior around updating borked channel states. In order to do
this, we add a new method to allow the test to clear an existing channel
state. This method may be of independent use in other areas in the
codebase in the future as well.
2019-03-08 19:15:10 -08:00
Olaoluwa Osuntokun
bc72691806
contractcourt: mark channel as borked before removing the link
In this commit, we ensure that we mark the channel as borked before we
remove the link during the force close process. This ensures that if the
peer reconnects right after we remove the link, then it won't be loaded
into memory in `loadActiveChannels`. We'll now:

  * mark the channel as borked
  * remove the link
  * read the channel state from disk
  * force close

This ensures that the link (if it's active) is able to commit any
pending changes to disk before we read out the channel to force close.
2019-03-08 19:15:08 -08:00
Olaoluwa Osuntokun
dac35c46f3
lnwallet: properly examine and check error from AppendRemoteCommitChain 2019-03-08 19:15:07 -08:00
Olaoluwa Osuntokun
49c38ed56d
lnwallet: update line wrapping to project style where needed 2019-03-08 19:15:06 -08:00
Olaoluwa Osuntokun
032eacb796
channeldb: prevent mutating on-disk commitment state if channel is borked 2019-03-08 19:15:04 -08:00
Olaoluwa Osuntokun
b409e5dfc4 lnwallet: add new TestForceCloseBorkedState test
In this commit, we add a new test: `TestForceCloseBorkedState`. This
ensures that it isn't possible to update the channel state once a
channel has been marked as borked. This assumes that all calls to
`ForceClose` will also mark the channel as borked. This isn't the case
yet, so this test fails as is.
2019-03-08 18:56:42 -08:00
Olaoluwa Osuntokun
3895a4f276
Merge pull request #2745 from cfromknecht/make-install-btcd
Makefile: actually install btcd w/ make btcd
2019-03-08 18:41:18 -08:00
Wilmer Paulino
9d443a9e12
Merge pull request #2746 from joostjager/sendpayment-arg
lncli: fix command line argument parsing for sendpayment
2019-03-08 11:54:21 -08:00
Joost Jager
5b6fdbeb6f
lncli: fix command line argument parsing for sendpayment
This commit fixes a bug that caused the payment hash to be (re)parsed as
an int representing the final cltv delta.
2019-03-08 10:42:18 +01:00
Conner Fromknecht
e0886ff1f5
Merge pull request #2739 from wpaulino/make-flake-unit-fix
Makefile: fix unit test flakehunter when running on specific package
2019-03-07 20:38:14 -08:00
Conner Fromknecht
29fe6e61e2
Makefile: actually install btcd w/ make btcd 2019-03-07 17:56:37 -08:00
Wilmer Paulino
b66f97c23a
Makefile: fix unit test flakehunter when running on specific package
When using the unit test flakehunter and specifying a package, after the
first successful run, all of the tests would be run, rather than just
the ones within the specified package.
2019-03-06 18:01:07 -08:00
Joost Jager
6cc82b4a34
routing: add todo describing route cache bug 2019-03-06 15:31:09 +01:00
Joost Jager
6e10c05a82
lnrpc: deprecate QueryRoutes with more than one route
Now that QueryRoutes gained the ability to route from any source node
and takes in edge and node black lists, all pieces are in place to have
users implemented their own k-shortests path algorithm. Or any other algorithm
they might wish to use and currently can't.

This commit marks the num_routes field as deprecated as a preparation
for removing k-shortest for lnd.
2019-03-06 15:31:06 +01:00
Joost Jager
c62c9d64da
routing: add source parameter to query routes
This commit allows execution of QueryRoutes from any source node.
Previously this was restricted to only the self node.
2019-03-06 15:31:03 +01:00
Joost Jager
7719bc432f
routing: take Vertex types as path finding source and target nodes
Currently public keys are represented either as a 33-byte array (Vertex) or as a
btcec.PublicKey struct. The latter isn't useable as index into maps and
cannot be used easily in compares. Therefore the 33-byte array
representation is used predominantly throughout the code base.

This commit converts the argument types of source and target nodes for
path finding to Vertex. Path finding executes no crypto operations and
using Vertex simplifies the code.

Additionally, it prepares for the path finding source parameter to be
exposed over rpc in a follow up commit without requiring conversion back
and forth between Vertex and btcec.PublicKey.
2019-03-06 15:31:00 +01:00
Joost Jager
b09adc3219
lnrpc+routing: add edges and nodes restrictions to query routes
This commit allows the execution of QueryRoutes to be controlled using
lists of black-listed edges and nodes. Any path returned will not pass
through the edges and/or nodes on the list.
2019-03-06 15:30:57 +01:00
Joost Jager
4376f3e1bd
routing: allow nil maps for ignored edges and nodes
This allows removing a lot of empty map initialization code and makes
the code more readable.
2019-03-06 15:30:54 +01:00
Joost Jager
b2b28b49b1
routing: export RestrictParams and EdgeLocator 2019-03-06 15:30:52 +01:00
Joost Jager
4937304732
routing: remove redundant fee limit check in newRoute
This check was a left over from when the fee limit wasn't checked yet in
the path finding algorithm.
2019-03-06 15:30:49 +01:00
Joost Jager
f4cc2e235a
routing: add todo describing fee limit bug 2019-03-06 15:30:46 +01:00
Johan T. Halseth
cee18892b5
Merge pull request #2565 from joostjager/sendpayment-refactor
routing: sendPayment broken down into multiple functions
2019-03-06 10:20:20 +01:00
Olaoluwa Osuntokun
c853555d1b
Merge pull request #2690 from cfromknecht/hwsc-fndg-priority-queue
peer: deprioritize gossip traffic
2019-03-05 21:08:26 -08:00
Conner Fromknecht
935ea7d450
server: broadcast using SendMessageLazy, remove unused sendPeerMessages 2019-03-05 17:09:14 -08:00
Conner Fromknecht
b50fd33915
server: remove unused SendToPeer method 2019-03-05 17:09:01 -08:00
Conner Fromknecht
0ae06c8189
discovery+server: send lazy gossip msgs 2019-03-05 17:08:48 -08:00
Conner Fromknecht
2e5bc783f7
peer: preallocate errchans opt 2019-03-05 17:08:35 -08:00
Conner Fromknecht
f39edd8000
peer: add SendMessageLazy 2019-03-05 17:08:22 -08:00
Conner Fromknecht
660bbaf646
peer: add message reordering based on priority 2019-03-05 17:08:05 -08:00
Wilmer Paulino
63273e195e
Merge pull request #2661 from Roasbeef/last-unused-addr
lnwallet+lnrpc: add ability to fetch the last unused wallet addr
2019-03-05 16:53:43 -08:00
Francisco Calderón
9e920f12c9
Add password length validation on create CLI
In this commit we add this validation importing
the walletunlocker.ValidatePassword function on
create wallet command.
2019-03-05 20:58:46 -03:00