Commit Graph

8884 Commits

Author SHA1 Message Date
Andras Banki-Horvath
44f13d1d60 invoices: adding InvoiceExpryWatcher to cancel expired invoices
This commit adds InvoiceExpryWatcher which is a separate class that
receives new invoices (and existing ones upon restart) from InvoiceRegistry
and actively watches their expiry. When an invoice is expired
InvoiceExpiryWatcher will call into InvoiceRegistry to cancel the
invoice and by that notify all subscribers about the state change.
2019-12-13 17:03:08 +01:00
Andras Banki-Horvath
7024f36a76 general: adding the Clock interface to aid testing
This commit adds Clock and DefaultClock and moves the private
invoices.testClock under the clock package while adding basic
unit tests for it.
Clock is an interface currently encapsulating Now() and TickAfter().
It can be added as an external dependency to any class. This way
tests can stub out time.Now() or time.After().

The DefaultClock class simply returns the real time.Now() and
time.After().
2019-12-13 16:52:22 +01:00
Andras Banki-Horvath
ff3063daea queue: fixing doc after cherry pick
This commit just fixes a godoc and adds a new one to the already
merged queue.PriorityQueue.
2019-12-13 16:52:22 +01:00
Andras Banki-Horvath
88e01fa1fa invoices: refactor test helpers
This commit moves test helpers to their on file, while also adding helper to
create an invoice with a valid payment request.
2019-12-13 16:52:18 +01:00
Joost Jager
071c57d4a4
sweep: embed input.Input interface
Get rid of needless referencing of the embedded object.
2019-12-13 12:02:44 +01:00
Joost Jager
38adfd7ecc
sweep: create sweep parameters struct
Prepares for adding more input-specific sweep parameters.
2019-12-13 12:02:42 +01:00
Joost Jager
e2bf6b49e9
sweep: fix bucket clustering
Fixes a bug where bucket sizes were not the configured size, but the
configured size plus the min relay fee.
2019-12-13 11:08:09 +01:00
Joost Jager
50078216ca
sweep: use bucket ids
Using a fee rate just as an identifier can be confusing.
2019-12-13 11:08:07 +01:00
Johan T. Halseth
27430f8bc9
Merge pull request #3832 from cfromknecht/fix-signer-protos
signrpc: fix uncommitted changes from proto
2019-12-13 10:02:17 +01:00
Conner Fromknecht
d5d38c6e01
signrpc: fix uncommitted changes from proto 2019-12-12 17:20:33 -08:00
Conner Fromknecht
1901f59c07
Merge pull request #3828 from joostjager/custom-records-sanity
channeldb: custom records sanity check
2019-12-12 11:36:27 -08:00
Joost Jager
de2b7b78de
channeldb: custom records sanity check 2019-12-12 17:49:36 +01:00
Joost Jager
d16476e477
routerrpc+record: move custom set validation 2019-12-12 17:49:34 +01:00
Joost Jager
75b94dec2b
Merge pull request #3819 from joostjager/fix-custom-record-payment
multi: fix custom record payment
2019-12-12 14:33:05 +01:00
Joost Jager
8c43232f66
chainregistry: set static min relay fee
We need it to be set in order to properly test the sweeper handling the
dust limit on regtest.
2019-12-12 14:05:43 +01:00
Conner Fromknecht
cc18d0ae6b
Merge pull request #3824 from cfromknecht/invoice-features-rpc
lnrpc: expose features on rpc invoices
2019-12-12 01:33:48 -08:00
Johan T. Halseth
c04ef68cc3
Merge pull request #3826 from arik-so/wrong_chain_error_fix
fix order in wrong chain error message
2019-12-12 09:46:31 +01:00
Conner Fromknecht
aba49c9a5a
rpcserver: populate features on lnrpc invoices
In the process, we also move the feature serialization into the
invoicesrpc package, so that it can be shared between the invoicesrpc
and main rpcserver.
2019-12-12 00:12:51 -08:00
Conner Fromknecht
7446495b6d
lnrpc: add features field to invoices 2019-12-12 00:08:18 -08:00
Olaoluwa Osuntokun
dca31c2bf8
Merge pull request #3825 from cfromknecht/ensure-fv-populated
zpay32: ensure feature vector is always populated
2019-12-11 21:43:48 -08:00
Olaoluwa Osuntokun
a5519d1af1
build: update go.mod to use queue/v1.0.2 2019-12-11 19:06:48 -08:00
Olaoluwa Osuntokun
338175534e
Merge pull request #3812 from guggero/sign-custom
signrpc: sign and verify messages with custom key
2019-12-11 18:51:55 -08:00
Arik Sosman
e83df875ad
fix wrong chain error message 2019-12-11 17:43:24 -08:00
Conner Fromknecht
840476996c
zpay32: ensure feature vector is always populated 2019-12-11 17:37:18 -08:00
Joost Jager
75aa4e7061
routing: require tlv capability for custom record payments
Previously if a payment was sent with custom records attached, path
finding wouldn't perform a check whether the final node was capable of
receiving custom records in a tlv payload.
2019-12-12 00:15:02 +01:00
Joost Jager
c37289cd94
routing: pass custom records into pathfinding 2019-12-12 00:15:00 +01:00
Joost Jager
d02de70d20
multi: do not use tlv.Record outside wire format handling
This commit prepares for more manipulation of custom records. A list of
tlv.Record types is more difficult to use than the more basic
map[uint64][]byte.

