Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun 1ba399267b Merge pull request #773 from Roasbeef/aezeed
aezeed: add new package implementing the aezeed cipher seed scheme
2018-03-01 17:53:56 -08:00
Olaoluwa Osuntokun d65fe83a59 build: add aez and bstream to glide 2018-03-01 17:10:54 -08:00
Olaoluwa Osuntokun 120cebef77 aezeed: add a set of benchmarks
In this commit we add a set of benchmarks to be able to measure the
enciphering and deciphering speed of the current scheme with the
current scrypt parameters.

On my laptop I get about 100ms per attempt:
⛰ go test -run=XXX -bench=.

goos: darwin
goarch: amd64
pkg: github.com/lightningnetwork/lnd/aezeed
BenchmarkToMnenonic-4     	      10	 102287840 ns/op
BenchmarkFromMnenonic-4   	      10	 105874973 ns/op
PASS
ok  	github.com/lightningnetwork/lnd/aezeed	3.036s
2018-03-01 17:10:54 -08:00
Olaoluwa Osuntokun eb3b5196e1 aezeed: add comprehensive, mostly property-based tests 2018-03-01 17:10:53 -08:00
Olaoluwa Osuntokun ffac0336e6 aezeed: add new package implementing the aezeed cipher seed scheme
In this commit, we add a new package implementing the aezeed cipher
seed scheme. This is a new scheme developed that aims to overcome the
two major short comings of BIP39: a lack of a version, and a lack of a
wallet birthday. A lack a version means that wallets may not
necessarily know *how* to re-derive addresses during the recovery
process. A lack of a birthday means that wallets don’t know how far
back to look in the chain to ensure that they derive *all* the proper
user addresses.

The aezeed scheme addresses these two drawbacks and adds a number of
desirable features. First, we start with the following plaintext seed:
{1 byte internal version || 2 byte timestamp || 16 bytes of entropy}.

The version field is for wallets to be able to know *how* to re-derive
the keys of the wallet.

The 2 byte timestamp is expressed in Bitcoin Days Genesis, meaning that
the number of days since the timestamp in Bitcoin’s genesis block. This
allow us to save space, and also avoid using a wasteful level of
granularity. With the currently, this can express time up until 2188.

Finally, the entropy is raw entropy that should be used to derive
wallet’s HD root.

Next, we’ll take the plaintext seed described above and encipher it to
procure a final cipher text. We’ll then take this cipher text (the
CipherSeed) and encode that using a 24-word mnemonic. The enciphering
process takes a user defined passphrase. If no passphrase is provided,
then the string “aezeed” will be used.

To encipher a plaintext seed (19 bytes) to arrive at an enciphered
cipher seed (33 bytes), we apply the following operations:
   * First we take the external version an append it to our buffer. The
external version describes *how* we encipher. For the first version
(version 0), we’ll use scrypt(n=32768, r=8, p=1) and aezeed.
  * Next, we’ll use scrypt (with the version 9 params) to generate a
strong key for encryption. We’ll generate a 32-byte key using 5 bytes
as a salt. The usage of the salt is meant to make the creation of
rainbow tables infeasible.
  * Next, the enciphering process. We use aezeed, modern AEAD with
nonce-misuse resistance properties. The important trait we exploit is
that it’s an *arbitrary input length block cipher*. Additionally, it
has what’s essentially a configurable MAC size. In our scheme we’ll use
a value of 4, which acts as a 32-bit checksum. We’ll encrypt with our
generated seed, and use an AD of (version || salt). We'll them compute a
checksum over all the data, using crc-32, appending the result to the
end.
  * Finally, we’ll encode this 33-byte cipher text using the default
world list of BIP 39 to produce 24 english words.

The `aezeed` cipher seed scheme has a few cool properties, notably:
   * The mnemonic itself is a cipher text, meaning leaving it in
plaintext is advisable if the user also set a passphrase. This is in
contrast to BIP 39 where the mnemonic alone (without a passphrase) may
be sufficient to steal funds.
   * A cipherseed can be modified to *change* the passphrase. This
