Commit Graph

34 Commits

Author SHA1 Message Date
carla
75370ce6b4
multi: update WalletController PublishTransaction to include label
Add label parameter to PublishTransaction in WalletController
interface. A labels package is added to store generic labels that are
used for the different types of transactions that are published by lnd.

To keep commit size down, the two endpoints that require a label
parameter be passed down have a todo added, which will be removed in
subsequent commits.
2020-05-19 13:30:00 +02:00
Conner Fromknecht
f2b6e2af04
input: pass input.Signature to multisig spend
Modifies SpendMultiSig to accept input.Signature, so that we can
ultimately assert the size of multisig witnesses.
2020-04-10 14:27:35 -07:00
Conner Fromknecht
0f94b8dc62
multi: return input.Signature from SignOutputRaw 2020-04-10 14:27:35 -07:00
Olaoluwa Osuntokun
1ac7550e3f
chancloser: deny co-op close initiated by the chan initiator for frozen chans 2020-03-23 16:57:03 -07:00
Johan T. Halseth
03a0706593
chancloser: unregister channel before db modification
This fixes a race during channel closing, where the last channel state
update was still not finished when we set the channel close bit in the
database. This lead to a flake during integration tests, where the last
state update would not finish, and the channel wasn't closes
successfully.

We fix it by first unregistering the channel, making sure it is removed
fully from the link before doing the db modification.
2020-03-04 10:31:38 +01:00
carla
d3cb6ad869
channeldb: store close initiator status
This commit adds two new channel statuses which indicate the party that
initatited closing the channel. These statuses are set in conjunction
with the existing commit broadcast status so that we do not need to
migrate existing logic to handle multiple types of closes. This status
is set for locally initiated force closes in this commit because they
follow a similar pattern to cooparative closes, marking the commitment
broadcast then proceeding with tx broadcast. Remote force closes are
added in the following commit, as they are handled differently.
2020-02-21 13:33:49 +02:00
carla
94d3eb60a4
multi: Use user provided close address for cooperative closes
This commit is adapted from @Bluetegu's original
pull request #1462.

This commit reads an optional address to pay funds out to
from a user iniitiated close channel address. If the channel
already has a shutdown script set, the request will fail if
an address is provided. Otherwise, the cooperative close will
pay out to the address provided.
2019-12-10 09:13:01 +02:00
Conner Fromknecht
f3398c0c0e
Merge pull request #3789 from cfromknecht/coop-close-rpc-status
republish force and coop closes on startup
2019-12-05 10:35:53 -08:00
Conner Fromknecht
0610578abb
lntest/itest/lnd_test: assert coop close chan status
This commit adds an itest assertion to check that a coop closed
channel's status is properly refelcted in list channels. We also fix a
race condition that prevented the rpc from being externally consistent
by marking the close sooner in the pipeline.
2019-12-04 14:25:29 -08:00
Conner Fromknecht
d9cf0396b3
peer+chancloser: mark coop broadcasted 2019-12-04 14:25:28 -08:00
carla
f86d63144c
multi: Set and check upfront shutdown address on close
This commit sets our close addresss to the address
specified by option upfront shutdown, if specified,
and disconnects from peers that fail to provide
their upfront shutdown address for coopertaive closes
of channels that were opened with the option set.
2019-12-03 11:38:29 +02:00
Olaoluwa Osuntokun
777ed104a3
chainfee: create new chainfee package extracting fees from lnwallet
In this commit, we create a new chainfee package, that houses all fee
related functionality used within the codebase. The creation of this new
package furthers our long-term goal of extracting functionality from the
bloated `lnwallet` package into new distinct packages. Additionally,
this new packages resolves a class of import cycle that could arise if a
new package that was imported by something in `lnwallet` wanted to use
the existing fee related functions in the prior `lnwallet` package.
2019-10-31 16:41:57 -07:00
Johan T. Halseth
c90b1dd17d
chancloser: mark commitment broadcast before publish
We call MarkCommitmentBroadcasted before publishing the closing tx to
ensure we can attempt to republish at startup if something goes wrong.
2019-09-25 14:04:44 +02:00
Johan T. Halseth
02b2787e44
multi: make MarkCommitmentBroadcasted take closeTx 2019-09-25 14:04:43 +02:00
Johan T. Halseth
b53899c43c
lnd: rename package main->lnd 2019-04-23 20:57:33 +02:00
Conner Fromknecht
325d77c431
chancloser+cnct: disable channel before closing 2019-03-12 17:34:28 -07:00
chokoboko
69d3c47d22 multi: inspect missed errors in scoped if statements 2019-03-11 13:23:21 -07:00
Conner Fromknecht
ad68009ec5
chancloser: remove error returned from unregisterChannel 2018-08-10 11:42:25 -07:00
Conner Fromknecht
1ded697e8d
multi: sort import paths with gofmt 2018-08-02 18:20:49 -07:00
Olaoluwa Osuntokun
e0baa49690
Merge pull request #1387 from wpaulino/send-disable-chan-update
multi: send a channel update with disabled flag set on channel close
2018-07-23 17:46:37 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Wilmer Paulino
873cccc7a6
multi: send channel update with disabled active on force and coop chan closes 2018-07-11 17:07:03 -07:00
Johan T. Halseth
0809880426
chancloser: don't log potential closes to the chainwatcher
This commit stops the chan closer from sending the potential coop close
transactions to the chainwatcher, as this is no longer needed. The
chainwatcher recently was modified to watch for any potential close, and
will because of this handle the close regardless of which one appears in
chain.

