Commit Graph

3949 Commits

Author SHA1 Message Date
Johan T. Halseth
690992043b
breacharbiter_test: add double handoff event 2018-05-02 08:43:32 +02:00
Johan T. Halseth
e9eab3f79f
server: reliably hand off breach from the ChainArbitrator to the breachArb
This commit make the server populate the ChainArbitrator's
ContractBreach method, by a method that will reliably handoff the breach
event ot the breachArbiter. The server will now forward the breach event
to the breachArbiter, and only let the closure return a non-nil error
when the breachArbiter ACKs this event.
2018-05-02 08:43:32 +02:00
Johan T. Halseth
08f1a3689d
peer: don't pass bool to SubscribeChannelEvents 2018-05-02 08:43:32 +02:00
Johan T. Halseth
f06797ab00
contractcourt/chain_arbitrator: make breachArbiter handoff a function closure
This commit adds the new function closure option ContractBreach to the
ChainArbitrator config, a closure that is again used by the ChainWatcher
to reliably handoff a breach event to the breachArbiter.
2018-05-02 08:43:31 +02:00
Johan T. Halseth
3fdc04dff0
contractcourt/chain_watcher: make breachArbiter handoff a function closure
This commit changes how the ChainWatcher notifies the breachArbiter
about a channel breach. Instead of assuming the breachArbiter is among
the clients subscibing to channel events, it will call a new method
contractBreach(), and assume the breachArbiter has reliably gotten the
breach info when this method returns with a non-nil error.

Since the breachArbiter was the only sybsystem having a sync chain
subsciption, we also remove the (now) unused syncDispatch option.
2018-05-02 08:43:31 +02:00
Johan T. Halseth
a6f0dd72ac
contractcourt/chain_arbitrator: use chainWatcherConfig 2018-05-02 08:43:31 +02:00
Johan T. Halseth
0697510884
contractcourt/chain_watcher: create chainWatcherConfig 2018-05-02 08:43:31 +02:00
Johan T. Halseth
7c945b42fe
fundingmanager_test: remove ArbiterChan 2018-05-02 08:43:31 +02:00
Johan T. Halseth
cdf60b5f9d
lnd: remove ArbiterChan 2018-05-02 08:43:31 +02:00
Johan T. Halseth
c3f0e608ec
fundingmanager: remove ArbiterChan 2018-05-02 08:43:31 +02:00
Johan T. Halseth
409ab08c36
rpcserver: remove send to settledContracts 2018-05-02 08:43:30 +02:00
Johan T. Halseth
55ac8735b6
breacharbiter_test: use ContractBreaches channel 2018-05-02 08:43:30 +02:00
Johan T. Halseth
b9970aec47
breacharbiter: receive breaches to ACK on separate channel
This commit changes how the breachArbiter gets notified about channel
breaches. Previously it would need to SubscribeToChannelEvents to get
get notified if any breach happened, now we send all seen breaches on a
new channel ContractBreaches.

By having the breachArbiter subscribe to channel events, we risked
events getting lost when we were either starting up or shutting down,
since events could happen before we had been able to subscribe, or right
after we had cancelled our subscription.

Now it is the server's responsibility to reliably forward events from
the ChainArbitrator to the breachArbiter, and forward the ACK the
breachArbiter responds with. This makes sure that the messages aren't
lost in the event of starting up or shutting down, since the connection
between the subsystems now are static.

