Commit Graph

10224 Commits

Author SHA1 Message Date
Anthony Ronning
a76e752f3b
config+lnd+rpcserver: add CORS origin config for REST 2020-06-17 08:34:55 +02:00
Oliver Gugger
6250ed1cf1
lnrpc: add WebSocket proxy 2020-06-17 08:34:54 +02:00
nsa
2d68a64a5b chancloser: new package for cooperative channel closure
Introduces a new chancloser package which exposes a ChanCloser
struct that handles the cooperative channel closure negotiation
and is meant to replace chancloser.go in the lnd package. Updates
all references to chancloser.go to instead use chancloser package.
2020-06-16 20:34:44 -04:00
nsa
8528ec4568 lnd: modifying comments in chancloser.go 2020-06-16 20:34:44 -04:00
Olaoluwa Osuntokun
ed93c16e51
Merge pull request #4033 from Roasbeef/go1.14
build: update travis to build against go 1.14
2020-06-16 16:25:34 -07:00
Joost Jager
4a7cefdab3
Merge pull request #4264 from joostjager/itest-err-detector-doc
doc: describe usage of log levels
2020-06-16 16:33:50 +02:00
Olaoluwa Osuntokun
25f6d51b45
build: update Github Actions to use Go 1.14.4 2020-06-15 17:51:22 -07:00
Olaoluwa Osuntokun
7261b064db
build: update to walletdb v1.3.3 and wtxmgr v1.2.0 2020-06-15 17:51:20 -07:00
Olaoluwa Osuntokun
870b64a5bd
build: update travis to build against go 1.14 2020-06-15 17:51:19 -07:00
Olaoluwa Osuntokun
3c48cab227
Merge pull request #4366 from wpaulino/bitcoind-20-compat
Support bitcoind v0.20
2020-06-15 17:45:35 -07:00
Olaoluwa Osuntokun
103c59a488
Merge pull request #4262 from Crypt-iQ/strip_dwarf_0507
Makefile: add -w to -ldflags to strip DWARF symbols
2020-06-15 10:42:44 -07:00
Olaoluwa Osuntokun
1cce50d3b7
Merge pull request #4345 from matheusdtech/brar-flake
breacharbiter: fix flaky race condition in test
2020-06-15 10:41:44 -07:00
Conner Fromknecht
d688ea2124
Merge pull request #4369 from wpaulino/coin-select-lock-sync
rpc: acquire global coin select lock in related RPCs
2020-06-15 10:06:43 -07:00
Joost Jager
4e945f6083
lnwallet/test: name test cases 2020-06-15 13:51:07 +02:00
Joost Jager
8b55c10e45
lnwallet/test: name testCase struct 2020-06-15 13:51:05 +02:00
Joost Jager
997bab0343
lnwallet/test: move htlcDesc struct 2020-06-15 13:51:03 +02:00
Joost Jager
c27406b579
lnwallet/test: move test htlcs out of function 2020-06-15 13:51:01 +02:00
Joost Jager
98ec8bf502
lnwallet/test: move test cases out of function 2020-06-15 13:50:59 +02:00
Joost Jager
3b7f084509
lnwallet/test: remove impossible test case
In this test case, the funder cannot pay the commit fee.
2020-06-15 13:50:57 +02:00
Joost Jager
4421894c4c
lnwallet/test: remove zero fee test case
This is currently not supported in lnd.
2020-06-15 13:50:55 +02:00
Wilmer Paulino
2a5b66ec00
lnwallet: note requirement of global coin selection lock 2020-06-12 11:22:30 -07:00
Wilmer Paulino
c2f1fe26c1
rpc: acquire global coin select lock in related RPCs
This ensures proper coin selection synchronization between lnd and users
of the RPC to avoid potential double spend errors.
2020-06-12 11:22:29 -07:00
Wilmer Paulino
9d9e54f83e
btcwallet: ensure output isn't locked by in-memory impl in LeaseOutput
The current implementation of LeaseOutput already checked whether the
output had already been leased by the persisted implementation, but not
the in-memory one used by lnd internally. Without this check, we could
potentially end up with a double spend error if lnd acquired the UTXO
internally before the LeaseOutput call.
2020-06-12 11:22:28 -07:00
Wilmer Paulino
6e8021f858
scripts: bump bitcoind version to 0.20 2020-06-12 10:46:20 -07:00
Wilmer Paulino
d49c6fba87
build: update btcwallet dependency for bitcoind v0.20 compat 2020-06-12 10:46:16 -07:00
Joost Jager
d1e049fa68 docs: describe log levels 2020-06-12 11:22:35 +02:00
Olaoluwa Osuntokun
9b8d51231c
Merge pull request #4355 from wpaulino/txnotifier-cancel-conf-cleanup
chainntnfs: remove queued confirmation notification in CancelConf
2020-06-11 18:13:44 -07:00
nsa
ec2d999371 chancloser+peer: export negotiationHeight, channel, and error 2020-06-11 15:49:23 -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
d47d17b5d4
Merge pull request #4261 from carlaKC/4164-indexpayments
channeldb: Index payments by sequence number
2020-06-10 08:11:45 -07:00
carla
ab594ea57b
channeldb: update QueryPayments to use sequence nr index and paginator
Use the new paginatior strcut for payments. Add some tests which will
specifically test cases on and around the missing index we force in our
test to ensure that we properly handle this case. We also add a sanity
check in the test that checks that we can query when we have no
payments.
2020-06-10 12:55:05 +02:00
carla
38624e8612
channeldb: add fetchPaymentWithSequenceNumber lookup and test
With our new index of sequence number to index, it is possible for
more than one sequence number to point to the same hash because legacy
lnd allowed duplicate payments under the same hash. We now store these
payments in a nested bucket within the payments database. To allow
lookup of the correct payment from an index, we require matching of the
payment hash and sequence number.
2020-06-10 12:55:03 +02:00
carla
eea871b583
channeldb: add a paginator struct to process generic pagination
We now use the same method of pagination for invoices and payments.
Rather than duplicate logic across calls, we add a pagnator struct
which can have query specific logic plugged into it. This commit also
addresses an existing issue where a reverse query for invoices with an
offset larger than our last offset would not return any invoices. We
update this behaviour to act more like c.Seek and just start from the
last entry. This behaviour change is covered by a unit test that
previously checked for the lack of invoices.
2020-06-10 12:49:48 +02:00
carla
f4933c67fd
channeldb: add test case for index offset greater than index
In our current invoice pagination logic, we would not return any
invoices if our offset index was more than 1 off our last index and we
were paginating backwards. This commit adds a test case for this
behaviour before fixing it in the next commit.
2020-06-10 12:49:13 +02:00
carla
c8d11285f3
channeldb: index payments by sequence number
Add an entry to a payments index bucket which maps sequence number
to payment hash when we initiate payments. This allows for more
efficient paginated queries. We create the top level bucket in its
own migration so that we do not need to create it on the fly.

