Commit Graph

10035 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
38265b9a46
Merge pull request #4348 from Roasbeef/etcd-local-graph-db
multi: create split local/remote database structure
2020-08-07 19:50:02 -07:00
Olaoluwa Osuntokun
f58b00ef55
multi: split database storage into remote and local instances
In this commit, we split the database storage into two classes: remote
and local data. If etcd isn't active, then everything is actually just
local though we use two pointers everywhere. If etcd is active, then
everything but the graph goes into the remote database.
2020-08-07 18:44:02 -07:00
Olaoluwa Osuntokun
7355c8ba3a
lncfg: add new GetBackends which returns active DB backends
In this commit, we modify the existing `GetBackend` method to now be
called `GetBackends`. This new method will populate a new `RemoteDB`
attribute based on if the replicated backend is active or not. As is,
the local backend is used everywhere. An upcoming commit will once again
re-enable the remote backend, in a hybrid manner.
2020-08-07 18:44:00 -07:00
Olaoluwa Osuntokun
6a6521bba0
Merge pull request #4507 from Kixunil/patch-2
Updated deprecation message of noseedbackup
2020-08-06 18:53:53 -07:00
Olaoluwa Osuntokun
ef237c549a
Merge pull request #4511 from guggero/browser-websocket-fix
Bugfix: Allow browsers to send macaroon in WebSocket calls
2020-08-06 18:24:24 -07:00
Olaoluwa Osuntokun
fcb41dae37
Merge pull request #4475 from guggero/travis-windows
travis: add integration test on Windows
2020-08-06 18:15:02 -07:00
Oliver Gugger
af8ffc9764
lntest: add WS test case with custom header macaroon 2020-08-06 12:11:20 +02:00
Oliver Gugger
c7cb2c0a78
docs: describe how to use WebSockets with the REST API
We add a new document that shows two examples of how to use the
WebSocket REST API with JavaScript.
2020-08-06 12:09:15 +02:00
Oliver Gugger
c5c28564e9
lnrpc: add macaroon workaround for WebSockets in browsers
For security reasons, browsers are limited in the header fields they can
send when opening a WebSocket connection. Specifically, the macaroon
cannot be sent in the Grpc-Metadata-Macaroon header field as that would
be possible for normal REST requests. Instead we only have the special
field "Sec-Websocket-Protocol" that can be used to transport custom
data. We allow the macaroon to be sent there and transform it into a
proper header field for the target request.
2020-08-06 12:07:07 +02:00
Martin Habovštiak
c4f739ac8a config: Updated deprecation message of noseedbackup
According to the recent discussion `noseedbackup` is not deprecated.
This change clarifies the message about deprecation.
Also fixes a typo.

Closes #4499
2020-08-05 21:29:24 +02:00
Conner Fromknecht
24eba7013c
Merge pull request #4509 from CandleHater/patch-2
rpc: add missing space to error message
2020-08-05 11:38:09 -07:00
Conner Fromknecht
0e558cfbed
Merge pull request #4506 from Roasbeef/free-list-sync-config-fix
config: make bbolt freelist settings mutually exclusive
2020-08-05 11:37:27 -07:00
Candle
adfd0dc015
rpc: add missing space to error message
This corrects the output of the chain notifier RPC error. It has been displayed as: "chain notifier RPC *isstill* in the process of starting"
2020-08-05 09:58:05 +00:00
Oliver Gugger
97c73706b5
channeldb: fix for Windows clock resolution
We use the event timestamp of a forwarding event as its primary storage
key. On systems with a bad clock resolution this can lead to collisions
of the events if some of the timestamps are identical. We fix this
problem by shifting the timestamps on the nanosecond level until only
unique values remain.
2020-08-05 09:15:03 +02:00
Oliver Gugger
b21b2ebd6f
lntest: improve fee calculation in multi-hop test 2020-08-05 09:06:32 +02:00
Oliver Gugger
a6a7aca8af
travis: add itest on Windows
This commit adds an integration test that runs on a Windows virtual
machine on Travis. The tests run inside of a "Git Bash" environment
which supports the same command line syntax as a proper bash but doesn't
have all the tooling installed. Some tools also behave differently on
Windows. Therefore we also have to simplify the command to upload the
logs to termbin and remove the upload to file.io on Windows because both
the find and tar command don't work as expected.
2020-08-05 09:02:42 +02:00
Oliver Gugger
6115a7b12b
make+itest: make itest Windows compatible 2020-08-05 08:53:04 +02:00
Oliver Gugger
2f1f8561ae
mod: update to latest btcd version 2020-08-05 08:53:04 +02:00
Olaoluwa Osuntokun
19f68d2538
lnd: log bbolt freelist sync config value on start up 2020-08-04 18:55:02 -07:00
Olaoluwa Osuntokun
e616903d4f
config: unify old and new config values for sync-freelist
In this commit, unify the old and new values for `sync-freelist`, and
also ensure that we don't break behavior for any users that're using the
_old_ value.

To do this, we first rename what was `--db.bolt.no-sync-freelist`, to
`--db.bolt.sync-freelist`. This gets rid of the negation on the config
level, and lets us override that value if the user is specifying the
legacy config option.

