Commit Graph
86 Commits
Author SHA1 Message Date
Joost Jager 6ae55168b8 Merge pull request #2486 from joostjager/split-resolvers
cnct: split resolvers in separate files
2019-01-17 08:57:22 +01:00
Joost Jager 4ec3fc3b1a cnct: split resolvers in separate files 2019-01-16 20:03:59 +01:00
Joost Jager 649408003d lnrpc: expose network name in GetInfo
Previously only a testnet boolean was available which
made it impossible to distinguish between regtest and
mainnet.
2019-01-08 00:17:14 +01:00
Joost Jager c1eaf60000 invoices: create package
This commit isolates the invoice registry in a separate package. It is
a preparation for the creation of an invoices sub server.
2019-01-07 23:04:05 +01:00
Joost Jager d151916ae1 lnrpc: deprecate invoice receipt field 2019-01-07 22:05:52 +01:00
Joost Jager 1199f17cd9 lnrpc: report invoice state
Expose the new invoice state field over rpc.
2019-01-04 07:54:14 +01:00
Joost Jager 5515713b88 channeldb: convert settled boolean to state
This commit is a preparation for the addition of new invoice
states. A database migration is not needed because we keep
the same field length and values.
2019-01-04 07:53:55 +01:00
Joost Jager 6c027e2bc9 htlcswitch: remove lnrpc dependency
This commits removes an unwanted dependency that prevents
moving parts of rpcserver to a sub server.
2019-01-03 09:07:56 +01:00
Joost Jager 237f2b6d4b lnrpc: remove ConfirmationUpdate message from close status updates 2019-01-03 09:06:52 +01:00
Joost Jager 4a58ec5b15 utxonursery: fix bound variable bug
A pointer to the loop variable was passed to the waitForSweepConf
goroutine, causing the wrong output to be graduated from
kindergarten.
2018-12-21 09:29:26 +01:00
Joost Jager 347d1545de utxonursery: use mocked sweeper in tests
This commit fixes a test flake caused by a race condition. Using the
real sweeper in the nursery test created too complex concurrent
behaviour to reliably assert on and made the tests difficult to
comprehend.
2018-12-19 14:14:53 +01:00
Joost Jager e29b0f8894 utxonursery: add mock sweeper
This commit adds a simple mock of the sweeper to be able to test
dependents of sweeper in isolation.
2018-12-19 14:09:30 +01:00
Joost Jager 74e9852e3d utxonursery: configure using SweepInput function
As a preparation for mocking sweeper, this commit modifies the
utxonursery config to take a function pointer instead of the full
sweeper struct.
2018-12-19 12:49:19 +01:00
Joost Jager 78aaf8639b lnrpc: remove reference to GOPATH
As go modules allow us to build outside of the GOPATH, we shouldn't look for .proto imports there anymore.
2018-12-18 14:57:26 +01:00
Joost Jager 9e611636ee lnrpc: update github.com/golang/protobuf to v1.2.0
Update is necessary to get protoc to generate files in the right
directory when using modules outside the gopath. The old version of this
dependency did not support paths=source_relative.

This commit also fixes a build error in lnd_test.go because of a
slight difference in generated code.
2018-12-18 14:57:24 +01:00
Joost Jager 6ca52c4ec7 lnrpc/walletrpc: remove unused gen_proto.sh script 2018-12-18 14:56:52 +01:00
Joost Jager 687d4e7725 cnct: add todo comment for sweeper 2018-12-18 10:50:22 +01:00
Joost Jager 6389a97708 utxonursery: connect to time-based sweeper
Previously, nursery generated and published its own sweep txes. It
stored the sweep tx in nursery_store to prevent a new tx with a new
sweep address from being generated on restart.