means that if the users wants a stronger passphrase, they can decipher
(with the old passphrase), then encipher (with a new passphrase).
Compared to BIP 39, where if the users used a passphrase, since the
mapping is one way, they can’t change the passphrase of their existing
HD key chain.
  * A cipher seed can be *upgraded*. Since we have an external version,
offline tools can be provided to decipher using the old params, and
encipher using the new params. In the future if we change ciphers,
change scrypt, or just the parameters of scrypt, then users can easily
upgrade their seed with an offline tool.
  * We're able to verify that a user has input the incorrect passphrase,
and that the user has input the incorrect mnemonic independently.
2018-03-01 17:10:50 -08:00
Olaoluwa Osuntokun a9dc4f80f2 chainntnfs/neutrinonotify: log height hint for spend notifications 2018-03-01 16:49:28 -08:00
Olaoluwa Osuntokun 9479b085e2 Merge pull request #785 from brndnmtthws/master
Add more details on using macaroons with GRPC.
2018-02-28 19:27:13 -08:00
Olaoluwa Osuntokun f7ec490f44 Merge pull request #762 from halseth/fee-estimator
Add types for representing fee rates
2018-02-26 17:22:50 -08:00
Olaoluwa Osuntokun 7f04d927a0 rpc: fix queryroutes bug that assumed precise number of returned routes
In this commit, we fix a bug in the query routes RPC that could at
times lead to a panic. This would happen if the number of returned
routes was less than the number of expected routes. To remedy this,
we’ll return the minimum of the number of requested routes, and the
number of routes actually returned.
2018-02-26 16:31:50 -08:00
Olaoluwa Osuntokun 158c78da60 lnd: remove invalid cipher suite 2018-02-26 13:29:19 -08:00
Olaoluwa Osuntokun c846c4d2e0 lnd: correct typo in cipher suite sets, use sha2 2018-02-26 13:04:52 -08:00
Olaoluwa Osuntokun 94746c2d12 Merge pull request #780 from Roasbeef/brontide-reduce-allocs
brontide: reduce memory allocs by using static buf for next header+msg
2018-02-26 13:04:27 -08:00
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
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
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
Olaoluwa Osuntokun 2a61ccec96 chainntnfs: fix new golang 1.10 vet/test warning 2018-02-19 18:06:35 -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
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
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
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
Olaoluwa Osuntokun 7f61d8cf3d lnwallet: update tests to use latest neutrino API 2018-02-09 12:16:17 -08:00
Olaoluwa Osuntokun 3fcce9959b lnd: pass through the custom dialer+DNS to neutrino
In this commit, we modify our initialization of neutrino to also pass
in the custom dialer and name resolver function. With this change, if
lnd is configured to use Tor, then neutrino will as well. This means
that *both* the Bitcoin P2P as well as the Lightning P2P traffic will
be proxied over Tor.
2018-02-09 12:16:17 -08:00
Olaoluwa Osuntokun 076b676195 build: update to neutrino version w/ custom dialer+DNS support 2018-02-09 12:16:16 -08:00
Olaoluwa Osuntokun 4cba9dc8d3 docs: add new documentation for configuring lnd+tor 2018-02-09 12:16:16 -08:00
Olaoluwa Osuntokun 2aac20ec12 docs: update sample-lnd.conf with Tor info 2018-02-09 12:16:16 -08:00
Olaoluwa Osuntokun abcf822bf9 config: add new option to the tor config for stream isolation 2018-02-09 12:16:13 -08:00
Olaoluwa Osuntokun 2eb9059cf7 torsvc: add support for stream isolation
In this commit, we extend the TorDial function and add a new attribute
to the TorProxyNet struct to allow the caller to opt for stream
isolation or not. Using stream isolation, we ensure that each new
connection uses a distinct circuit.
2018-02-08 20:09:04 -08:00
Olaoluwa Osuntokun 9f52372cd2 autopilot: modify interfaces to specify *exactly* how many chans to open
In this commit, we fix a regression introduced by a recent change which
would allow the agent to detect a channel as failed, and blacklist the
node, promising faster convergence with the ideal state of the
heuristic.

