Commit Graph

3730 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
0c16ab6b32
brontide: reduce memory allocs by using static buf for next header+msg
In this commit, we reduce the total number of allocations that a
brontide session will incur over its lifetime. Profiling on one of my
nodes showed that we were generating a lot of garbage due to
re-creating a 65KB buffer to read the next message each time the
ReadMessage method was called.

To reduce the total number of memory allocations, we’ll now simply
re-use a buffer for both the cipher text header, and the cipher text
itself.
2018-02-24 19:30:45 -08:00
Olaoluwa Osuntokun
e5f9b28e39
Merge pull request #776 from Roasbeef/rpc-ec-cert
lnd: switch to using ECC certs for the rpcserver
2018-02-24 13:14:54 -08:00
Olaoluwa Osuntokun
f7eeea71e2
lnd: switch to using ECC certs for the rpcserver
In this commit, we modify our initial cert generation to *only* generate
and advertise cipher suites that purely use ECC. We do this is as
switching to ECC results in much faster startup time for a fresh
installation, and is also more modern crypto.  # Please enter the commit
message for your changes. Lines starting
2018-02-23 18:24:23 -08:00
Olaoluwa Osuntokun
83b779dcdf
build: update glide to latest btcwallet
In this commit, we update glide to the latest version of btcwallet that
includes fixes for better fee estimation, and also fixes to ensure that
transaction broadcast is reliable across all current backend
implementations.
2018-02-23 16:48:51 -08:00
Olaoluwa Osuntokun
f815c6ca14
Merge pull request #774 from halseth/reservation-cancellation
Reservation cancellation during failing funding flow
2018-02-23 15:36:11 -08:00
Dave Kerr
5fd236c870 docs: update reason for using btcd fork
We require roasbeef's fork of btcd as it has the neutrino serving additions, but mainline btcd doesn't yet.
2018-02-23 15:27:23 -08:00
Johan T. Halseth
b0d1be282c
fundingmanager: cancel reservation if unable to send initial msg to peer 2018-02-23 15:41:32 +01:00
Johan T. Halseth
ff1dc2bbd4
funding: ensure we fail funding flow if unable to query wallet 2018-02-23 15:41:32 +01:00
Johan T. Halseth
00ea46d9ae
Merge pull request #767 from sangaman/master
zpay32: handle segwit prefixes > 2 chars
2018-02-21 14:42:47 +01:00
Johan T. Halseth
31ec79e7ae
Merge branch 'master' into master 2018-02-21 13:54:26 +01:00
Olaoluwa Osuntokun
1c3dbb2543
Merge pull request #771 from cfromknecht/report-double-spend-for-brar
lnwallet/btcwallet/btcwallet: adds extra double spend case
2018-02-20 22:06:19 -08:00
Conner Fromknecht
4449038ae5
lnwallet/btcwallet/btcwallet: adds extra double spend case
Adds an extra case to the select statement to catch
an error produced by btcd. The error is meant to signal
that an output was previously spent, which can appear
under certain race conditions in spending/broadcasting.
This caused our final itest to fail because it would
not try to recraft the justice txn.
2018-02-20 20:48:53 -08:00
Olaoluwa Osuntokun
34efb380be
lnwallet: update interface tests due to recent API change 2018-02-20 19:16:14 -08:00
Olaoluwa Osuntokun
d5923f3832
Merge pull request #594 from halseth/publish-transaction-error-codes
Ignore ErrRejectDuplicate errors
2018-02-20 19:05:53 -08:00
Jason Dufair
84551c616f lnwallet/lnrpc: Expose sync status to gRPC interface
This commit adds wallet_best_block_timestamp to the gRPC interface.
This is done in order to allow clients to calculate progress while
lnd syncs to the blockchain. wallet_best_block_timestamp is exposed
via the GetInfo() rpc call. Additionally, IsSynced() returns the
WalletBestBlockTimestamp as the second value in the tuple
that is returned, providing additional detail when querying about the
status of the sync. The BtcWallet interface has also been updated
accordingly.