In this commit, sweep generation and publication is removed from nursery
and delegated to the sweeper. Also the confirmation notification is
received from the sweeper.
2018-12-18 10:50:20 +01:00
Joost Jager eec2efdd6b sweep: add sweeper test 2018-12-18 10:50:19 +01:00
Joost Jager 01e64afd56 sweep: add time-based sweeper
In this commit, the sweep package is extended from just tx generation to
an active sweeper that collects sweep inputs and autonomously proceeds
to publish the sweep tx after the batch window time interval has passed
without new inputs being added.
2018-12-18 10:50:17 +01:00
Joost Jager 1f0656559e sweep: add sweeper store
This commit adds a store for the sweeper. The sweeper needs minimal
persistent data to be able to recognize its own sweeps.
2018-12-18 10:50:16 +01:00
Joost Jager a2dcca2b08 sweep: add input partitionings generator
This commit adds a function that takes a set of inputs and splits them
in sensible sets to be used for generating transactions.
2018-12-18 10:50:14 +01:00
Joost Jager 067817f6d2 sweep: move tx generation to separate file 2018-12-18 10:50:13 +01:00
Joost Jager e43e89514f sweep+utxonursery+cnct+breacharbiter: add height hint to input
This commit is a preparation for the implementation of remote spend
detection. Remote spends may happen before we broadcast our own sweep
tx. This calls for accurate height hints.
2018-12-18 10:50:11 +01:00
Joost Jager 26cfc505ee sweep: refactor weight estimation 2018-12-18 10:50:10 +01:00
Joost Jager 3b1357c3ab build: apply rpctest tag in itest
We need to distinguish an lnd build for the purpose of integration
testing from a regular dev build. This makes it possible to adapt
parameters to let integration tests run faster (for example:
sweeper batch window).
2018-12-18 10:50:07 +01:00
Joost Jager 91f3df07e4 lnwallet: prevent static fee estimator fees from being modified
Modifying the static fees is not thread safe. In this commit the fees
are made immutable.
2018-12-18 10:50:05 +01:00
Joost Jager 423dd8ab9b lnwallet: expose relay fee on fee estimators 2018-12-18 10:50:04 +01:00
Joost Jager b2cb760c65 routing: check for empty hops list
This commit fixes a crash that could be triggered by sending an empty
hop list to the SendToRoute rpc.
2018-12-10 11:27:07 +01:00
Joost Jager 3ed16837e4 routing: prune channels unidirectional
In this commit we introduce pruning of channel edges instead of channels.
Channel failures apply to a single direction and it is unnecessarily
restricting to prune both directions.
2018-12-05 14:39:23 +01:00
Joost Jager 8b8e82a171 routing: remove route hop maps
Hop maps were used in a test to verify the population of the hop map
itself and further only in a single function (getFailedChannelID).
Rewrote that function and removed the hop maps completely.
2018-12-05 14:39:23 +01:00
Joost Jager 42debc6c12 routing: fix node ordering in test graph
There is the general assumption that channel edge policy nodes are
ordered such that the node1 pubkey is smaller than the key of node 2. In
the test graph, this assumption didn't hold. This commit fixes the test
graph and also adds a check to prevent this from happening again.
2018-12-05 09:15:27 +01:00
Joost Jager b6ce03e569 routing: make routing retry behaviour consistent
Fixes the following issues:
- If the channel update of FailFeeInsufficient contains an invalid channel
  update, it is not possible to properly add to the failed channels set.
- FailAmountBelowMinimum may apply a channel update, but does not retry.
- FailIncorrectCltvExpiry immediately prunes the vertex without
  trying one more time.