The source of this bug is that we would use the set of blacklisted
nodes in order to compute how many additional channels we should open.
If 10 failures happened, then we would think that we had opened up 10
channels, and stop much earlier than we actually should.

To fix this, while ensuring we don’t retry to failed peers, the
NeedMoreChans method will now return *how* anymore channels to open,
and the Select method will take in how many channels it should try to
open *exactly*.
2018-02-08 20:08:18 -08:00
Olaoluwa Osuntokun d1c12202ca chancloser: initiator always sends the first CloseSigned msg
In this commit, we update the chan closer state machine to be fully
spec compliant. A recent change was made to the spec to enforce a
strict ordering such that, the negotiation is well formed. To enact
this change, we’ll ensure that before the closeFeeNegotiation phase,
the *initiator* is always the one that sends the CloseSigned message
first.
2018-02-08 19:43:09 -08:00
Olaoluwa Osuntokun 2e090ee2ab peer: only return a channel snapshot if the channel can route
In this commit, we fix a slight miscalculation within the GetInfo call.
Before this commit, we would list any channel that the peer knew of as
active, instead of those which are, well, actually *active*. We fix
this by skipping any channels that we don’t have the remote revocation
for.
2018-02-08 19:40:54 -08:00
Olaoluwa Osuntokun 1b504b6041 Merge pull request #715 from cfromknecht/reconnect-backoff
server: adds truncated exponential backoff + rand for retry
2018-02-08 19:37:31 -08:00
Olaoluwa Osuntokun d61212cf26 Merge pull request #443 from halseth/chanConstraints
Validate channel constraints
2018-02-08 16:53:04 -08:00
Olaoluwa Osuntokun b5bb1e027d Merge pull request #741 from cfromknecht/utxn-witness-indexes
utxonursery: fix witness overwriting bug on sweep txn
2018-02-08 15:25:22 -08:00
Olaoluwa Osuntokun 8cb2097db2 Merge pull request #743 from cfromknecht/brar-infinite-loop-fix
breacharbiter: avoid infinite loop in exactRetribution
2018-02-08 15:22:48 -08:00
Olaoluwa Osuntokun 80df5cd06c Merge pull request #742 from cfromknecht/switch-control-quit
htlcswitch/switch: select on quit channels for switch commands
2018-02-08 15:21:57 -08:00
Olaoluwa Osuntokun 7bbcbc6fea Merge pull request #706 from Roasbeef/gc-fixes-reject-cache
multi: memoize pubkey+signature decoding to reduce GC bursts, add reject cache to stop zombie churn
2018-02-06 20:37:41 -08:00
Olaoluwa Osuntokun bf05e47780 discovery: add additional gossiper level reject cache
In this commit, we’ll add a new reject cache to ensure that we don’t
attempt to re-process any announcements already rejected by the
ChannelRouter.
2018-02-06 20:14:35 -08:00
Olaoluwa Osuntokun e578cea375 channeldb: fix linter errors 2018-02-06 20:14:34 -08:00
Olaoluwa Osuntokun b54b8dd7f1 routing: reject any new announcements which were pruned as zombies 2018-02-06 20:14:34 -08:00
Olaoluwa Osuntokun 6d05cb5aae routing: extract zombie pruning to distinct method 2018-02-06 20:14:34 -08:00
Olaoluwa Osuntokun 1f3124f48a routing: use [33]byte instead of *btcutil.Publickey for SendToSwitch
With this change, we can avoid unnecessarily serializing a public key.
2018-02-06 20:14:33 -08:00
Olaoluwa Osuntokun 22951cb364 lnd: account for new lnwire.Sig API and channeldb API changes 2018-02-06 20:14:33 -08:00
Olaoluwa Osuntokun 9f0214428a zpay32: update parsing to use new lnwire.Sig API 2018-02-06 20:14:33 -08:00
Olaoluwa Osuntokun 6751cd8b9f routing: update package to account for recent channeldb API changes 2018-02-06 20:14:32 -08:00
Olaoluwa Osuntokun cb48a5827a autopilot: update API usage to account for recent channeldb changes 2018-02-06 20:14:32 -08:00
Olaoluwa Osuntokun cd9d2d7e6f discovery: update graph API usage to match recent API changes 2018-02-06 20:14:32 -08:00
Olaoluwa Osuntokun 5e9166e478 channeldb: use raw pub keys and signatures directly in vertex/edge structs
In this commit, we make an API change that’s meant to reduce the amount
of garbage we generate when doing pathfinding or syncing nodes with our
latest graph state. Before this commit, we would always have to fully
decode the public key and signatures when reading a edge or vertex
struct. For the edges, we may need several EC operations to fully
decode all the pubkeys. This has been seen to generate a ton of
garbage, as well as slow down path finding a good bit.

