This commit allows for secret keyrings to be initialized
with a specific coin type, which allows us to use
different derivation paths for bitcion and litecoin.
It also provide default constants for Bitcion and
Litecoin BIP 44 coin types.
This commit adds a set used to track channels we consider failed. This
is done to ensure we don't end up in a connect/disconnect loop when we
attempt to re-sync the channel state of a failed channel with a peer.
In this commit, we ensure all paths to directories and files related to
LND are cleand and expanded before attempting to use them.
For example, in POSIX systems:
- ~/lnd.conf would be expanded to /home/user/lnd.conf
- $HOME/lnd.conf would be expanded to /home/user/lnd.conf
Since we're now able to create a base LND directory that no longer lives
under the OS specific application data directory, we modify
cleanAndExpandPath to replace the `~` in a path to the current user's
home directory, rather than the user's application data directory.
In this commit, we introduce a new flag `--lnddir` that allows us to
set a different base directory, other than the OS specific application
data directory, for all related lnd files and directories.
Note: This commit also creates a function called
assertFundingMsgSent, which replaces checkNodeSendingFundingLocked
by doing the same work not just for FundingLocked messages but
also for AcceptChannel, FundingCreated, and FundingLocked messages.
Before previous commits were squashed into this commit, zombie
reservations were cleaned up individually when they timed out.
However, this made the code more complex because each reservation
had its own individual timer and thus it would have required the
timer being cancelled any time the reservation was cancelled,
which would have been harder to maintain. With this commit,
zombie reservations are cleaned up by a zombie sweeper that is
set off by a ticker instead, to make the code more maintainable.
In this commit, we remove a ton of unnecessary indentation in the
processRemoteAdds method. Before this commit, we had a switch statement
on the type of the entry. This was required before when the method was
generic, but now since we already know that it’s an Add, we no longer
require such a statement.
In this commit, we remove the DecodeHopIterator method from the
ChannelLinkConfig struct. We do this as we no longer use this method,
since we only ever use the DecodeHopIterators method now.
In this commit, we modify the msgStream struct to ensure that it has a
cap at which it’ll continue to buffer messages. Currently we have two
msgStream structs per peer: the first for the discovery messages, and
the second for any messages that modify channel state. Due to
inefficiencies in the current protocol for reconciling graph state upon
connection (just dump the entire damn thing), when a node first starts
up, this can lead to very high memory usage as all peers will
concurrently send their initial message dump which can be in the
thousands of messages on testate.
Our fix is simple: make the message stream into a _bounded_ message
stream. The newMsgStream function now has a new argument: bufSize.
Internally, we’ll take this bufSize and create more or less an internal
semaphore for the producer. Each time the producer gets a new message,
it’ll try and read an item from the channel. If the queue still has
size, then this will succeed immediately. If not, then we’ll block
until the consumer actually finishes processing a message and then
signals by sending a new item into the channel.
We choose an initial value of 1000. This was chosen as there’s already
a max limit of outstanding adds on the commitment, and a value of 1000
should allow any incoming messages to be safely flushed and processed
by the gossiper.
This commit extends the amount of time we wait
for transaction to enter the mempool from
10 to 30 seconds. The wallet's interface tests
seem to be particularly slow when run with the
race flag, a problem which is only exacerbated
by the slowness of travis.
With 10s and the race flag, I was able to repro
the issues locally fairly consistently.
`lncli` command `walletbalance` apparently no longer supports the `--witness_only` argument. With the deprecated argument:
```
root@8a9ad8528430:/go/src/github.com/lightningnetwork/lnd# lncli walletbalance --witness_only=true
Incorrect Usage: flag provided but not defined: -witness_only
NAME:
lncli walletbalance - Compute and display the wallet's current balance
USAGE:
lncli walletbalance [arguments...]
[lncli] flag provided but not defined: -witness_only
```
After removing that argument:
```
root@8a9ad8528430:/go/src/github.com/lightningnetwork/lnd# lncli walletbalance
{
"total_balance": "1505000000000",
"confirmed_balance": "1505000000000",
"unconfirmed_balance": "0"
}
```
* Update go version for Docker `lnd` build
Per #815, https://github.com/lightningnetwork/lnd/blob/master/htlcswitch/circuit.go#L21 depends on go version >= 1.9
Before this change:
```
Building lnd
Step 1/11 : FROM golang:1.8
...
Step 9/11 : RUN go install . ./cmd/...
---> Running in 7f5d6ac430e5
# github.com/lightningnetwork/lnd/htlcswitch
htlcswitch/circuit.go:21: syntax error: unexpected = in type declaration
ERROR: Service 'lnd' failed to build: The command '/bin/sh -c go install . ./cmd/...' returned a non-zero code: 2
```
After:
```
Building lnd
Step 1/11 : FROM golang:1.9
1.9: Pulling from library/golang
3e731ddb7fc9: Pull complete
47cafa6a79d0: Pull complete
79fcf5a213c7: Pull complete
68e99216b7ad: Pull complete
9fc7abc9c77e: Pull complete
7fefae002ae5: Pull complete
7eef770e7cf3: Pull complete
fea064ba669b: Pull complete
Digest: sha256:caa4d6b6a468ffc4cc1f2d88cd95019bf057eb33bea1407dd55bd79755a26bb4
Status: Downloaded newer image for golang:1.9
---> 8ebf49f75a15
...
Step 9/11 : RUN go install . ./cmd/...
---> Running in ba871e58d517
Removing intermediate container ba871e58d517
---> fe16f8578770
Step 10/11 : COPY "docker/lnd/start-lnd.sh" .
...
---> 1f1d47432540
Successfully built 1f1d47432540
Successfully tagged lnd:latest
...
```
* Use latest go version 1.10
Pre review feedback, use the latest version of go.