In this commit, the logic for all three policy related errors is
aligned.
2018-12-03 13:23:27 +01:00
Joost Jager 6ba1144528 routing: move failed channels map into payment session
This is a small preparatory step towards moving mission control logic
out of router and reusing the acquired routing result data.
2018-11-29 10:31:38 +01:00
Joost Jager ac04729cff routing: use complete route in test
Previously not all route fields were properly populated. Example: prev
and next hop maps.
2018-11-29 10:31:38 +01:00
Joost Jager 71037969b7 routing: remove pruneVertexFailure function 2018-11-29 10:31:38 +01:00
Joost Jager aca136a91c routing: remove unused pruneVertexFailure parameters 2018-11-29 10:31:38 +01:00
Joost Jager dd7e2e9e04 routing: move logging into applyChannelUpdate
To remove code duplicated at all call sites to check err and log.
2018-11-29 10:31:38 +01:00
Joost Jager e14678030c lnwallet: update to new SendOutputs signature 2018-11-10 07:57:19 +01:00
Joost Jager 4cc255676b utxonursery: use StaticFeeEstimator instead of mock in test 2018-11-07 15:33:36 +01:00
Joost Jager 3c1260941f utxonursery: remove unused TxOut serialization funcs 2018-11-07 15:33:36 +01:00
Joost Jager 839752857f cnct: add comment on expiry calculation 2018-11-07 15:29:57 +01:00
Joost Jager c3560932b6 cnct: fix log line 2018-11-07 15:29:56 +01:00
Joost Jager 28ae028535 lnrpc: accept pubkey in hop message
By passing a pubkey into SendToRoute, it becomes unnecessary for lnd to
query the channel graph to retrieve the hop pubkey. This allows routes
over private channels that are not present in the graph.
2018-11-01 08:59:53 +01:00
Joost Jager e55a678eda lnrpc: extract hop unmarshall code 2018-10-29 13:21:52 +01:00
Joost Jager 95bf858ac3 sweep: refactor functions and unify tx info logging 2018-10-17 12:44:34 +02:00
Joost Jager 6977d59e35 cnct: reuse sweep tx logic for success resolver 2018-10-17 12:44:34 +02:00
Joost Jager c1d845aa0d cnct: reuse sweep tx logic for commit resolver
Removes duplicate sweep tx code from commit resolver
and delegates generation to UtxoSweeper in the sweep
package.
2018-10-17 12:44:34 +02:00
Joost Jager 7d69df77ed sweep: create new Input interface
This commit introduces a common interface for sweep
inputs. It eliminates the type checking from UtxoSweeper.

Also the formerly present Amount() getter is removed. It was redundant
because this value is present in SignDesc().Output.Value as well.
2018-10-17 12:44:33 +02:00
Joost Jager 4dab405623 sweep: move sweep tx generation into sweep package
Sweep txes are currently generated in multiple locations. Moving
the sweep tx generation into a shared package will allow us to
reuse that logic.
2018-10-17 12:44:33 +02:00
Joost Jager 9fcc7ee390 utxonursery: move spendable output structs to sweep package
This commit moves the output structs to a new package as a
preparation for moving more logic into that package.
2018-10-17 12:44:33 +02:00
Joost Jager 18d38d1d11 lnrpc: fix unsafe stream send 2018-10-15 21:13:37 +02:00
Joost Jager 46de56199a build: upgrade grpc to 1.15.0 2018-10-15 20:10:17 +02:00
Joost Jager 1d97cf1229 htlcswitch+routing: implement expiry_too_far failure
In this commit we add a check to HtlcSatifiesPolicy to verify that the
time lock for the outgoing htlc that is requested in the onion packet
isn't too far in the future.

Without this check, anyone could force an unreasonably long time lock on
the forwarding node.
2018-10-15 08:51:08 +02:00
Joost Jager a779004a18 lnrpc+routing: fix issues with missing data in unmarshallRoute
In this commit the dependency of unmarshallRoute on edge policies being
available is removed. Edge policies may be unknown and reported as nil.
SendToRoute does not need the policies, but it does need pubkeys of the
route hops. In this commit, unmarshallRoute is modified so that it
takes the pubkeys from edgeInfo instead of channelEdgePolicy.

In addition to this, the route structure is simplified. No more connection
to the database at that point. Fees are determined based on incoming and
outgoing amounts.
2018-10-13 22:59:23 +02:00
Joost Jager cf57c1daa3 lnwallet: export the Ripemd160H function
The reason for exporting this function is that we now have external
applications that generate custom Bitcoin scripts.
2018-10-12 08:50:07 +02:00
Joost Jager 77d6a6697d utxonursery: check for quit channel 2018-09-24 20:40:23 -07:00
Joost Jager 8b515f83b3 utxonursery: add test for commitment output 2018-09-23 15:52:47 -07:00
Joost Jager b89db6d614 utxonursery: assert empty database 2018-09-23 15:52:46 -07:00
Joost Jager b5da791271 utxonursery: assert lingering goroutines 2018-09-23 15:52:46 -07:00
Joost Jager f1590a15e7 makefile: dump all goroutines on panic
To provide more diagnostic information when unit tests panic.
2018-09-23 15:52:46 -07:00
Joost Jager 9f6fb1e128 utxonursery: test restart behaviour 2018-09-23 15:52:45 -07:00
Joost Jager 83a5ea0c31 utxonursery: add test coverage for outgoing htlc 2018-09-23 15:51:35 -07:00
Joost Jager a75b0c871b lnd_test: add AbandonChannel test 2018-09-20 18:33:47 -07:00
Joost Jager f34ffab9ba cnct: add channel_arbitor test that exercises the htlcOutgoingContestResolver 2018-09-20 18:17:23 -07:00
Joost Jager ab67b9a4de rpcserver+lnrpc+lncli: add AbandonChannel rpc call
Using AbandonChannel, a channel can be abandoned. This means
removing all state without any on-chain or off-chain action.
A close summary is the only thing that is stored in the db after
abandoning.