To remedy this, we’ll now only ever read the *raw* bytes from disk. In
the event that we actually need to verify a signature (or w/e), only
*then* will we fully decode everything.
2018-02-06 20:14:31 -08:00
Olaoluwa Osuntokun 850abbbeb5 htlcswitch: update tests to respect recent API changes 2018-02-06 20:14:31 -08:00
Olaoluwa Osuntokun 9c483c38b1 lnwallet: update state machine to use new lnwire.Sig everywhere 2018-02-06 20:14:31 -08:00
Olaoluwa Osuntokun aa2e91f7c4 lnwire: replace instances of *btcec.PublicKey with [33]byte in ann messages
In this commit, we replace all instances of *btcec.PublicKey within the
announcement messages with a simple [33]byte. We do this as usually we
don’t need to immediately validate an announcement, therefore we can
avoid the scalar multiplications during decoding.
2018-02-06 20:14:30 -08:00
Olaoluwa Osuntokun 4dd108c827 lnwire: replace usage of btcec.Signature with the new lnwire.Sig type 2018-02-06 20:14:30 -08:00
Olaoluwa Osuntokun 0d7b8be11b lnwire: add new Sig type to handle conversion to/from btcec.Signature
In this commit, we add a new signature type. We’ll use this type to
avoid fully decoding a signature on the wire into a btcec.Signature.
This type is only really needed when we need to do signature
validation, as a result, always encoding it is a waste. Several helper
methods have been added to the new struct in order to ensure that we
can use it in the existing codebase without substantial issues.
2018-02-06 20:14:26 -08:00
Olaoluwa Osuntokun 1afadf4822 htlcswitch: properly rename struct in tests 2018-02-06 19:28:36 -08:00
Olaoluwa Osuntokun 72a5bc8648 build: update glide to point to new optimized sphinx version
The latest optimizations give a 10x speed up, so we’ll re-pin against
the newest commit.
2018-02-06 17:38:09 -08:00
Olaoluwa Osuntokun 18741831dd Merge pull request #485 from halseth/fix-negative-balance
Use remoteACKed index when calculating availableBalance.
2018-02-05 16:23:17 -08:00
Olaoluwa Osuntokun 0d09f7a32a Merge pull request #627 from cfromknecht/invert-inboud-display
rpcserver: flip inbound bool for display, fix internally later
2018-02-05 16:22:13 -08:00
Olaoluwa Osuntokun cfacc18f72 Merge pull request #711 from Roasbeef/funding-fail-first
funding: during funding error fail before sending Error to peer
2018-02-05 15:09:21 -08:00
Olaoluwa Osuntokun 2099d6fa77 contractcourt: ensure we always cancel block epoch notifications after use
In this commit, we fix an existing grouting leak within the contract
court package. If a goroutine dies, but it doesn’t actually cancel the
block epoch notification that it requested, then it’s possible to leak
thousands of gorutines. To remedy this situation, we ensure that we’ll
*always* cancel the epoch notification once the goroutine has exited.
2018-02-05 14:41:08 -08:00
Olaoluwa Osuntokun 30dbbd69a0 funding+htlcswitch: dynamically update short chan id of existing link
In this commit, we fix an existing bug that would result in some
payments getting “stuck”. This would happen if one side restarted
before the channel was fully locked in. In this case, since upon
re-connection, the link will get added to the switch with a *short
channel ID of zero*. If A then tries to make a multi-hop payment
through B, B will fail to forward the payment, as it’ll mistakenly
think that the payment originated from a local-subsystem as the channel
ID is zero. A short channel ID of zero is used to map local payments
back to their caller.