A result of this change is that the internals of the breachArbiter can
be simplified significantly, as we will get all channel breaches
forwarded on one channel. This lets us get rid of the observer
goroutines, and we spin up goroutines handling the channel breaches only
when they happen.
2018-05-02 08:43:30 +02:00
Johan T. Halseth
79341fc63e
contractcourt/chain_watcher: move log message
This move the log message "channel marked pending-closed" to the point
where the channel actually has been marked pending closed, instead of
before the database transaction has been done.
2018-05-02 08:43:30 +02:00
Johan T. Halseth
7e397067f6
contractcourt/chainwatcher: remove close observer for loop
This commit removes the for loop in the closeObserver, as it wasn't
serving any purpose. After receiving a spend notification we would
return, breaking out of the loop. When getting a quit signal we would
also return, making the loop only do one iteration in any case.
2018-05-02 08:43:30 +02:00
Olaoluwa Osuntokun
097fd50747
Merge pull request #1140 from guggero/integrationtest-logfile-upload
Integration tests: upload logs from TravisCI to file.io as well
2018-05-01 21:08:14 -07:00
Olaoluwa Osuntokun
ef96c97786
Merge pull request #1139 from guggero/integrationtest-logfiles
Integration tests: give nodes a name and print that name in log file name
2018-05-01 21:05:42 -07:00
valentinewallace
8fcd6b56cb chainntnfs: expand test for mempool spend notifications
Make sure new clients get notified about txs that are already in the mempool.

Fixes #1074.
2018-05-01 19:09:56 -07:00
Olaoluwa Osuntokun
c7c25445eb
lnwallet: add new test to ensure channel is able to update fees in both directions
Closes #1145.
2018-05-01 17:35:42 -07:00
Oliver Gugger
b75429c6fe test: upload integration test logs from TravisCI to file.io 2018-05-01 13:16:21 +03:00
Oliver Gugger
cbd981c236 lnd_test: make sure node ID is correctly initialized in log file name 2018-04-30 11:59:34 +03:00
Vegard Engen
d7a254328e Take into account that the new fee will not come in addition to old fee when updating commit fee 2018-04-29 22:42:20 +00:00
Oliver Gugger
578f1d9332 lnd_test: give nodes a name and print that name in log file name 2018-04-28 17:46:50 +03:00
Olaoluwa Osuntokun
09c9979831
Merge pull request #1138 from halseth/integration-test-remove-block-flake
Integration tests: remove racy block generation
2018-04-27 13:19:39 -07:00
Johan T. Halseth
23f67ef009
lnd_test: remove racy block generation
This commit removes the mining of a block within the integration tests,
that would lead to a flake during runs. The reason was that the sweeoing
transaction was actually broadcast already at this point, and this block
was mined with the assumption that it wasn't. However, test would pass
more often than not because the UTXO nursery would be working on
graduating new heights, whcih is a bit slow, so in most cases the block
would be mined before it had broadcast the sweeping transaction.

