Commit Graph
100 Commits
Author SHA1 Message Date
András Bánki-Horváth 9c9ce15ca6 Merge pull request #4708 from bhandras/expiry_watcher_opt
invoices: reduce heap usage when starting the expiry watcher
2020-10-29 10:15:35 +01:00
Andras Banki-Horvath 478cf704be invoices: reduce heap usage when starting the expiry watcher 2020-10-28 16:26:47 +01:00
András Bánki-Horváth dc16869d72 Merge pull request #4725 from halseth/chaneventstore-race
chanfitness/chaneventstore:  stop ticker after goroutine
2020-10-28 11:26:30 +01:00
András Bánki-Horváth 111db801e7 Merge pull request #4457 from bhandras/etcd_tx_queue
etcd: STM transaction queue to effectively reduce retries for conflicting transactions
2020-09-17 17:35:59 +02:00
Andras Banki-Horvath 26effca761 build: unit test on github with kvdb_etcd tag 2020-09-17 14:50:19 +02:00
Andras Banki-Horvath 357cd7d7a7 make: allow optional extra tags when running unit tests 2020-09-17 14:50:19 +02:00
Andras Banki-Horvath 9c47392dfa etcd: integrate the commitQueue to the STM commit loop
This commit integrates an externally passed commitQueue instance with
the STM to reduce retries for conflicting transactions.
2020-09-17 14:50:19 +02:00
Andras Banki-Horvath 6f3a45b75f etcd: make embedded etcd context cancelable 2020-09-17 14:50:18 +02:00
Andras Banki-Horvath 281c0b9d92 etcd: add commit queue to effectively reduce transaction retries
This commit adds commitQueue which is a lightweight contention manager
for STM transactions. The queue attempts to queue up transactions that
conflict for sequential execution, while leaving all "unblocked"
transactons to run freely in parallel.
2020-09-17 14:50:18 +02:00
Andras Banki-Horvath b4b5a9d7de etcd: increase message and transaction limits for embedded etcd 2020-09-17 14:50:14 +02:00
András Bánki-Horváth dea6d91431 Merge pull request #4603 from bhandras/fix_help
config: prevent displaying usage twice if --help was requested
2020-09-14 18:58:21 +02:00
Andras Banki-Horvath b778b25866 config: prevent displaying usage twice if --help was requested 2020-09-14 15:18:41 +02:00
András Bánki-Horváth d62b93e012 Merge pull request #4607 from bhandras/routing_experiments
lncli: add outgoing_chanid to queryroutes
2020-09-14 13:26:56 +02:00
Andras Banki-Horvath 4ffe744364 lncli: add outgoing_chanid to queryroutes 2020-09-14 11:36:06 +02:00
András Bánki-Horváth c3821e5ad1 Merge pull request #4493 from bhandras/invoice_gc
invoices: garbage collect settled/canceled invoices
2020-08-24 08:34:58 +02:00
Andras Banki-Horvath 2aa680ede2 invoices: optionally garbage collect invoices on the fly
This commit extends invoice garbage collection to also remove invoices
which are canceled when LND is already up and running. When the option
GcCanceledInvoicesOnTheFly is false (default) then invoices are kept and
the behavior is unchanged.
2020-08-05 12:24:17 +02:00
Andras Banki-Horvath a0d7877d9a multi: make canceled invoice garbage collection configurable
This commit extends the application config with a flag to control canceled
invoice garbage collection upon startup.
2020-08-05 12:24:16 +02:00
Andras Banki-Horvath 0ea763d83c invoices: attempt to delete old invoices upon start 2020-08-05 12:24:15 +02:00
Andras Banki-Horvath a5778c4673 channeldb: add DeleteInvoices call
This commit extends channeldb with the DeleteInvoices call which is when
passed a slice of delete references will attempt to delete the invoices
pointed to by the references and also clean up all our invoice indexes.
2020-08-05 12:24:15 +02:00
Andras Banki-Horvath 92f3b0a30c channeldb+invoices: add ScanInvoices and integrate with InvoiceRegistry
This commit adds channeldb.ScanInvoices to scan through all invoices in
the database. The new call will also replace the already existing
channeldb.FetchAllInvoicesWithPaymentHash call in preparation to collect
invoices we'd like to delete and watch for expiry in one scan in later
commits.
2020-08-05 12:24:14 +02:00
Andras Banki-Horvath ba3c65bfd6 invoices: re-format overreaching code lines 2020-08-05 12:24:13 +02:00
Andras Banki-Horvath 5346ed8a5c kvdb+etcd: assert on bucket/value key when putting value/bucket
This commit extends compatibility with the bbolt kvdb implementation,
which returns ErrIncompatibleValue in case of a bucket/value key
collision. Furthermore the commit also adds an extra precondition to the
transaction when a key doesn't exist. This is needed as we fix reads to
a snapshot revision and other writers may commit the key otherwise.
2020-08-01 00:29:01 +02:00
Andras Banki-Horvath b17ed28dea build: add all subservers to dev build 2020-07-29 14:33:25 +02:00
Andras Banki-Horvath 12a341ba59 etcd: remove the lock set concept
This commit removes the lock set which was used to only add bucket keys
to the tx predicate while also bumping their mod version.
This was useful to reduce the size of the compare set but wasn't useful
to reduce contention as top level buckets were always in the lock set.
2020-07-28 17:57:30 +02:00
Andras Banki-Horvath 3cdbb341da lnd: utxo nursery test to use channeldb.MakeTestDB 2020-07-28 17:57:30 +02:00
Andras Banki-Horvath 905990eb54 sweep: use channeldb.MakeTestDB 2020-07-28 17:57:30 +02:00
Andras Banki-Horvath f2a08e420e lnd: use channeldb.MakeTestDB in nursery store tests 2020-07-28 17:57:29 +02:00
Andras Banki-Horvath cbce8e8872 channeldb: move makeTestDB out of test to make it available for other tests
This commit moves makeTestDB to db.go and exports it so that we'll be
able to use this function in other unit tests to make them testable with
etcd if needed.
2020-07-28 17:57:29 +02:00
Andras Banki-Horvath 63e9d6102f kvdb+etcd: change flattened bucket key derivation algorithm
This commit changes the key derivation algo we use to emulate buckets
similar to bbolt. The issue with prefixing keys with either a bucket or
a value prefix is that the cursor couldn't effectively iterate trough
all keys in a bucket, as it skipped the bucket keys.
While there are multiple ways to fix that issue (eg. two pointers,
iterating value keys then bucket keys, etc), the cleanest is to instead
of prefixes in keys we use a postfix indicating whether a key is a
bucket or a value. This also simplifies all operations where we
(recursively) iterate a bucket and is equivalent with the prefixing key
derivation with the addition that bucket and value keys are now
continous.
2020-07-28 17:57:29 +02:00
Andras Banki-Horvath 9173958f9c kvdb: s/hu/en/g 2020-07-28 17:57:28 +02:00
Andras Banki-Horvath 70a69ce990 kvdb: make etcd tests use testify require instead of assert 2020-07-28 17:57:24 +02:00
András Bánki-Horváth 77549f1fb8 Merge pull request #4384 from bhandras/atpl_bc_topk
add modified greedy topK centrality heuristic to autopilot
2020-07-17 18:27:42 +01:00
Andras Banki-Horvath afbbeae4f2 autopilot+test: testify betweenness centrality tests
The commit also reindents the source to conform with ts=8 guideline.
2020-07-17 16:12:55 +02:00
Andras Banki-Horvath ccabad8607 autopilot: add TopCentrality to the available heuristics 2020-07-17 16:12:54 +02:00
Andras Banki-Horvath 8373b2ad20 autopilot: add greedy "TopK" centrality heuristic
This commit creates a new autopilot heuristic which simply returns
normalized betweenness centrality values for the current graph. This
new heuristic will make it possible to prefer nodes with large
centrality when we're trying to open channels. The heuristic is also
somewhat dumb as it doesn't try to figure out the best nodes, as that'd
require adding ghost edges to the graph recalculating the centrality as
many times as many nodes there are (minus the one we already have
channels with).
2020-07-17 16:12:54 +02:00
Andras Banki-Horvath 82ddccee0b autopilot+test: make centrality test data available for other tests 2020-07-17 16:12:53 +02:00
Andras Banki-Horvath 906b0b707b atpl: remove unneeded extra filter on address availability
This commit removes an extra filter on address availability which is not
needed as the scored nodes are a already prefiltered subset of the whole
graph where address availability has already been checked.
2020-07-17 16:12:48 +02:00
Andras Banki-Horvath fe51f528d1 docs: documentation for the experimental etcd feature 2020-07-07 15:59:53 +02:00
Andras Banki-Horvath 80012c3936 invoice+test: changing testitfy asserts to specific requires 2020-06-05 15:16:31 +02:00
Andras Banki-Horvath 574bbe5eba invoices+test: replace DeepEqual + spew dump with testify
This commit replaces reflect.DeepEqual tests and spew.Dump prints with
testify's require.Equal to make diffs smaller and test outputs more
readable.
2020-06-05 15:16:27 +02:00
András Bánki-Horváth 595bb7c1ff Merge pull request #4318 from bhandras/etcd_fixes
lnd+kvdb+etcd: remove retry goroutine from the STM and integrate abort context
2020-06-03 19:21:01 +02:00
Andras Banki-Horvath 3e5e60cac4 lnd+kvdb: pass LND abort context to etcd 2020-06-03 17:44:44 +02:00
Andras Banki-Horvath d3545830c9 kvdb+etcd: integrate the abort context to the STM retry loop
This commit extends the etcd.BackendConfig to also provide an abort
context and integrates it with the STM retry loop in order to be able
stop LND when conflicting transactions keep the loop running.
2020-06-03 17:44:44 +02:00
Andras Banki-Horvath 415de2f0c7 kvdb+etcd: remove retry goroutine from the STM
This commit removes the retry goroutine from the STM as the retry loop
is only running when the STM transaction is encapsulated in Update/View
whereas for self-standing transactions we use a different approach.
By removing the goroutine we won't catch panics thrown that are supposed
to be catched outside of the STM.
2020-06-03 17:44:44 +02:00
Andras Banki-Horvath 1dd43f3669 test: add error to itest whitelist 2020-06-02 15:40:20 +02:00
Andras Banki-Horvath 2a591ee2f1 build: bump etcd to v3.3.22 2020-06-02 15:40:20 +02:00
András Bánki-Horváth 703e8acb36 Merge pull request #4326 from bhandras/testclock_improvement
clock: add module support
2020-05-28 19:47:28 +02:00
Andras Banki-Horvath 1ae27b4f44 itest: add errors to the whitelist 2020-05-28 13:32:51 +02:00
Andras Banki-Horvath fc87e8358e clock: add go.mod 2020-05-28 10:37:04 +02:00
Andras Banki-Horvath 337d282a3f clock+test: convert checks to testify asserts 2020-05-26 23:55:28 +02:00
Andras Banki-Horvath e81061bda4 clock: optionally wait until tickers are registered in TestClock 2020-05-26 23:55:26 +02:00
András Bánki-Horváth 7f1a450a7f Merge pull request #4015 from bhandras/kv-etcd
kvdb wrapper for etcd
2020-05-22 14:00:06 +02:00
Andras Banki-Horvath b53475da14 lncfg+lnd: prefix etcd db with only network name instead of full path 2020-05-22 11:26:25 +02:00
Andras Banki-Horvath c3fcfd1530 etcd: add namespace support to separate key spaces
This commit extends etcd db with namespaces without additional storage
space requirements. This is simply done by instead of using an all zero
root bucket id, we use the sha256 hash of the name space as our root
bucket id.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath bce0597643 channeldb: silence linter 2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 85aee9b064 kvdb+lncfg: fully move etcd behind build tag
This commit separates all etcd related sources (sans a few stubs and
config) from the rest of the source tree and makes compilation conditional
depending on whether the kvdb_etcd build tag is specified.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 3ef331e016 lncfg+etcd: add TLS config
This commit extends lncfg with etcd TLS config and passes these
parameters to the etcd client upon construction.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath b54f8a1b97 kvdb+channeldb: create ExtendedBackend interface to allow rich tx logic
This commit adds the ExtendedBackend interface which is an extension to
the walletdb.DB interface. This paves the way to using etcd.db.View and
etcd.db.Update in the global View and Update functions without much code
rewrite.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 23fcb59a2b channeldb: convert payment tests to use test backend 2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 02f9d91e49 kvdb+etcd: only lock on bucket path mod revision for reads and writes
This commit reduces the compare set size the STM will submit in
transactions by adding only the bucket keys along the bucket path to a
specific lock set. This lock set then used to filter the read set,
effectively removing all read only keys from the transaction predicate
that are not bucket keys.
By tracking if a read-write tx actually changes something, we can also
"bump" the mod revision of the bucket keys.
With this trick we essentially implement a read-write lock for our
bucket structure greatly reducing transaction processing time.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 0e3629e2c7 channeldb+lnd: make channeldb backend configurable
This commit adds support for user configured channeldb backend.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 9d57c1a6b4 lncfg: add configuration for user specified db backend
This commit extends lncfg to support user specified database backend.
This supports configuration for both bolt and etcd (while only allowing
one or the other).
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 859a457e48 kvdb+etcd: extend kvdb and STM with stats
The commit itslef adds stats to the transactions such that we can see
how LND behaves with and etcd backend.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 248a00f211 kvdb+etcd: enable channeldb testing with both bdb/etcd 2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 3b7525659c channeldb+kvdb: add walletdb interface test
This commit adds walletdb interface test suite to the existing test set.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 6a24a03cec channeldb+kvdb: walletdb/kvdb interface etcd implementation
This commit adds a full interface implementation of the walletdb/kvdb
interface with detailed tests.
2020-05-22 11:26:25 +02:00
Andras Banki-Horvath 137dee04e8 channeldb+kvdb: an extended STM on top of etcd clientv3
This commit adds an extended STM, similar to what available in etcd's
clientv3 module. This incarnation of said STM supports additional
features, like positioning in key intervals while taking into account
deletes and writes as well. This is a preliminary work to support all
features of the kvdb interface.
2020-05-22 11:26:24 +02:00
Andras Banki-Horvath 556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 2b729a78f3 lntest: fix ticker leak 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 633ea71ad1 lnd: time.Since instead of time.Now().Sub(...) 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath fe59890a4b lnd+test: remove dead test code 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath ed595adf59 lnd: one append instead of appends in a loop 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 63419c1870 lnd: remove dead code from nursery_store 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 62e6c392a5 lnd: remove dead code from fundingmanager 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 2d6c73f0fd netann: remove unused logClosure 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath f39387db3b monitoring: removing unused logClosure 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 0679d1dd4b autopilot: append instead of appends in a loop 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 28c2ef12b2 netann: one append instead of appends in a loop 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath f3f482d9f9 watchtower: one append instead of appends in a loop 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath ebf058a2a5 routing: static check fix, time.Since instead of Now().Sub() 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 4773ae17d9 routing: remove unused code 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath e9d7ba635c lnwallet: remove redundant return 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath b93140cd3c switch: remove unused code 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath ccf6e2a393 contractcourt: remove redundant return 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 1519a1bdfe channelnotifier: remove dead logging code 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath e1385af5a6 watchtower: remove dead logging code 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 72ed30e3e5 tlv: simplify byte slice comparison as recommenteded by static analysis 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath da9d7dd363 zpay32: invoice.MilliSat is uint64 which cannot be negative 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 1a13f822c6 invoices: remove dead code from logger 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath e636364ccf channeldb: remove dead code from payments test 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 3628e65378 channeldb: (nit) remove size argument from map make 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath c7fa5ea863 queue: remove unsued waitgroup 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 70fc9c1901 invoices: elminitate sleep from expiry watcher tests
This commit removes sleeps from invoice expiry watcher tests in favor of
a timeout guard.
2020-04-09 09:58:22 +02:00
Andras Banki-Horvath 919710467e autopilot: tidying up source code to fit to 80 cols 2020-03-30 16:36:13 +02:00
Andras Banki-Horvath 93cb05142a lnrpc: rename FloatValue to FloatMetric
This commit renames lnrpc.FloatValue to lnrpc.FloatMetric as requested
in the final review of centrality PR.
2020-03-30 16:36:11 +02:00
Andras Banki-Horvath 5a4d595e53 lncli: group graph queries under Graph category
This commit moves DescribeGraph, GetNodeInfo and GetChanInfo under the
Graph category.
2020-03-27 13:56:10 +01:00
Andras Banki-Horvath 608354032c autopilot: parallelize betweenness centrality
This commit parallelizes betweenness centrality calculation, by
distributing the algo to N workers and creating partial results.
2020-03-27 13:56:10 +01:00
Andras Banki-Horvath 7e50997bb4 lnrpc: add betweenness centrality to GetNodeMetrics (new RPC call)
This commit extends the RPC interface with GetNodeMetrics will contain
all graph node metrics in the future. Currently only holds betweennes
centrality per node.
2020-03-27 13:56:08 +01:00
Andras Banki-Horvath 3fe9c70722 autopilot: betweenness centrality using Brandes algo on simplifed graph
This commit adds betweenness centrality to the available node metrics.
Betweenness centrality is a per node centrality measure which for an
arbitrary node v equals to the sum of shortest paths going trough v
divided by the number of all shortest paths for for each vertex pair
k, s where k != s != v.
2020-03-27 10:39:50 +01:00
Andras Banki-Horvath be83d504f8 autopilot: introduce NodeMetric interface for arbitrary graph metrics
This commit adds the NodeMetric interface which will be used for all
graph metrics not directly part of the autopilot but are useful in
composite heuristics to drive autopilot decisions and improve node
scores.
2020-03-27 10:36:28 +01:00