With fix this by allowing the funding manager to dynamically update the
short channel ID of a link after it discovers the short channel ID.

In this commit, we fix a second instance of reported “stuck” payments
by users.
2018-02-03 18:14:15 -08:00
Olaoluwa Osuntokun 71a837630a funding: on startup only re-create funding barriers if channel is pending
In this commit, we fix an existing bug within the funding manager. A
channel barrier only needs to be create if upon startup the channel is
still pending. Otherwise, we’ll re-create the funding barrier
unnecessarily. This can lead to bugs when initiating payments between a
channels’ lock in and when it’s announced to the together network. If
during this period, a user attempts a payment, then the response won’t
be archived, as the grouting will be blocked waiting on the channel
barrier to close.

To fix this, we only re-create the barrier if the channel hasn’t been
confirmed.

This eliminates one source of reported “stuck payments”.
2018-02-03 18:02:21 -08:00
Olaoluwa Osuntokun bb174292b1 lnd: remove redundant server shutdown for REST wallet unlock
In this commit, we remove a server shutdown statement that was executed
after we obtained the wallet’s password from the user over RPC. This
was unnecessary as we already close the listener below. Before this
commit, users would see a weird benign error message. With these code
deletion, the message disappears.
2018-02-03 17:59:03 -08:00
Olaoluwa Osuntokun bba2ff1871 funding: display error if unable to watch for channel 2018-02-02 17:59:38 -08:00
Olaoluwa Osuntokun ddf4715e3c chainntnfs/neutrinonotify: fix regression for historical spend dispatches
In this commit, we fix an issue that was recently introduced to the way
we handle historical dispatches for the neutrino notifier. In a recent
change, we no return an error if we’re unable to actually find the
transaction that spends an outpoint. If this is the case, then the
outpoint is actually unspent, and we should proceed as normal.
2018-02-02 17:59:16 -08:00
Olaoluwa Osuntokun 609525f0e8 Merge pull request #712 from Roasbeef/avoid-dust-change-funding
lnwallet: avoid creating dust change outputs in funding txns
2018-02-01 16:20:52 -08:00
Olaoluwa Osuntokun 7144707734 rpc: store display of alias in getinfo 2018-02-01 11:55:02 -08:00
Olaoluwa Osuntokun 20098e8cb3 lnwallet: update transactions_test.go due to recent API changes 2018-01-31 14:31:14 -08:00
Olaoluwa Osuntokun 43fa9fe467 lnwallet: avoid creating dust change outputs in funding txns
Before this commit, if the remaining change was small enough, then it
was possible for us to generate a non-std funding transaction. This is
an issue as the txn would fail to propagate, meaning funds could
potentially be stuck in limbo if users didn't manually drop their
transaction history.

To avoid this scenario, we won't create a change output that is dusty.
Instead, we'll add these as miner fees.

Fixes #690.
2018-01-31 14:10:45 -08:00
Olaoluwa Osuntokun 246c05fcd8 lnwallet: add additional debug logging for txns during funding flows 2018-01-31 14:00:05 -08:00
Olaoluwa Osuntokun c823aeafab funding: during funding error fail before sending Error to peer
In this commit, we modify the logic executed when we decide that we
need to fail a funding flow. Before this commit, if the remote party
disconnected while we were attempting to fail the funding flow with an
error. Then we'd never actually cancel the reservation. This meant that
any inputs selected for that transaction would be locked until a
restart.