When we retry payments and provide them with a new sequence number, we
delete the index for their existing payment so that we do not have an
index that points to a non-existent payment.

If we delete a payment, we also delete its index entry. This prevents
us from looking up entries from indexes to payments that do not exist.
2020-06-10 12:49:06 +02:00
carla
6c4a1f4f99
channeldb: update TestQueryPayments to cover duplicate payments
Update our current tests to include lookup of duplicate payments. We
do so in preparation for changing our lookup to be based on a new
payments index. We add an append duplicate function which will add a
duplicate payment with the minimum information required to successfully
read it from disk in tests.
2020-06-10 12:34:27 +02:00
nsa
85852733af Makefile: add -w to -ldflags to strip DWARF symbols
Compiling with this flag cuts down on the binary size by several
megabytes.
2020-06-09 14:40:48 -04:00
Matheus Degiovani
c76356e7be breacharbiter: fix flaky race condition in test
This fixes a possible race condition during TestBreachSpends that could
cause the test to fail in a flaky way.

The error returned in PublishTransaction (publErr) could be modified by
the main test goroutine before PublishTransaction had a chance to
return, causing the wrong error value to be returned.

This was mostly visible as a flake during TestBreachSpends/all_spends
where adding a one second delay in the old code between the send in
publTx and the call to publMtx.Lock() would cause the last iteration of
the test loop to fail.

