Commit Graph

3808 Commits

Author SHA1 Message Date
PaddyQuinn
75e45b830b funding: implement reservation zombie sweeper
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.
2018-03-12 21:58:51 -04:00
Olaoluwa Osuntokun
8988a07bce
htlcswitch: eliminate unnecessary indentation in processRemoteAdds
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.
2018-03-12 18:58:46 -07:00
Olaoluwa Osuntokun
069311c47f
htlcswitch: log dangling circuits in unable to create new commitment 2018-03-12 18:58:45 -07:00
Olaoluwa Osuntokun
bdd01cccb2
htlcswitch: remove getBandwidthCmd as it's no longer needed 2018-03-12 18:58:45 -07:00
Olaoluwa Osuntokun
1af8fa9367
htlcswitch: add additional comments and logging 2018-03-12 18:58:44 -07:00
Olaoluwa Osuntokun
c285bb5814 htlcswitch+peer: remove DecodeHopIterator from ChannelLinkConfig
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.
2018-03-12 18:58:08 -07:00
Olaoluwa Osuntokun
f2b676e93c
Merge pull request #790 from halseth/wire-error-handoff
Wire error handoff
2018-03-12 18:56:35 -07:00
Olaoluwa Osuntokun
2a510e8409
Merge pull request #820 from cfromknecht/extend-lnwallet-timeout
lnwallet/interface_test: extend publish timeout
2018-03-12 17:00:30 -07:00
Conner Fromknecht
914c59eb30
htlcswitch/switch: ensures safe shutdown of switch 2018-03-12 16:40:16 -07:00
PaddyQuinn
5410725306 lnwallet: update comments 2018-03-12 19:37:18 -04:00
Olaoluwa Osuntokun
60c8257c3c
peer: modify the msgStream to not buffer messages off the wire indefinitely
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.
2018-03-12 16:34:59 -07:00
Olaoluwa Osuntokun
a90939a717
Merge pull request #822 from cfromknecht/reorder-switch-itests
lnd_test: move retribution tests after switch persistence
2018-03-12 16:27:44 -07:00
Conner Fromknecht
36f0eb2799
lnd_test: move retribution tests after switch persistence 2018-03-12 14:46:29 -07:00
Conner Fromknecht
600ab9d149
lnwallet/interface_test: extend publish timeout
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.
2018-03-12 13:52:16 -07:00
Olaoluwa Osuntokun
6cb412bb8a
Merge pull request #814 from cfromknecht/rebcast-funding-txn
Rebroadcast Funding Txn
2018-03-12 12:06:02 -07:00
Naveen
c86e1b1a37 docs: update INSTALL.md to have Go 1.9 as min required version
Fixes #815.
2018-03-12 11:58:23 -07:00
rodasmith
6d4c9ca060 docker: remove deprecated --witness_only arg in docs
`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"
}
```
2018-03-12 11:56:49 -07:00
rodasmith
0ae2affe49 docker: update go version in dockerfile to 1.10
* 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.
2018-03-12 11:56:02 -07:00
Wilmer Paulino
e4b286fd06
docker/lnd: install dependencies through dep 2018-03-12 13:38:39 -04:00
Wilmer Paulino
da5381815e
docs: update INSTALL.md to use dep for dependencies 2018-03-12 13:38:38 -04:00
Wilmer Paulino
a4a24ca6af
build: remove glide files 2018-03-12 13:38:37 -04:00
Wilmer Paulino
a2ad7a51ba
travis: retrieve btcd version from dep's manifest file 2018-03-12 13:38:36 -04:00
Wilmer Paulino
8564da5723
test: update testing script to install dependencies through dep 2018-03-12 13:38:36 -04:00
Wilmer Paulino
1dedc73a39
build: use dep for dependency management 2018-03-12 13:38:35 -04:00
Conner Fromknecht
5df8b52dae
multi: set initiator funding txn 2018-03-11 15:06:22 -07:00
Conner Fromknecht
3512cfe836
fundingmanager_test: assert initator funding txn rebcast 2018-03-11 15:06:22 -07:00
Conner Fromknecht
e754db44d2
lnd: configure fmgr with PublishTransaction 2018-03-11 13:58:41 -07:00
Conner Fromknecht
2e1dcd316c
lnwallet/wallet: store funding txn during reservation 2018-03-11 13:58:41 -07:00
Conner Fromknecht
db88c82169
channeldb/channel: add serialization for single funder funding txn 2018-03-11 13:58:40 -07:00
Conner Fromknecht
b635b83abd
fundingmanager: rebroadcast iniatior's funding txn on restart
This commit alters the behavior of the fundingmanager to
rebroadcast the funding transaction of all pending-open
channels upon restart. This is applied only to single-funder
channels for which we are the initiator, and helps ensure that
funding txns do not get stuck in the face of failures or restarts.
2018-03-11 13:58:40 -07:00
Johan T. Halseth
300fb1af4a
lnwire: define ConnectionWideID 2018-03-11 17:21:23 +01:00
Johan T. Halseth
80ef16e853
peer: hand lnwire.Error to fndgMngr or link depending on chanID 2018-03-11 17:21:23 +01:00
Johan T. Halseth
33762e0f81
htlcswitch/link: fail channel on lnwire.Error 2018-03-11 17:21:23 +01:00
Johan T. Halseth
f1f1a38663
funding: add method IsPendingChannel 2018-03-11 17:20:28 +01:00
Johan T. Halseth
7252dbd934
funding: add missing mutex around activeReservations 2018-03-11 17:20:28 +01:00
Olaoluwa Osuntokun
7ea9e7cf4c
htlcswitch: fix linter warning 2018-03-10 19:09:18 -08:00
Olaoluwa Osuntokun
800eea931f
build+multi: switch from bolt to bbolt
In this commit, we switch from boltbd/bolt to coreos/bbolt as the
former is no longer being actively maintained.
2018-03-10 19:01:13 -08:00
Olaoluwa Osuntokun
602048ae5c
pilot: if unable to establish channel, disconnect peer
In this commit, we fix a quick in the main autopilot handling. If we’re
unable to establish a channel to a peer for w/e reason, then we’ll
disconnect the peer. With this tactic, we avoid unnecessarily building
up tens of peers for no reason at all.
2018-03-10 16:53:03 -08:00
Olaoluwa Osuntokun
00ab66469d
autopilot: refresh available funds on channel open/close events 2018-03-10 16:53:02 -08:00
Olaoluwa Osuntokun
ce2d5a2156
autopilot: limit the number of outstanding channel open goroutines
In this commit, we fix an existing bug that would at times cause us to
spiral out of control and potentially created thousands of outbound
connections. Our fix is simple: limit the total number of outstanding
channel establishment attempts. Without this limit, we have no way to
bound the number of active goroutines.