We fix this issue by always cancelling the reservation first, and
ensuring that failure to cancel the reservation doesn't prevent us from
sending the error.

Partially addresses #710.
2018-01-31 13:52:21 -08:00
Olaoluwa Osuntokun 94b10c6c06 Merge pull request #593 from AdamISZ/noise_tests
Add tests for key rotation from BOLT8 test vectors
2018-01-31 12:38:58 -08:00
Olaoluwa Osuntokun 1b15c30f7a Merge pull request #592 from wilmerpaulino/rest-close-channel
lnrpc: make ChannelPoint.funding_txid a protobuf oneof and change CloseChannel endpoint
2018-01-31 12:38:03 -08:00
Olaoluwa Osuntokun 1819abf224 lnwallet: increase size of test reservation due to high funding limit 2018-01-28 16:55:11 -08:00
Olaoluwa Osuntokun 3036fc0181 lnwallet: disallow creation of channels < 2x dust limit
Fixes #633.
2018-01-28 15:11:13 -08:00
Olaoluwa Osuntokun 87742ce861 docs: update wording on autopilot.allocation
Fixes #681.
2018-01-28 15:05:41 -08:00
Olaoluwa Osuntokun e953c6abcf config: add stricter config parsing to avoid dangerous RPC auth combos
In this commit, we add an additional constraint to the RPC
configuration parsing. Before this commit, it was possible to start lnd
with either RPC server listening on an external interface *without*
authentication disabled. After this commit, if a user tries to start
the RPC server listening on an external interface without any sort of
RPC authentication, then the daemon will fail to start up.
2018-01-28 15:03:29 -08:00
Olaoluwa Osuntokun 0a4de859a2 discovery+routing: reduce number of active validation barrier jobs
In order to reduce high CPU utilization during the initial network view
sync, we slash down the total number of active in-flight jobs that can
be launched.
2018-01-28 14:55:32 -08:00
Olaoluwa Osuntokun 63fe8aec5b lnwallet: properly use in KB, not KiB to convert to sat/byte for bitcoind estimator
In this commit, we fix an existing bug. The fee estimation within
bitcoind is based on fee/KB (1000), not fee/KiB (1024).

Pointed out by @dabura667.
2018-01-28 14:53:58 -08:00
Olaoluwa Osuntokun 47dc2d3b70 server: grab the read-mutex within the main loop of the peerBootstrapper
A recent commit modified the mutex in the server to the read/write. In
order to further reduce contention, we’ll grab the read lock when we’re
examining get set of peers to ignore.
2018-01-28 14:50:25 -08:00
Olaoluwa Osuntokun a94648e9dc channeldb: properly use a read-transaction in FetchChannelEdgesByOutpoint
Before this commit, we’d unnecessarily use a write transaction within
the FetchChannelEdgesByOutpoint. This is wasteful as the function only
actually reads items from the database, and doesn’t attempt any
mutations at all.
2018-01-28 14:48:57 -08:00
Olaoluwa Osuntokun bde3828208 funding: fix format directive in logging statement 2018-01-28 14:48:56 -08:00
Olaoluwa Osuntokun bf6001074c chainntnfs: fix spend notification registration race condition
In this commit, we fix a race condition related to the way we attempt
to query to see if an outpoint has already been spent by the time it’s
registered within the ChainNotifier. If the transaction creating the
outpoint hasn’t made it into the mempool by the time we execute the
GetTxOut call, then we’ll attempt to query for the transaction itself.
In this case, if we query for the transaction, then the block hash
field will be empty as it hasn’t yet made it into a block. Under the
previous logic, we’d then attempt to force a rescan. This is an issue
as the forced rescan will fail since it’ll try to fetch the block hash
of all zeroes.

In this commit, we fix this issue by only entering this “fallback to
rescan” logic iff, the transaction has actually been mined.
2018-01-28 14:48:56 -08:00
Olaoluwa Osuntokun f9eda8580d Merge pull request #571 from hectorj/patch-1
docker-compose.yml: fix typo
2018-01-27 18:43:38 -08:00