This commit was created to support the issue to
[Add progress bar for chain sync] (lightninglabs/lightning-app#10) in
lightning-app
2018-02-20 19:00:06 -08:00
Olaoluwa Osuntokun
2a61ccec96
chainntnfs: fix new golang 1.10 vet/test warning 2018-02-19 18:06:35 -08:00
MeshCollider
2c2ed3c6a9 multi: Unify use of NodeKey in log messages 2018-02-19 17:48:39 -08:00
MeshCollider
4c42079436 multi: ensure NodeKey is set in rpc/cli 2018-02-19 17:48:39 -08:00
MeshCollider
915c4201b9 multi: remove internal peer_id usage 2018-02-19 17:48:39 -08:00
MeshCollider
4ed5ba0d26 multi: Remove peer_id from RPC commands 2018-02-19 17:48:39 -08:00
Olaoluwa Osuntokun
236d53785d
docs: update docs to recommend golang 1.10 2018-02-19 17:44:03 -08:00
Olaoluwa Osuntokun
7f0dd8f28f
build: update travis to build against golang 1.10+1.9.4 2018-02-19 17:32:54 -08:00
Olaoluwa Osuntokun
39f9ae7cac
build: update to version of golang fork with golang 1.10 bug fix
In this commit, we update the commit of my btcd fork as the saltiest
commit includes a fix for a breaking change (or bug fix). After this
commit, we’ll able to run the set of integration tests with golfing
1.10.
2018-02-19 17:32:43 -08:00
Daniel McNally
56c01ebcfe rpcserver: passing active net to zpay32.Decode 2018-02-19 10:20:54 -05:00
Daniel McNally
6e5477e378 zpay32 test: litecoin decode tests
New tests are added for creating, decoding, and re-encoding
litecoin invoices for both mainnet and testnet, as well as a test
that expects an error when the active network mismatches the
invoice.
2018-02-19 10:19:24 -05:00
Daniel McNally
fdbdcf1560 zpay32: handle segwit prefixes > 2 chars
This change fixes a bug when an invoice is decoded for a network
whose bech32 segwit prefix is longer than 2 characters. The length
of the Bech32HRPSegwit network parameter is used to determine
where in the human-readable portion of the invoice the amount
begins, rather than assuming it begins after the first four
characters.

Decode() now throws an error when the encoded invoice does
not match the active network.

Changes the minimum hrp length check to >= 3 instead of >= 4.

Also removes a redundant "if ...; err != nil check" that was raising
a warning in invoice.go.
2018-02-19 10:18:16 -05:00
Olaoluwa Osuntokun
8329a31fb0
Merge pull request #585 from wilmerpaulino/openchannel-connect
lncli: add 'connect' flag to openchannel command
2018-02-18 15:29:38 -08:00
Olaoluwa Osuntokun
9709e5f31f
Merge pull request #737 from Roasbeef/tor-docs
tor: add stream isolation, additional documentation, neutrino support
2018-02-18 15:28:53 -08:00
practicalswift
b8e1351cf3 multi: fix some recently introduced typos 2018-02-18 15:27:29 -08:00
Johan T. Halseth
cabc07ea7d
breacharbiter: check ErrDoubleSpend from PublishTransaction 2018-02-14 12:34:42 +01:00
Johan T. Halseth
2ae1b7dbbe
contractcourt: remove TODO for checking double spends from PublishTx 2018-02-14 12:34:41 +01:00
Johan T. Halseth
3fd7f28b39
lnwallet: don't ignore any returned error from PublishTransaction 2018-02-14 12:34:41 +01:00
Johan T. Halseth
7aaa15b8b5
utxonursery: don't ignore any returned error from PublishTransaction 2018-02-14 12:34:41 +01:00
Johan T. Halseth
db0928fa6f
chancloser: don't check error returned from broadcastTx
This commit removes the inspection of the return error
from broadcastTx. This is done since the new error
checking added to PublishTransaction will return a nil
error in case the transaction already exists in the
mempool.
2018-02-14 12:34:41 +01:00
Johan T. Halseth
d96b5b62eb
lnwallet test: add test for PublishTransaction return errors 2018-02-14 12:34:41 +01:00
Johan T. Halseth
1dcc89cca9
lnwallet/btcwallet: return concrete error type from PublishTransaction 2018-02-14 12:34:40 +01:00
Johan T. Halseth
a1a9834a53
lnwallet: add PublishTransaction error types 2018-02-14 12:34:40 +01:00
Olaoluwa Osuntokun
7abdd30a87
routing: correct recent type change in heap_test.go 2018-02-12 16:44:42 -08:00
Olaoluwa Osuntokun
452d12809e
cmd/lncli: add --num_max_routes to queryroutes, default to 10 2018-02-12 16:29:43 -08:00
Olaoluwa Osuntokun
1879130f64
rpc: modify QueryRoutes response to return exact number of requested routes 2018-02-12 16:29:12 -08:00
Olaoluwa Osuntokun
eddca9bf92
lnrpc: add new num_routes param to QueryRoutes 2018-02-12 16:28:45 -08:00
Olaoluwa Osuntokun
528aa67df7
routing: weight findPath more heavily towards fees during edge relaxation
In this commit, we modify the edgeWeight function that’s used within
the findPath method to weight fees more heavily than the time lock
value at an edge. We do this in order to greedily prefer lower fees
during path finding. This is a simple stop gap in place of more complex
weighting parameters that will be investigated later.

We also modify the edge distance to use an int64 rather than a float.
Finally an additional test has been added in order to excessive this
new change. Before the commit, the test was failing as we preferred the
route with lower total time lock.
2018-02-12 16:27:38 -08:00
Olaoluwa Osuntokun
ad0f5b31f6
routing: return cached route response in FindRoutes if enough routes
In this commit, we modify the caching structure to return a set of
cached routes for a request if the number of routes requested is less
than or equal to the number of cached of routes.
2018-02-12 16:22:28 -08:00
Olaoluwa Osuntokun
8a29c01354
routing: modify FindRoutes to take a max number of routes to return 2018-02-12 16:19:52 -08:00
Olaoluwa Osuntokun
33ba60ce66
routing: modify findPaths to take an upper limit on the number of routes
In this commit, we modify the findPaths method to take the max number
of routes to return. With this change, FindRoutes can eventually itself
also take a max number of routes in order to make the function useable
again.
2018-02-12 16:18:49 -08:00
Olaoluwa Osuntokun
3e422fedd3
channeldb: further GC optimizations during path finding
In this commit, we made a series of modification to the way we handle
reading edges and vertexes from disk, in order to reduce the amount of
garbage generated:
  1. Properly use PubKeyBytes are required rather than PubKey()
  2. Return direct structs rather than pointers, and leave it to the
runtime to perform escape analysis.
  3. In-line the former readSig() method when reading sigs from disk.
2018-02-12 16:17:14 -08:00
Olaoluwa Osuntokun
03abc73e8d
Merge pull request #750 from Roasbeef/block-epoch-queue
chainntnfs: ensure all block epoch notifications are sent *in order*
2018-02-12 15:15:55 -08:00
Olaoluwa Osuntokun
65d6d77ef4
rpc: fix macaroon path entity for OpenChannelSync
In this commit, we fix a typo that caused issues when trying to use the
OpneChannelSync call.

Fixes #748.
2018-02-11 17:15:46 -08:00
Johan T. Halseth
d092b57d9c
Merge pull request #736 from nalinbhardwaj/zpay32-test
zpay32: Add tests for non-ASCII(UTF-8) descriptions
2018-02-09 22:09:28 -05:00
Olaoluwa Osuntokun
9c18c3d9a4
chainntnfs: ensure all block epoch notifications are sent *in order*
In this commit, we fix a lingering bug related to the way that we
deliver block epoch notifications to end users. Before this commit, we
would launch a new goroutine for *each block*. This was done in order
to ensure that the notification dispatch wouldn’t block the main
goroutine that was dispatching the notifications. This method archived
the goal, but had a nasty side effect that the goroutines could be
re-ordered during scheduling, meaning that in the case of fast
successive blocks, then notifications would be delivered out of order.
Receiving out of order notifications is either disallowed, or can cause
sub-systems that rely on these notifications to get into weird states.

In order to fix this issue, we’ll no longer launch a new goroutine to
deliver each notification to an awaiting client. Instead, each client
will now gain a concurrent in-order queue for notification delivery.
Due to the internal design of chainntnfs.ConcurrentQueue, the caller
should never block, yet the receivers will receive notifications in
order. This change solves the re-ordering issue and also minimizes the
number of goroutines that we’ll create in order to deliver block epoch
notifications.
2018-02-09 16:13:28 -08:00