Commit Graph

9815 Commits

Author SHA1 Message Date
Roei Erez
1a6701122c htlcswitch: change ForwardPackets to return error
As part of the preparation to the switch interceptor feature, this
function is changed  to return error instead of error channel that
is closed automatically.
Returning an error channel has become complex to maintain and
implement when adding more asynchronous flows to the switch.
The change doesn't affect the current behavior which logs the
errors as before.
2020-06-18 12:48:21 +03:00
Conner Fromknecht
87880c0d56
Merge pull request #4141 from guggero/rest-api-improvements
REST saga 3/3: REST API for subservers, websocket for streaming responses
2020-06-17 10:30:29 -07:00
Oliver Gugger
1cda467701
lnrpc: explain how to use map types in REST 2020-06-17 08:35:52 +02:00
Oliver Gugger
e73c9218d7
itest: add REST API tests 2020-06-17 08:35:51 +02:00
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
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
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
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
Matheus Degiovani
a2a2a301ca contractcourt/incoming_resolver: Improve comments
Small nits on a few comments.
2020-06-05 16:52:48 -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
Oliver Gugger
f48b0289f5
make: check that all RPCs are defined in yaml 2020-06-04 08:50:44 +02:00
Oliver Gugger
558d63718b
rpcserver+lnrpc: register REST subservers with root server 2020-06-04 08:50:44 +02:00
Oliver Gugger
fe16be5bb8
lnrpc: extract or add REST annotations to yaml 2020-06-04 08:50:00 +02:00
Oliver Gugger
3ef41dd198
lnrpc: update grpc-gateway to v1.14.3 2020-06-04 08:43:49 +02:00
Conner Fromknecht
7f258d0213
Merge pull request #4303 from wpaulino/persistent-output-leases
walletrpc: add basic coin selection RPCs
2020-06-03 21:39:15 -07:00
Wilmer Paulino
146611d1c1
lnrpc: mark existing ListUnspent RPC as deprecated in favor of walletrpc 2020-06-03 19:03:05 -07:00
Wilmer Paulino
acfd432602
walletrpc: add ListUnspent RPC 2020-06-03 19:03:04 -07:00
Wilmer Paulino
7616a3dc7f
rpc: refactor request validation and response marshal into functions 2020-06-03 18:50:11 -07:00
Wilmer Paulino
9dcaf4fbc6
walletrpc: add output leases RPCs 2020-06-03 18:50:09 -07:00