Fixes #772.
2018-03-10 16:53:02 -08:00
Olaoluwa Osuntokun
2cb7d5b570
build: update pinned versions of lightning-onion and btcwallet
In this commit, we update the pinned versions of lightning-onion as
well as btcwallet.

The newest lightning-onion instance adds some logging statements when
garbage collecting expired shared secret hashes.

The new btcwallet version fixes a recently introduced bug which would
cause us to remove all unman transactions on restart if the full node
new of any of them. Instead, we’ll now only remove these unmanned
transactions if it’s reported that the transactions were double spends,
or orphans.
2018-03-10 16:43:59 -08:00
Olaoluwa Osuntokun
2a6876bde2
server: ensure the replay database is stored under the graph+network namespace
In this commit we modify the storage location of the sphinx replay
database to be under the precise network, and not only the graph sub
directory. Before this commit, due to the usage of filepath.Dir(), the
db would lie under /graph/, rather than say, /graph/simnet.
2018-03-10 13:02:29 -08:00
Olaoluwa Osuntokun
bfa76bad49
Merge pull request #761 from cfromknecht/switch-persistence
Switch Persistence [ALL]: Forwarding Packages + Sphinx Replay Protection + Circuit Persistence
2018-03-09 22:40:02 -08:00
Conner Fromknecht
6b74e28858
lnd_test: adds advanced switch persistence test, checking:
//   1. Carol --> Dave --> Alice --> Bob  forward payment
//   2. Carol --- Dave  X  Alice --- Bob  disconnect intermediaries
//   3. Carol --- Dave  X  Alice <-- Bob  settle last hop
//   4. Carol --- Dave  X         X       shutdown Bob, restart Alice
//   5. Carol <-- Dave <-- Alice  X       expect settle to propagate
2018-03-09 21:18:17 -08:00
Conner Fromknecht
38b04ec357
lnd_test: adds switch offline delivery outgoing offline itest 2018-03-09 21:18:16 -08:00
Conner Fromknecht
4bff32232c
lntest/node: adds SetExtraArgs to change node behavior after restart 2018-03-09 21:18:16 -08:00
Conner Fromknecht
90dec0ad6a
lntest/node: expose pprof port by default for itests 2018-03-09 21:18:16 -08:00
Conner Fromknecht
cf0ab41ce8
lnd_test: adds sphinx replay and switch persistence tests 2018-03-09 21:18:16 -08:00
Conner Fromknecht
58324e0d38
lnd_test: add wait predicate to retribution balance check 2018-03-09 21:18:16 -08:00
Conner Fromknecht
1421a91767
test_utils: init with packager 2018-03-09 21:18:15 -08:00