Commit Graph

7820 Commits

Author SHA1 Message Date
Joost Jager
395e0596c2
invoices: fix synchronization issue with single invoice subscribers
This commit fixes a synchronization issue where a single invoice
subscriber could receive duplicate and/or out of order invoice updates.
2019-08-13 19:02:55 +02:00
Joost Jager
9ab23de197
invoices: create error for invoice registry shutting down 2019-08-13 19:02:53 +02:00
Joost Jager
46e2a9e9b8
invoices: reuse client.notify function 2019-08-13 19:02:51 +02:00
Joost Jager
bed2acea33
invoices: remove redundant state field from invoice event 2019-08-13 19:02:50 +02:00
Joost Jager
6ee2c04190
lnrpc/routerrpc: use vertex constructor 2019-08-13 18:45:10 +02:00
Joost Jager
a332990d2c
routing/route: add vertex constructor from bytes 2019-08-13 18:45:08 +02:00
Joost Jager
b610f417d2
routing: extended DirectedNodePair functionality 2019-08-13 18:45:06 +02:00
Joost Jager
5c52efc0eb
lnrpc/routerrpc: fix line wrap 2019-08-13 18:45:04 +02:00
Joost Jager
2b4debf42b
routing/test: remove unused methods from mock 2019-08-13 18:45:02 +02:00
Conner Fromknecht
9a5ac78912
Merge pull request #3391 from joostjager/always-return-invalid-details
htlcswitch+invoices: always return incorrect_or_unknown_payment_details
2019-08-12 20:14:49 -07:00
Olaoluwa Osuntokun
4e62e8ae67
Merge pull request #3355 from wpaulino/is-graph-synced
discovery+rpc: expose graph synced status within GetInfo
2019-08-12 18:22:45 -07:00
Olaoluwa Osuntokun
b2cb15184e
Merge pull request #3384 from cfromknecht/run-submodules
Makefile: ensure submodules are linted, covered, and tested
2019-08-09 13:02:21 -07:00
Conner Fromknecht
da7cb2d42a
tlv/primitive: use constructor for encoding/decoding type err 2019-08-08 15:57:48 -07:00
Conner Fromknecht
474ddc98ed
tlv/primitive_test: add basic encode/decode tests for primitives 2019-08-08 15:57:48 -07:00
Olaoluwa Osuntokun
6e43974d37
Merge pull request #3383 from cfromknecht/truncated-tlv-fix
tlv: fix decoding bug for truncated uint16 and uint32
2019-08-08 14:44:41 -07:00
Conner Fromknecht
4dbe9379a9
Makefile: ensure submodules are linted, covered, and tested 2019-08-08 14:39:18 -07:00
Joost Jager
98fac9fb99
htlcswitch+invoices: always return incorrect_or_unknown_payment_details
In order to prevent information leaks by nodes probing with a payment
hash, this commit changes exit hop processing so that it always returns
incorrect_or_unknown_payment_details and leaves the prober in the dark
about whether an invoice actually exists.
2019-08-08 11:04:23 +02:00
Joost Jager
922f133fd2
htlcswitch: report incoming htlc time lock with FinalIncorrectCltvExpiry
Previously the time lock in the onion payload was reported. This is no
new information to the sender.
2019-08-08 11:04:21 +02:00
Joost Jager
45b3c647f7
htlcswitch: return final_incorrect_htlc_amount on onion payload mismatch
This commit fixes exit hop behavior to be in line with the lightning
spec.
2019-08-08 11:04:19 +02:00
Joost Jager
aabd68ebcd
multi: rename FailUnknownPaymentHash to FailIncorrectDetails
Align naming better with the lightning spec. Not the full name of the
failure (FailIncorrectOrUnknownPaymentDetails) is used, because this
would cause too many long lines in the code.
2019-08-08 11:04:17 +02:00
Joost Jager
8681729561
htlcswitch/test: extract failure code assertion to function 2019-08-08 11:04:15 +02:00
Olaoluwa Osuntokun
c963fcbed8
Merge pull request #3331 from halseth/golangci-linter
[build, tooling] change linter gometalinter->golangci-lint
2019-08-07 21:32:12 -07:00
Olaoluwa Osuntokun
3e1b2c5256
Merge pull request #3379 from Roasbeef/rest-describe-graph
REST: increase max msg size for REST proxy
2019-08-07 21:17:54 -07:00
Conner Fromknecht
e6fdfbb1cb
tlv/truncated: fix decoding bug in DTUint16 and DTUint32
This commit fixes a bug in DTUint16 and DTUint32, which would cause them
to read too many bytes from the reader. This is due to the fact that
ReadFull was being called on a slice that could be greater than the
underlying type. This is not an issue for DTUint64, since the 8-byte
buffer corresponds to the maximum possible size of a uint64. The
solution is to clamp the buffer to 2 and 4 bytes respectively.