A specific close type Abandoned is added. Abandoned channels
can be retrieved via the ClosedChannels RPC.
2018-09-18 12:20:27 -07:00
Joost Jager 3b6f7fdb83 gitignore: ignore visual studio code config 2018-09-18 07:17:44 -07:00
Joost Jager a7fec827cc routing: validate channel update in failure message 2018-09-11 20:12:09 +02:00
Joost Jager b5fd32ff77 discovery+routing: move validation logic to routing package
Previously, gossiper was the only object that validated channel
updates. Because updates can also be received as part of a
failed payment session in the routing package, validation logic
needs to be available there too. Gossiper already depends on
routing and having routing call the validation logic inside
gossiper would be a circular dependency. Therefore the validation
was moved to routing.
2018-09-11 20:12:07 +02:00
Joost Jager ac8a3af84c routing: add channel update validation test 2018-09-11 20:10:15 +02:00
Joost Jager 47d2e1e024 routing: add option to specify explicit id for test channels 2018-09-11 20:10:15 +02:00
Joost Jager c5c580ab54 routing: add private key map to test graph instance 2018-09-11 20:10:14 +02:00
Joost Jager 5daf75b264 routing: restructure test context creation 2018-09-11 20:10:14 +02:00
Joost Jager 2d255e3bc3 routing: use fixed time value in tests 2018-09-11 20:10:14 +02:00
Joost Jager 29b6bae4ed routing: convert fee limit test to table-driven 2018-08-09 20:23:40 -07:00
Joost Jager 3e7473f4f0 routing: backward searching 2018-08-09 20:23:40 -07:00
Joost Jager e52d829168 routing: path finding test refactored 2018-08-09 20:23:40 -07:00
Joost Jager 6c918a1806 channeldb: store unknown policies in database
The commit ensures that for every channel, there will always
be two entries in the edges bucket. If the policy from one or
both ends of the channel is unknown, it is marked as such.

This allows efficient lookup of incoming edges. This is
required for backwards payment path finding.
2018-08-09 20:23:40 -07:00
Joost Jager b52796749f routing: new weight function
In this commit, a new weight function is introduced. This will create a
meaningful effect of time lock on route selection. Also, removes the
squaring of the fee term. This led to suboptimal routes.

Unit test added that covers the weight function and asserts that the
lowest fee route is indeed returned.
2018-06-28 14:52:39 +02:00
Joost Jager 416f368979 routing: add time lock asserts to NewRoute test
This comment extends the unit tests for NewRoute with checks
on the total time lock for a route as well as the expected time
lock values for every hop along the route.
2018-06-28 14:04:02 +02:00
Joost Jager d4471878df routing: fix route fee calculation and channel capacity check
This commit fixes the logic inside the newRoute function to
address the following problems:

- Fee calculation for a hop does not include the fee that needs
  to be paid to the next hop.

- The incoming channel capacity "sanity" check does not include
  the fee to be paid to the current hop.
2018-06-28 13:53:45 +02:00
Joost Jager 70ff4414d9 lnd_test: use different fee policy in multi hop payment test
This change makes the test more sensitive to bugs than a route
with nodes that all enforce the same fee policy.

In addition to that, the fee has been increased to a level
at which potential problems with improper fee calculation
become detectable (and not disappear in rounding).
2018-06-28 13:53:45 +02:00
Joost Jager 52392d836c lnrpc: add ClosedChannels call 2018-06-13 08:48:33 +02:00
Joost Jager cc1d833ee4 lncli: add closedchannels command 2018-06-13 08:48:01 +02:00
Joost Jager f80ea51f69 rpcserver: add ClosedChannels call 2018-06-13 08:48:01 +02:00
Joost Jager f07e2076f8 gitignore: exclude debug binaries 2018-06-13 08:48:00 +02:00