Commit Graph

361 Commits

Author SHA1 Message Date
Wilmer Paulino
a620ce3682
build: update btcd and btcwallet dependencies 2021-04-05 15:41:04 -07:00
Oliver Gugger
02267565fe
multi: unify code blocks in READMEs 2021-01-22 09:14:11 +01:00
Conner Fromknecht
ea8d02eb68
chainntnfs/test: parallelize iface tests by backend 2020-12-10 20:56:10 -08:00
Yong
582b164c46
kvdb: add timeout options for bbolt (#4787)
* mod: bump btcwallet version to accept db timeout

* btcwallet: add DBTimeOut in config

* kvdb: add database timeout option for bbolt

This commit adds a DBTimeout option in bbolt config. The relevant
functions walletdb.Open/Create are updated to use this config. In
addition, the bolt compacter also applies the new timeout option.

* channeldb: add DBTimeout in db options

This commit adds the DBTimeout option for channeldb. A new unit
test file is created to test the default options. In addition,
the params used in kvdb.Create inside channeldb_test is updated
with a DefaultDBTimeout value.

* contractcourt+routing: use DBTimeout in kvdb

This commit touches multiple test files in contractcourt and routing.
The call of function kvdb.Create and kvdb.Open are now updated with
the new param DBTimeout, using the default value kvdb.DefaultDBTimeout.

* lncfg: add DBTimeout option in db config

The DBTimeout option is added to db config. A new unit test is
added to check the default DB config is created as expected.

* migration: add DBTimeout param in kvdb.Create/kvdb.Open

* keychain: update tests to use DBTimeout param

* htlcswitch+chainreg: add DBTimeout option

* macaroons: support DBTimeout config in creation

This commit adds the DBTimeout during the creation of macaroons.db.
The usage of kvdb.Create and kvdb.Open in its tests are updated with
a timeout value using kvdb.DefaultDBTimeout.

* walletunlocker: add dbTimeout option in UnlockerService

This commit adds a new param, dbTimeout, during the creation of
UnlockerService. This param is then passed to wallet.NewLoader
inside various service calls, specifying a timeout value to be
used when opening the bbolt. In addition, the macaroonService
is also called with this dbTimeout param.

* watchtower/wtdb: add dbTimeout param during creation

This commit adds the dbTimeout param for the creation of both
watchtower.db and wtclient.db.

* multi: add db timeout param for walletdb.Create

This commit adds the db timeout param for the function call
walletdb.Create. It touches only the test files found in chainntnfs,
lnwallet, and routing.

* lnd: pass DBTimeout config to relevant services

This commit enables lnd to pass the DBTimeout config to the following
services/config/functions,
  - chainControlConfig
  - walletunlocker
  - wallet.NewLoader
  - macaroons
  - watchtower
In addition, the usage of wallet.Create is updated too.

* sample-config: add dbtimeout option
2020-12-07 15:31:49 -08:00
Oliver Gugger
2edc3cf98f
multi: update to latest btcd version
With this commit we update btcd to the latest version which allows us to
specify the btcd binary we want to use when spinning up a new node.
2020-12-03 11:30:22 +01:00
Federico Bond
10d94f99c0
multi: move several wait group done calls to defer statements 2020-11-23 14:48:44 +01:00
Andras Banki-Horvath
2a358327f4
multi: add reset closure to kvdb.View
This commit adds a reset() closure to the kvdb.View function which will
be called before each retry (including the first) of the view
transaction. The reset() closure can be used to reset external state
(eg slices or maps) where the view closure puts intermediate results.
2020-11-05 17:57:12 +01:00
Johan T. Halseth
df6606d37f
txnotifier test: add test for confirmation after cancellation
This test addition would cause the txnotifier to crash prior to the
previous commit.
2020-09-16 11:23:02 +02:00
Johan T. Halseth
2665836fa3
txnotifier: delete ntfn by confirm height always
When we cancel a confirmation request, we should remove the request from
the height map regardless of the current height. Otherwise we end up in
the situation when the height is reached, the notification is attempted
sent which results in a crash.
2020-09-16 11:20:37 +02:00
Johan T. Halseth
3a12b5867f
txnotifier test: use Cancel() directly 2020-09-16 11:19:53 +02:00
Conner Fromknecht
2e175f54ef
Merge pull request #4528 from yyforyongyu/fix-typo
trivial: typo fix
2020-08-13 12:06:25 -07:00
Conner Fromknecht
ff7bfb492a
chainntnfs/txnotifier: remove events on teardown
If a concurrent call to cancel is made while the notifier is shutting
down, this would cause a panic (close of closed channel) since the
events are not removed from the notification sets.
2020-08-12 17:42:50 -07:00
yyforyongyu
57f7115437
trivial: typo fix 2020-08-13 07:33:52 +08:00
Conner Fromknecht
0f7c20977b
chainntnfs: unit test disabled height hint cache behavior 2020-07-14 19:25:46 -07:00
Conner Fromknecht
47ce718d29
chainntnfs: wrap disabled height hint query logs 2020-07-14 19:25:03 -07:00
Conner Fromknecht
7e08322d40
chainntfns: rename to CacheConfig and QueryDisabled 2020-07-14 19:24:44 -07:00
Andreas M. Antonopoulos
61ea9fad78 New config option - disable height hint cache queries
typo broke test


leftover junk


Fix to comply with linter 

and also, D'oh conditional
2020-06-26 21:40:00 -04:00
Wilmer Paulino
69b8a356b2
chainntnfs: remove queued confirmation notification in CancelConf
This addresses a panic when a notification is canceled after its been
detected as included in a block and before its confirmation notification
is dispatched.
2020-06-10 13:45:45 -07:00
Conner Fromknecht
d0d2ca403d
multi: rename ReadTx to RTx 2020-05-26 18:20:37 -07:00
Olaoluwa Osuntokun
280bf8d26c
Merge pull request #4226 from breez/fix-chainrpc-crash
Fix crash when ChainNotifier is being accessed too early.
2020-05-15 16:17:40 -07:00
Roei Erez
ae2c37e043 Ensure chain notifier is started before accessed.
The use case comes from the RPC layer that is ready before the
chain notifier which is used in the sub server.
2020-04-30 12:54:33 +03:00
Roei Erez
cfe0babd78 chainntnfs: use sync.Once to start notifiers. 2020-04-30 12:49:36 +03:00
Andras Banki-Horvath
556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Conner Fromknecht
8fd5d13c75
Merge pull request #4064 from breez/optimistic-batch-limit
Use batch for historical confirmations filters request.
2020-03-23 13:59:10 -07:00
Roei Erez
ceb454aa16 neutrinonotify: use batch for historical confirmations.
This commit introduces an optimization for the chain scanning
used in historical confirmations notifications.
It now uses batch request instead of requesting filters one by one.
2020-03-23 09:51:13 +02:00
Olaoluwa Osuntokun
f1963084a8
chainntnfs: convert to use new kvdb abstraction 2020-03-18 19:35:16 -07:00
Elle Mouton
3aa8972cc7 bitcoindnotify: add missing space in log message in bitcoind.go 2019-12-10 14:54:27 +02:00
Johan T. Halseth
ddeb9fbbbb
chainntnfs/txnotifier: promote historical spend log to info
And add some more details.
2019-11-21 15:18:27 +01:00
Johan T. Halseth
339543857a
chainntnfs/txnotifier: add more debug logs aroung spend dispatch
To track down missing spends.
2019-11-21 15:18:20 +01:00
Johan T. Halseth
1c832789d6
chainntnfs/bitcoind: log finished hitsorical spend dispatch 2019-11-21 15:18:15 +01:00
Johan T. Halseth
fa40fa6950
chainntnfs/interface: add String method for SpendDetaill 2019-11-21 15:18:10 +01:00
Johan T. Halseth
2e85647ec4
chainntnfs/txnotifier: include script in SpendRequest string representation 2019-11-21 15:18:01 +01:00
Johan T. Halseth
f0048bb662
chainntnfs/txnotifier_test: add TestTxNotifierSpendDuringHistoricalRescan 2019-11-14 15:05:50 +01:00
Johan T. Halseth
fd906475dd
Merge pull request #3569 from guggero/chainntfs-addr-reuse
chainntnfs: fix nil pointer on address reuse
2019-10-23 12:45:57 +02:00
Oliver Gugger
fa948c23fe
chainntnfs: add test that validates fixed nil pointer dereference 2019-10-23 11:25:30 +02:00
Oliver Gugger
51c066e7ed
chainntnfs: don't register notifications twice if details exist 2019-10-23 11:19:25 +02:00
Johan T. Halseth
753f30a6ff
chainntnfs/neutrino: don't ignore failed filter fetches
Earlier GetCFilter could return a nil-error along with a nil-filter in
cases where we failed to fetch the filter. We would just ignore the
block causing us to miss potential crucial information.

Now that GetCFilter will return an error in cases where the fetch
failed, the filter will never be nil (even for blocks with only coinbase
transactions), and we'll instead return an error.

We also increase the number of retries for the filter from the default 2
to 5.
2019-10-15 11:25:31 +02:00
Wilmer Paulino
194a9dea81
multi: support sync freelist option within btcwallet 2019-10-04 12:19:40 -04:00
Johan T. Halseth
e88c635b7e
Merge pull request #3573 from wpaulino/log-conf-ntfn-once
chainntnfs: only log confirmation notification registration once
2019-10-04 13:06:42 +02:00
Wilmer Paulino
e51df8d810
chainntnfs: only log confirmation notification registration once 2019-10-03 14:05:28 -04:00
Joost Jager
b58dbb2d70
multi: fix canceled spelling 2019-10-03 17:27:36 +02:00
Johan T. Halseth
d195acc632
chainntnfs/neutrino: start concurrent queues prior to connection
Similar to what was done for btcd, just to make sure we won't be blocked
on any incoming notifications, start the queues first thing during
startup.
2019-09-16 08:54:06 +02:00
Johan T. Halseth
6b6beb4d7d
chainntnfs/btcd: start concurrent queues prior to connection
We would establish the connection to the chain backend and start getting
block notifications before we had started the concurrent queues, which
would lead to the OnBlockConnected call being blocked, and a deadlock
(since GetBestBlock would never return).

Instead we make sure to start the queues before establishing the
connection, consuming the notifications right away.
2019-09-16 08:54:06 +02:00
Olaoluwa Osuntokun
5ecde6d552
lnwallet+chainntnfs: update to use latest neutrino APIs 2019-09-11 05:57:06 -07:00
Joost Jager
3d7de2ad39
multi: remove dead code 2019-09-10 17:21:59 +02:00
Wilmer Paulino
2f6ec77b3c
chainntnfs/interface_test: lower mempool spend check timeout
In this commit, we lower the mempool spend check timeout to be twice as
long as the trickle interval of the miner node, which will greatly
improve the execution time of this specific test. We're able to do this
now since we can specify custom trickle intervals for our test
harnesses.
2019-08-29 18:05:46 -07:00
Wilmer Paulino
cb1d6683d9
chainntnfs: acquire TxNotifier lock after closing quit chan
This prevents a deadlock while tearing down the TxNotifier if it's
currently blocked delivering a notification. By closing the quit chan
first, we ensure blocked sends/reads can exit and allow the TxNotifier
to proceed tearing down.
2019-08-22 13:49:38 -07:00
Wilmer Paulino
17b6205f3a
chainntnfs: validate conf/spend ntfn registration parameters
A height hint not being set would cause lnd to scan for the
confirmation/spend of a txid/outpoint/address from genesis.

The number of confirmations not being set within a confirmation request
would cause the internal TxNotifier to deadlock when dispatching
updates.
2019-08-22 13:49:37 -07:00
Wilmer Paulino
7821eb6ffb
chainntnfs: refactor common registration code within RegisterSpendNtfn 2019-08-22 13:49:35 -07:00
Wilmer Paulino
5089311ca1
chainntnfs: refactor common registration code within RegisterConfirmationsNtfn 2019-08-22 13:49:33 -07:00