In the future, we'll deprecate the old config option, in favor of the
new DB scoped option.
2020-08-04 18:55:00 -07:00
Olaoluwa Osuntokun
675c1b95c9
lnd: don't set freelist value when creating channeldb
This value actually isn't read anywhere, since it's no longer used.
Instead, `cfg.Db.Bolt.NoSyncFreeList` is what's evaluated when we go to
open the DB.
2020-08-04 18:54:59 -07:00
Olaoluwa Osuntokun
ec94532968
Merge pull request #4504 from halseth/mobile-wallet-unlocker-split
mobile: remember walletunlocker.proto
2020-08-04 14:15:46 -07:00
Johan T. Halseth
09b8bee865
mobile: remember walletunlocker.proto 2020-08-04 14:43:08 +02:00
Conner Fromknecht
f144dea3da
Merge pull request #4411 from bhandras/test_channeldb
kvdb+etcd+tests: change etcd flattened bucket key derivation to make it compatible with bbolt
2020-07-31 17:37:13 -07: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
Conner Fromknecht
247b7530ca
build/version: use dot syntax for rc 2020-07-29 21:08:47 -07:00
Conner Fromknecht
608617975a
build/version: bump to 0.11.0-beta-rc1 2020-07-29 20:13:24 -07:00
Conner Fromknecht
26c363c6c6
Merge pull request #4494 from guggero/travis-sanity-check
travis: add sanity check stage
2020-07-29 17:03:08 -07:00
Olaoluwa Osuntokun
9f124ce6ad
Merge pull request #4438 from xplorfin/go1.13
chore: Update minimum golang version to 1.13
2020-07-29 16:55:33 -07:00
Olaoluwa Osuntokun
d36d22107c
Merge pull request #4432 from Crypt-iQ/peer_unsigned_fix_0702
channeldb+lnwallet: store updates the peer should sign under new key
2020-07-29 16:54:23 -07:00
nsa
c36840c2a5 lnwallet: add regression test TestChannelLocalUnsignedUpdatesFailure
This commit includes a regression test that checks that we remember
to restore updates that we sent to the peer but they haven't sent
us a signature for yet.
2020-07-29 19:03:44 -04:00
nsa
e4188ba9c2 channeldb+lnwallet: store updates the peer should sign under new key
This fixes a long-standing force close bug. When we receive a
revocation, store the updates that the remote should sign next under
a new database key. Previously, these were not persisted which would
lead to force closure.
2020-07-29 19:03:44 -04:00
Oliver Gugger
77fc1ac68f
travis: add sanity check stage 2020-07-29 10:16:47 +02:00
Jake Sylvestre
678e5c5736 chore: Update minimum golang version to 1.13 2020-07-28 19:46:52 -04:00
Olaoluwa Osuntokun
a39c91fbcb
Merge pull request #4408 from guggero/travis-arm
travis: add integration test on ARM
2020-07-28 16:21:30 -07: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
Conner Fromknecht
22cd1203fe
Merge pull request #4431 from Crypt-iQ/unsigned_acked_fix_0702
channeldb/channel.go: remove unsignedAckedUpdatesKey when we receive revocation
2020-07-27 16:19:28 -07:00
nsa
b6eff5b0ec lnwallet: add regression test TestChannelUnsignedAckedFailure
This commit includes a regression test that checks that a force
close won't occur and that unsigned acked updates are properly
restored.
2020-07-27 16:18:11 -04:00
nsa
8c002a08a7 lnwallet: properly restore removeCommitHeightRemote
Previously, we could sign a pending commitment for the remote party,
disconnect, and not restore these signed remote updates as having been
removed at the pending commitment height. This commit fixes that to
look up whether the update under the unsigned acked updates key is
present on the pending commitment or not and appropriately set
the remove commit heights.
2020-07-27 15:41:48 -04:00
nsa
2149157d49 channeldb: filter out unsigned acked updates in AdvanceCommitChainTail
This commit moves the deletion of all updates under the unsigned
acked updates key from AppendRemoteCommitChain to
AdvanceCommitChainTail. This is done because if we went down after
signing for these updates but before receiving a revocation, we would
incorrectly reject their commitment signature:

Alice                Bob
      -----add----->
      -----sig----->
      <----rev------
      <----sig------
      -----rev----->
      <----fail-----
      <----sig------
      -----rev----->
      -----sig----->
      *reconnect*
      <----rev------
      <----add------
      x----sig------

It is also important to note that filtering is required when we
receive a revocation to ensure that we aren't erroneously deleting
remote updates. Take the following state transitions:

 Alice                Bob
       -----add----->
       -----sig----->
       <----rev------
       <----sig------
       -----rev----->
       -----add----->
       -----sig----->
       <----fail-----
       <----sig------
       -----rev-----> (alice stores updates here)
       <----rev------

In the above case, if Alice deleted all updates rather than filtering
when receiving the final revocation from Bob, then Alice would have
to force close the channel due to missing updates. Since Alice hasn't
signed for any of the unsigned acked updates, she should not filter any
of them out.
2020-07-27 15:41:48 -04:00
Conner Fromknecht
36eb666cb7
Merge pull request #4480 from CandleHater/patch-1
lncli: remove new line from password confirmation
2020-07-27 12:10:47 -07:00
Olaoluwa Osuntokun
2aff7d0bb8
Merge pull request #4390 from bhandras/etcd_docs
docs: documentation for the experimental etcd feature
2020-07-27 11:44:12 -07:00
Conner Fromknecht
5b376bfdb8
Merge pull request #4430 from Crypt-iQ/sync_bug_fix_0701
lnwallet/channel.go: restore bug fixes
2020-07-27 11:25:52 -07:00