Furthermore fields and variables are renamed to make them more
consistent.
2019-12-12 00:14:58 +01:00
Joost Jager
8b5bb0ac63
record: move CustomRecordSet 2019-12-12 00:12:19 +01:00
Joost Jager
7aa4a7c7fc
channeldb/migration_01_to_11: isolate route structure
Before we change the Hop struct, isolate the code that is used in older
migrations to prevent breaking them.

route.go was taken from commit 6e463c1634061d595953f20813860207e5d485ce
2019-12-12 00:12:17 +01:00
Oliver Gugger
95226771ed
signrpc+rpcserver: add signer macaroon permissions 2019-12-11 22:37:40 +01:00
Oliver Gugger
9a73b9be78
signrpc: sign and verify messages with custom key
To allow signing of messages with any key in the key chain
we add two new methods to the signer RPC. These behave differently
to the methods with the same name in the main RPC as described
in the documentation comment.
2019-12-11 22:37:39 +01:00
Joost Jager
62dadff291
Merge pull request #3415 from joostjager/mpp
htlcswitch+invoices: allow settling invoices via multi-path payments
2019-12-11 19:30:15 +01:00
Joost Jager
907f0f1948
Merge pull request #3820 from joostjager/fix-logger
build: prevent loggers from overwriting each other.
2019-12-11 17:33:42 +01:00
Joost Jager
b2f43858c3
invoices: accept mpp payments 2019-12-11 16:14:49 +01:00
Joost Jager
56958493fe
invoices/test: add test clock 2019-12-11 16:08:09 +01:00
Joost Jager
499f2b16cf
invoices: add RegistryConfig struct 2019-12-11 16:08:07 +01:00
Andras Banki-Horvath
56282db30a
queue: Introducing a general purpose priority queue.
This commit introduces PriorityQueue, which is a general, heap
based priority queue, and PriorityQueueItem which is an interface
that concrete priority queue items must implement.
This implementation is encapsulated, users do not need to use any
other package for full functionality.
PriorityQueue exports the usual public methids: Push, Pop, Top,
Empty and Len. For full documentaton consult the priority_queue.go,
for usage: priority_queue_test.go
2019-12-11 16:08:05 +01:00
Joost Jager
9f1720dea8
build: prevent loggers from overwriting each other.
Previously only the last registered logger would receive debug level
changes.
2019-12-11 15:22:00 +01:00
Olaoluwa Osuntokun
70c5fe3d00
Merge pull request #3697 from joostjager/lower-min-htlc
config: improve management of htlc amount lower limit
2019-12-10 18:05:49 -08:00
Olaoluwa Osuntokun
a7c2b12f5c
Merge pull request #3785 from Roasbeef/gossip-queries-fix
discovery: properly set FirstBlockHeight and NumBlocks in responses
2019-12-10 18:03:50 -08:00
Olaoluwa Osuntokun
6a9b96122d
discovery: properly set FirstBlockHeight and NumBlocks in responses
In this commit we fix in a bug in `lnd` that could cause other
implementations which implement a strict version of the spec to
disconnect when trying to sync their channel graph using the gossip
query feature. Before this commit, we would embed the request to a
`QueryChannelRange` in the response, causing some clients to reject the
response as the `FirstBlockHeight` and `NumBlocks` field would be
identical for each chunk of the response.

In order to remedy this, we now properly set these two fields with each
returned chunk. Note that even after this commit, we keep our existing
behavior surrounding the `Complete` field as is. Otherwise, current
`lnd` clients which rely on this field (rather than the two
aforementioned fields) wouldn't be able to properly detect when a set of
responses to their query was "complete".

Partially fixes #3728.
2019-12-10 17:05:58 -08:00
Joost Jager
61e114f201
autopilot: take channel min htlc from config 2019-12-11 00:17:10 +01:00
Joost Jager
b6eb3a69ba
routing+lnrpc+lncli: allow setting min htlc policy 2019-12-11 00:17:08 +01:00
Joost Jager
74c2df658e
localchans: log policy update error 2019-12-11 00:17:06 +01:00
Joost Jager
f289dbd826
routing: define subsystem constant 2019-12-11 00:17:04 +01:00
Joost Jager
16ca36985e
chainregistry: lower incoming htlc amount default 2019-12-11 00:17:02 +01:00
Joost Jager
b826858a50
config: expose minhtlcout as a config parameter 2019-12-11 00:17:01 +01:00
Joost Jager
55ff1131de
fundingmanager: check remote min htlc against our defaults 2019-12-11 00:16:59 +01:00
Joost Jager
ddb98fcc41
multi: distinguish between htlc in and out constraints 2019-12-11 00:16:57 +01:00
Joost Jager
d8fd6fae23
config+channeldb: describe min_htlc fields more accurately 2019-12-11 00:16:55 +01:00