Commit Graph

9906 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
feb300f102
Merge pull request #4407 from cfromknecht/gen-keysend-pay-addr
invoices/invoiceregistry: special-case payaddr index insertion for keysend
2020-06-26 16:38:19 -07:00
Wilmer Paulino
a998d5d647
Merge pull request #4106 from yyforyongyu/display-recovery-progress
multi: add a rpc endpoint to track the recovery process
2020-06-26 11:06:46 -07:00
Conner Fromknecht
20dea0d6bc
invoices/invoiceregistry: explicitly set blank pay addr for keysend 2020-06-26 02:17:18 -07:00
Conner Fromknecht
11e9fd3e92
channeldb/invoices: special-case all zeros pay addr
Avoids indexing the all-zeros pay addr, since it is still in use by
legacy keysend. Without this, the pay addr index will reject all but the
first keysend since they will be detected as duplicates within the set
id index.
2020-06-26 02:00:03 -07:00
yyforyongyu
987edc9d81 multi: add a rpc endpoint to track the recovery process 2020-06-25 15:49:54 +08:00
Conner Fromknecht
c1ef5bb908
Merge pull request #4410 from yyforyongyu/remove-fastsha256
htlcswitch: remove fastsha256 in test
2020-06-24 21:09:37 -07:00
yyforyongyu
0b573827ac htlcswitch: remove fastsha256 in test 2020-06-24 18:08:38 +08:00
Olaoluwa Osuntokun
1de7e30cd1
Merge pull request #4361 from yyforyongyu/add-channel-status
contractcourt: add ChannelStatus in MarkChannelClosed
2020-06-23 16:23:30 -07:00
Olaoluwa Osuntokun
bd1728606b
Merge pull request #4328 from joostjager/anchor-test-vectors
lnwallet/test: reproduce test vectors in commit and htlc tx test
2020-06-23 16:09:05 -07:00
Jasper Rädisch
20b42ce261 cmd/lncli: add fwdinghistory support for relative times
- introduces new parser in `cmd/lncli/arg_parse.go`
- converts start_time and end_time flags to strings
- adds default value for end_time
2020-06-23 15:58:23 -07:00
Conner Fromknecht
03b20cabd2
Merge pull request #4275 from cfromknecht/invoices-ntfn-order
invoices: ensure ntfns are sent in the same order
2020-06-22 12:15:07 -07:00
Joost Jager
8f2a2fc5da
Merge pull request #4018 from breez/intercept-forward-htlc
Intercept forward htlc
2020-06-22 10:18:14 +02:00
Olaoluwa Osuntokun
acc698a699
Merge pull request #4379 from Roasbeef/scb-union-bug-fix
chanbackup: always combine with on-disk state when swapping, refuse to start w/ invalid files
2020-06-18 18:49:28 -07:00
Conner Fromknecht
60a6f2ddd1
Merge pull request #4391 from matheusdtech/lnwire-zero-sid
lnwire: fix decoding for initial zero sid
2020-06-18 17:21:43 -07:00
Conner Fromknecht
47cf144170
invoices: ensure ntfns are sent in the same order
SettleHodlInvoice and CancelInvoice both notifyClients after
notifyHodlSubscribers. This commit changes UpdateInvoice to follow the
same pattern so that we are consistent.
2020-06-18 16:28:13 -07:00
Conner Fromknecht
f5581eb04a
Merge pull request #4370 from wpaulino/no-graph-restored-channels
channeldb: remove graph insertion of restored channels
2020-06-18 16:17:56 -07:00
Wilmer Paulino
8c79359247
Merge pull request #4395 from bmancini55/reply-channel-range-query
discovery: prevent endBlock overflow in replyChanRangeQuery
2020-06-18 15:19:52 -07:00
Wilmer Paulino
d808ec0d17
itest: add sync error to whitelist 2020-06-18 14:51:45 -07:00
Wilmer Paulino
d23be59f53
channeldb: remove graph insertion of restored channels
This was initially done as there were a few assertions throughout the
codebase requiring a channel's policy to be known. Now that these have
been addressed, we no longer need to store restored channels in the
graph, as their policies where incomplete anyway.
2020-06-18 14:51:44 -07:00
Brian Mancini
28931390ff discovery: prevent endBlock overflow in replyChanRangeQuery
Modifies syncer.replyChanRangeQuery method to use the LastBlockHeight
method on the query. LastBlockHeight safely calculates the ending
block height and prevents an overflow of start_block + num_blocks.