This is fixed by moving the lock and locally storing the expected error
value to before the send so that each call to PublishTransaction is
guaranteed to return the correct error value.
2020-06-09 10:40:22 -03:00
Olaoluwa Osuntokun
38b8e54ba7
Merge pull request #4357 from bhandras/invoices_testify
invoices+test: replace DeepEqual + spew dump with testify
2020-06-08 20:37:38 -07:00
Conner Fromknecht
87d1c37e3c
Merge pull request #4356 from wpaulino/sign-key-desc-quirk
signrpc: parse both KeyDescriptor fields for SignOutputRaw requests
2020-06-08 20:16:52 -07:00
Conner Fromknecht
06028ed141
Merge pull request #4358 from matheusdtech/contest-doc
contractcourt/incoming_resolver: Improve comments
2020-06-08 15:12:56 -07:00
yyforyongyu
ac99c0d021 contractcourt: add ChannelStatus in MarkChannelClosed 2020-06-08 17:30:28 +08:00
Matheus Degiovani
a2a2a301ca contractcourt/incoming_resolver: Improve comments
Small nits on a few comments.
2020-06-05 16:52:48 -03:00
Matheus Degiovani
44f83731bc discovery: Correctly lock premature annoucements
This reworks the locking behavior of the Gossiper so that a race
condition on channel updates and block notifications doesn't cause any
loss of messages.

This fixes an issue that manifested mostly as flakes on itests during
WaitForNetworkChannelOpen calls.

The previous behavior allowed ChannelUpdates to be missed if they
happened concurrently to block notifications. The
processNetworkAnnoucement call would check for the current block height,
then lock the gossiper and add the msg to the prematureAnnoucements
list. New blocks would trigger an update to the current block height
then a lock and check of the aforementioned list.

However, specially during itests it could happen that the missing lock
before checking the height could case a race condition if the following
sequence of events happened:

- A new ChannelUpdate message was received and started processing on a
  separate goroutine
- The isPremature() call was made and verified that the ChannelUpdate
  was in fact premature
- The goroutine was scheduled out
- A new block started processing in the gossiper. It updated the block
  height, asked and was granted the lock for the gossiper and verified
  there was zero premature announcements. The lock was released.
- The goroutine processing the ChannelUpdate asked for the gossiper lock
  and was granted it. It added the ChannelUpdate in the
  prematureAnnoucements list. This can never be processed now.

The way to fix this behavior is to ensure that both isPremature checks
done inside processNetworkAnnoucement and best block updates are made
inside the same critical section (i.e. while holding the same lock) so
that they can't both check and update the prematureAnnoucements list
concurrently.
2020-06-05 15:58:33 -03:00
Matheus Degiovani
ccc8f8e48f discovery: Log new blocks
This should help debug some flaky itests.
2020-06-05 13:31:40 -03: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
Wilmer Paulino
98da6c61c1
signrpc: parse both KeyDescriptor fields for SignOutputRaw requests
This is meant to handle a quirk in which key descriptors obtained
through walletrpc.DeriveKey don't result in the derived key being
persisted to the wallet's database, unlike with DeriveNextKey. Due to
this and some fallback logic in the wallet with regards to empty key
locators, if a request only specified the compressed public key, the
signature returned would be over a different key, namely the one derived
from (family=0, index=0).
2020-06-04 17:44:25 -07:00
Oliver Gugger
be36776120
Merge pull request #4251 from guggero/rest-2-subservers
REST saga 2/3: Add REST endpoints to all RPCs
2020-06-04 10:26:42 +02:00
Oliver Gugger
19e3dc6378
routerrpc: format proto 2020-06-04 08:50:44 +02:00