Commit Graph
41 Commits
Author SHA1 Message Date
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