Prior to this change, query messages that had a start_block +
num_blocks that overflows uint32_max would return zero results in the
reply message.

Tests are added to fix the bug and ensure proper start and end values
are supplied to the channel graph filter.
2020-06-18 16:48:09 -04:00
Conner Fromknecht
5eb798a23e
Merge pull request #4365 from Crypt-iQ/chancloser_pkg_0609
lnwallet/chancloser: cooperative channel closure pkg
2020-06-18 13:38:41 -07:00
Matheus Degiovani
44555a70ed lnwire: fix decoding for initial zero sid
This fixes a decoding error when the list of short channel ids within a
QueryShortChanIDs message started with a zero sid.

BOLT-0007 specifies that lists of short channel ids should be sorted in
ascending order. Previously, this was checked within lnwire by comparing
two consecutive sids in the list, starting at the empty (zero) sid.

This meant that a list that started with a zero sid couldn't be decoded
since the first element would _not_ be greater than the last one
(namely: also zero).

Given that one can only check for ordering starting at the second
element, we add a check to ensure the proper behavior.

A unit test is also added to ensure no future regressions on this
behavior.
2020-06-18 14:04:39 -03:00
Roei Erez
7b56268f70 rpc: implement RPC htlc interceptor.
In this commit we add the ability to intercept forwarded htlc packets
straight from the RPC layer. The RPC layer handles a bidrectional stream
that comminucates to the client the intercepted packets and handles its
response by coordinating with the interceptable switch.
2020-06-18 15:20:07 +03:00
Roei Erez
0f50d8b2ed htlcswitch: introducing interceptable switch.
In this commit we implement a wrapper arround the switch, called
InterceptableSwitch. This kind of wrapper behaves like a proxy which
intercepts forwarded packets and allows an external interceptor to
signal if it is interested to hold this forward and resolve it
manually later or let the switch execute its default behavior.
This infrastructure allows the RPC layer to expose interceptor
registration API to the user and by that enable the implementation
of custom routing behavior.
2020-06-18 15:12:50 +03:00
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
Olaoluwa Osuntokun
496e29d02e
chanbackup: refuse to start the SubSwapper if we can't read the SCB file
In this commit, we add an additional defense against starting up with an
invalid SCB state. With this commit, we'll now fail to start up if we're
unable to update or read the existing SCB state from disk. This will
prevent an lnd node from starting up with an invalid SCB file, an SCB
file it can't decrypt, or an SCB left over from another node.
2020-06-17 17:44:57 -07:00
Olaoluwa Osuntokun
fc65c9b2cc
chanbackup: always combine new backup data w/ on-disk state
In this commit, we fix a bug that could possibly cause a user's on disk
back up file to be wiped out, if they ever started _another_ lnd node
with different channel state. To remedy this, before we swap out the
channel state with what's on disk, we'll first read out the contents of
the on-disk SCB file and _combine_ that with what we have in memory.

Fixes #4377
2020-06-17 17:44:52 -07:00
Joost Jager
f1fbdb1b84
lnwallet/test: remove unused index field 2020-06-17 22:59:14 +02:00
Joost Jager
24e1126776
lnwallet/test: reproduce test vectors in commit and htlc tx test
This commit changes the verification of our code against the spec test
vectors to use a more black box approach. It exercises the channel state
machine via its external interface as much as possible, making this test
more robust. A consequence of this is that the test now runs from the
'root' data from which the test vectors are also derived, meaning that
more code is covered too.

Running from the root data is also a preparation for _producing_ test
vectors for the new anchor commitment format. This will be a matter of
changing the channel type and recording the produced commitment and htlc
txes.

Previously the success transaction was skipped during verification. With
this commit, the proper preimage insertion is carried out, allowing the
success tx to be checked too.
2020-06-17 22:59:12 +02: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
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