Commit Graph

3487 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
PaddyQuinn 5410725306 lnwallet: update comments 2018-03-12 19:37:18 -04: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
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
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
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
Conner Fromknecht 4f5edc1b2e
test_utils: init switch with channeldb 2018-03-09 21:18:15 -08:00
Conner Fromknecht 935c757102
rpcserver: allow unsafe-disconects 2018-03-09 21:18:15 -08:00
Conner Fromknecht c976a550cb
server: initialize switch with circuit db 2018-03-09 21:18:15 -08:00
Conner Fromknecht 972d238f04
peer: remove Switch from channel link config 2018-03-09 21:18:15 -08:00
Conner Fromknecht d468a36d69
peer: pass unsafe-replay to link config 2018-03-09 21:18:15 -08:00
Conner Fromknecht 8d0e3dc467
peer: adds FwdPkgGCTicker to channel configs 2018-03-09 21:18:14 -08:00
Conner Fromknecht 0e4be6a04a
peer: init link with batched sphinx processing 2018-03-09 21:18:14 -08:00
Conner Fromknecht b8254803be
config: add unsafe-disconnect and unsafe-replay for testing 2018-03-09 21:18:14 -08:00
Conner Fromknecht 5de0c62ae6
breacharbiter_test: init packager 2018-03-09 21:18:14 -08:00
Conner Fromknecht 02489dc6c0
htlcswitch/test_utils: instantiate config with batch onoin processing 2018-03-09 21:08:44 -08:00
Conner Fromknecht 4f68d1beca
htlcswitch/switch_test: change forward() -> send() 2018-03-09 21:08:44 -08:00
Conner Fromknecht 1b7afc6da5
htlcswitch/mock: add mock fwding log to initSwitchWithDB 2018-03-09 21:08:44 -08:00
Conner Fromknecht 5fd1206da6
htlcswitch/switch: modifies forward method to support async invocation 2018-03-09 21:08:44 -08:00
Conner Fromknecht fbb8f0bcce
htlcswitch/sequencer: adds a persistent emitter of payment IDs 2018-03-09 21:08:44 -08:00
Conner Fromknecht e4fb420665
htlcswitch/packet: adds serialization to htlcPacket 2018-03-09 21:08:44 -08:00
Conner Fromknecht 3048dfd4be
htlcswitch/mock: adds Encode/Decode to mock obfuscator 2018-03-09 21:08:43 -08:00
Conner Fromknecht 3ae7772ecb
htlcswitch/mailbox_test: adds checks for reset and replay of pkts 2018-03-09 21:08:43 -08:00
Conner Fromknecht 9b00f83656
htlcswitch/mailbox: makes pkts replayable via Reset 2018-03-09 21:08:43 -08:00
Conner Fromknecht 3a186a02a9
htlcswitch/link_test: generate random preimages 2018-03-09 21:08:43 -08:00
Conner Fromknecht 101ad09e9f
htlcswitch/link: batches processing of locked in htlcs 2018-03-09 21:08:43 -08:00
Conner Fromknecht 2c3d35bb40
htlcswitch/interfaces: have HandleSwitchPacket return an error 2018-03-09 21:08:43 -08:00