A series of tests are also added to exercise these cases.
2019-08-07 19:42:15 -07:00
Conner Fromknecht
32bb9917f9
tlv/truncated_test: add tests for SizeTuintXX methods 2019-08-07 19:38:57 -07:00
Olaoluwa Osuntokun
ea77ff91c2
Merge pull request #3061 from cfromknecht/wire-tlv
tlv: add library for new message/payload serialization format
2019-08-07 15:51:26 -07:00
Conner Fromknecht
3690999511
tlv/tlv_test: add BOLT1 test vectors 2019-08-07 15:04:45 -07:00
Conner Fromknecht
7c94bbb4a2
tlv/truncated: add truncated integer encodings
This commit adds the truncated integer encodings used in the
variable-size onion payloads. The amount and cltv delta both use the
truncated encoding to shave bytes in the overall size, and will likely
be used in the future for additional extensions where size is a
constraint.
2019-08-07 15:04:33 -07:00
Conner Fromknecht
abdcd47dcc
tlv/bench_test: add basic benchmark 2019-08-07 15:04:20 -07:00
Conner Fromknecht
a0ebaeaa6c
tlv: zero alloc encoding for extended types
This commit adds concrete encoding methods for primitive integral types.
When external libs need to create custom encoders, this allows them to
do so without incurring an extra allocation on the heap. Previously, the
need to pass a pointer to the integer using an interface{} would cause
the argument to escape, which we avoid by having them copied directly.
2019-08-07 15:04:08 -07:00
Conner Fromknecht
bc1f23d98a
tlv/stream: adds tlv stream encoding/decoding 2019-08-07 15:03:56 -07:00
Conner Fromknecht
96e0bb1411
tlv/record: adds various tlv record constructors 2019-08-07 15:03:43 -07:00
Conner Fromknecht
6773d4770a
tlv/primitive: add primitive encodings 2019-08-07 15:03:30 -07:00
Conner Fromknecht
75fcf1cee1
tlv/varint_test: add tests vectors for custom Read/WriteVarInt 2019-08-07 15:03:18 -07:00
Conner Fromknecht
3afcb1f224
tlv/varint: add modified bitcoin varint
This varint has the same serialization as the varint in btcd and
bitcoind, but has different behavior wrt returned errors. In order to
ensure the inner loop properly detects cleanly written records,
ReadVarInt will not only return EOF if it can't read the first byte, as
that means the reader has zero bytes left.

It also modifies the API to allow the caller to provided a static byte
array, which can be reused across all encoding and decoding and
increases performance.
2019-08-07 15:03:05 -07:00
Conner Fromknecht
4f730076c9
Merge pull request #3380 from Roasbeef/rpc-error-interceptors
rpc: add unary+streaming interceptors to log all errors
2019-08-07 12:16:46 -07:00
Johan T. Halseth
21baa7bf18
multi: fix linter errors 2019-08-07 10:53:10 +02:00
Johan T. Halseth
3207c8a736
make: change linter gometalinter->golangci-lint 2019-08-07 10:53:09 +02:00
Olaoluwa Osuntokun
ed954785b2
rpc: add unary+streaming interceptors to log all errors
Not all errors that occur when serving client requests in the gRPC
server are logged. As a result, at times, we can be lacking critic
information that can be used to debug issues that pop up. With this PR,
we create a basic streaming+unary interceptor that will log all errors
that occur when servicing calls.

The current format looks something like this in the logs when an error
occurs:

```
[ERR] RPCS: [/lnrpc.Lightning/SendCoins]: decoded address is of unknown format
```
2019-08-06 19:41:41 -07:00
Olaoluwa Osuntokun
e44445e952
Merge pull request #3354 from carlaKC/peernotify-addpeernotifierservice
Peernotifier: Add Peer Notifier package
2019-08-06 19:34:25 -07:00
Wilmer Paulino
8ca2c79bfe
rpc: expose graph synced status within GetInfo 2019-08-06 17:56:56 -07:00
Wilmer Paulino
977c139f3c
discovery: handle graph synced status after stalled initial historical sync
This ensures that the graph synced status is marked true at some point
once a historical sync has completed. Before this commit, a stalled
historical sync could cause us to never mark the graph as synced.
2019-08-06 17:56:55 -07:00
Wilmer Paulino
af4234f680
discovery: allow the SyncManager to report whether the graph is synced 2019-08-06 17:56:54 -07:00
Olaoluwa Osuntokun
764099c091
REST: increase max msg size for REST proxy
Some time ago, we modified `lncli` to accept larger responses from the
server, up to 50MB. However, we failed to update the REST proxy, which
is in a sense, a client to the regular RPC server. As a result, users
can't currently hit the `/v1/graph` endpoint, as it'll fail with an
error.

In this PR, we update the proxy's dial options to allow it to receive
larger responses from the actual gRPC server. This is only a temporary
measure however, as we'll eventually want to expose some sort of
pagination for the end client.
2019-08-06 17:45:44 -07:00
Olaoluwa Osuntokun
9f0cfe2bee
Merge pull request #3377 from Roasbeef/update-sec-key
README: update link to security PGP key
2019-08-06 17:02:11 -07:00
Olaoluwa Osuntokun
6b0ce3090f
README: update link to security PGP key
In this commit, we update the link to the security PGP key to a gist. We
do this as recent DoS attacks against popular keservers have rendered
many of them unresponsive or only partially operating. As a temporary
measure, we link to a gist until an alternative solution is found.
2019-08-06 01:09:06 -07:00
Conner Fromknecht
c3aa46e08b
Merge pull request #3374 from halseth/ntfr-logger
[trivial] log: correct NTFR -> ntfrLog mapping
2019-08-05 12:41:24 -07:00
Johan T. Halseth
74f0c5f00f
log: correct NTFR -> ntfrLog mapping
Most likely because of a typo, NTFR was mapping to ntfnLog instead of
ntfrLog.

Originally added in 59e2be5306a77fff24bf2e8be1ba335247ef5beb
2019-08-05 15:21:59 +02:00
Juan Pablo Civile
88400f5b09 lnd: close the wallet unlock grpc server
The server was kept alive long after it stopped being used. This caused
problems for services using long-lived GRPC connections which might be
created before wallet unlocked. They got stuck connected to the wallet
unlock service needing a restart.
2019-08-03 17:22:56 -03:00
Olaoluwa Osuntokun
7767eecbb8 Merge pull request #3164 from joostjager/persistent-mc
routing: persistent mission control
2019-08-02 15:45:49 -07:00