Commit Graph

10131 Commits

Author SHA1 Message Date
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
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
Andras Banki-Horvath
b17ed28dea build: add all subservers to dev build 2020-07-29 14:33:25 +02:00
carla
2a614cc596
multi: add labels to lnd native transactions
Follow up labelling of external transactions with labels for the
transaction types we create within lnd. Since these labels will live
a life of string matching, a version number and rigid format is added
so that string matching is less painful. We start out with channel ID,
where available, and a transaction "type". External labels, added in a
previous PR, are not updated to this new versioned label because they
are not lnd-initiated transactions. Label matching can check this case,
then check for a version number.
2020-07-29 13:46:07 +02: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
Olaoluwa Osuntokun
da16a196a3
Merge pull request #4488 from cfromknecht/enforce-min-cltv-18
multi: enforce conservative minimum for user-chosen CLTV deltas
2020-07-27 11:18:08 -07:00
Oliver Gugger
da447233c8
mod: update to latest x/crypto version w/o broken ARM assembly
This update previously happened in 1589810 but was overwritten again by
a later PR. We need to use a version that doesn't include the broken ARM
assembly for poly1305. We might as well use the latest version of the
library.
2020-07-27 14:15:44 +02:00
Oliver Gugger
ecca1f9653
itest: fix flakiness around/startup/reconnect 2020-07-27 14:15:36 +02:00
Conner Fromknecht
53ab22305d
zpay32: rename to DefaultAssumedFinalCLTVDelta
This renames the paramter to clarify that this value is only used when
no CLTV value was decoded from the payment request
2020-07-24 13:14:03 -07:00