By removing this block we ensure that the sweeping transaction will be
found for sure in the waitForTxInMempool call below.
2018-04-27 10:01:05 +02:00
Olaoluwa Osuntokun
4ab2bba5c7
Merge pull request #1005 from cfromknecht/wallet-recovery
Wallet Recovery
2018-04-26 20:21:03 -07:00
Conner Fromknecht
1ae3d4f118
dep: update btcwallet w/ wallet recovery 2018-04-26 16:34:21 -07:00
Conner Fromknecht
5049d3956b
lnd_test: adds wallet recovery test 2018-04-26 16:34:21 -07:00
Conner Fromknecht
c977ebb8bd
lntest/node: add ability to unlock/init HarnessNode 2018-04-26 16:03:28 -07:00
Conner Fromknecht
329793d06b
lntest/harness: add NewNodeWithSeed and RestoreNodeWithSeed 2018-04-26 16:03:28 -07:00
Conner Fromknecht
92a2ba163e
cmd/lncli/commands: ask for recovery window after restore seed 2018-04-26 16:03:28 -07:00
Conner Fromknecht
a2fdd8593d
lnwallet/interfaace_test: init neutrino with chain params 2018-04-26 16:03:28 -07:00
Conner Fromknecht
06a53aa5cc
lnwallet/btcwallet/config: add recovery window and bday 2018-04-26 16:03:28 -07:00
Conner Fromknecht
ae604061bf
lnwallet/btcwallet/btcwallet: pass recovery window to CreateNewWallet 2018-04-26 16:03:27 -07:00
Conner Fromknecht
603228ce79
lnd: threads recovery window param from walletunlocker 2018-04-26 16:03:27 -07:00
Conner Fromknecht
b9df5e75f7
keychain/interface_test: init test wallet w/o recovery window 2018-04-26 16:03:27 -07:00
Conner Fromknecht
1972a795e5
chainregistry: initialize wallet w/ recovery window 2018-04-26 16:03:27 -07:00
Conner Fromknecht
0ae62c3720
lnrpc: add RecoveryWindow to InitWalletRequest 2018-04-26 16:03:27 -07:00
Conner Fromknecht
3cb87f377f
walletunlocker/service_test: check recovery window is threaded 2018-04-26 16:03:09 -07:00
Conner Fromknecht
f8c0357770
walletunlocker: accept recovery window from InitWallet 2018-04-26 16:03:09 -07:00
Conner Fromknecht
c824af11a1
aezeed: expose BirthdayTime conversion from offset 2018-04-26 16:03:05 -07:00
Olaoluwa Osuntokun
c54a91f44d
rpc: modify SignMessage+VerifyMessage to bind msg to LN context
In this commit, we modify the SignMessage+VerifyMessage slightly in
order to bind the message we're signing to our specific context. We do
this by pre-pending the ascii text "Lightning Signed Message:" to the
msg before we run it through dsha256. Adding this prefix binds the
message to our context in order to avoid accidentally signing a sighash
or the like.
2018-04-25 19:45:32 -07:00
Olaoluwa Osuntokun
86fd9e361e
Merge pull request #1017 from halseth/contract-court-without-on-chain
Contract court acting on confirmed chain events
2018-04-25 17:13:24 -07:00
Richard Bondi
caf8139750 docs/grpc: correct javascript macaroon example
Creating and adding metadata in single line resulted in null `metadata`
2018-04-25 13:38:39 -07:00
Olaoluwa Osuntokun
c9eb077935
cmd/lncli: remove unused args for pendingchannels command
Fixes #1123.
2018-04-25 13:28:15 -07:00
Johan T. Halseth
4320421110
contractcourt/chain_watcher: don't delete syncDispatch clients on Cancel()
This commit makes clients subscribing to channel events that are marked
"sync dispatch" _not_ being deleted from the list of clients when they
call Cancel(). Instead a go routine will be launched that will send an
error on every read of the ProcessACK channel.

This fixes a race in handing off the breach info while lnd was shutting
down. The breach arbiter could end up being shut down (and calling
Cancel()) before while the ChainWatcher was in the process of
dispatching a breach. Since the breach arbiter no longer was among the
registered clients at this point, the ChainWatcher would assume the
breach was handed off successfully, and mark the channel as pending
closed. When lnd now was restarted, the breach arbiter would not know
about the breach, and the ChainWatcher wouldn't attempt to re-dispatch,
as it was already marked as pending closed.
2018-04-25 09:37:26 +02:00
Johan T. Halseth
8d5a33e349
lnd_test: modify tests to work with on-chain spend registrations
This commit modifies the integration tests to work with the recent
 changes to the ChannelArbitrator, where it will only act on commitments
 that has been confirmed. Main changes involving when to look for
 transactions in the mempool and in blocks, and using the new RPC for
 getting channels in the "waiting close" phase when they are waiting for
 the commitment to confirm.
2018-04-25 09:37:26 +02:00
Johan T. Halseth
028d1b7e26
lnd_test: add more relevant info to error messages 2018-04-25 09:37:26 +02:00
Johan T. Halseth
ddf62bbeea
contractcourt/channel_arbitrator: remove unused transationTrigger 2018-04-25 09:37:25 +02:00
Johan T. Halseth
97977c8a06
rpcserver: add channels waiting for commitment confirmation to pending channels response 2018-04-25 09:37:25 +02:00