When the chancloser broadcast the final close transaction, we mark it as
CommitmentBroadcasted in the database.
2018-05-22 12:05:47 +02:00
Dimitris Tsapakidis
4009f7f874 multi: fix typos in comments 2018-04-17 19:03:27 -07:00
Johan T. Halseth
3e12f823b2
chancloser: express fee rates in sat/vbyte 2018-02-26 22:42:26 +01:00
Johan T. Halseth
db0928fa6f
chancloser: don't check error returned from broadcastTx
This commit removes the inspection of the return error
from broadcastTx. This is done since the new error
checking added to PublishTransaction will return a nil
error in case the transaction already exists in the
mempool.
2018-02-14 12:34:41 +01: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
22951cb364
lnd: account for new lnwire.Sig API and channeldb API changes 2018-02-06 20:14:33 -08:00
Daniel McNally
8543497dcc multi: fixing it's/its typos in comments 2018-02-06 19:13:07 -08:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
Olaoluwa Osuntokun
d4e650c85d
peer: the chancloser no longer needs to notify the breach arb of settled transactions 2018-01-22 19:19:59 -08:00
Olaoluwa Osuntokun
3ec83cc82f
peer+contractcourt: delegate watching for co-op closes to the chainWatcher
In this commit, we modify the interaction between the chanCloser
sub-system and the chain notifier all together. This fixes a series of
bugs as before this commit, we wouldn’t be able to detect if the remote
party actually broadcasted *any* of the transactions that we signed off
upon. This would be rejected to the user by having a “zombie” channel
close that would never actually be resolved.

Rather than the chanCloser watching for on-chain closes, we’ll now open
up a co-op close context to the chainWatcher (via a layer of
indirection via the ChainArbitrator), and report to it all possible
closes that we’ve signed. The chainWatcher will then be able to launch
a goroutine to properly update the database state once any of the
possible closure transactions confirms.
2018-01-22 19:19:53 -08:00
Olaoluwa Osuntokun
b11461fba7
chancloser: report proper final local balance in ChannelCloseSummary
Prior to this commit, the final close summary we added to the database
for the initiator of the channel was incorrect. This is due to the fact
that before, we would use the final snapshot to determine how many
coins the local party was delivered as a result of the cooperative
closure transaction. This is incorrect, as the local party pays fees on
the closure transaction if it’s the initiator.

To remedy this, we’ll now use the new return value of
CompleteCooperativeClose to properly note our final balance in the
database.
2018-01-08 19:50:21 -08:00
Olaoluwa Osuntokun
050500388c
chancloser: add new state machine to handle details of cooperative channel closure
In this commit, we add a new state machine to the project in order to
simplify and encapsulate the logic of negotiating the fees of the
closing transaction during the cooperative channel closure procedure.
This new implementation fixes several defects in the prior version of
the fee negotiation protocol as previously implemented within the peer.
Namely, we’ll now ensure that we converge to an acceptable fee
eventually, and clamp down the fee in the case that the starting fee is
greater than the fee of the commitment transaction.

The new fee negotiation also is very simple and should serve as a good
base for future improvements. After proposing our initial fee, if the
fee proposed by the remote party isn’t within 30% of our last fee, then
we increase/decrease our fee by 10%. This process continues until
either they send the same fee as we sent in a prior round, or they send
the identical fee that we sent in the last round.
2017-11-23 23:10:08 -06:00