Commit Graph

76 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
fc21bf091a
multi: modify sweeper.CreateSweepTx to accept conf target, style changes
In this commit, we modify the newly introduced UtxoSweeper.CreateSweepTx
to accept the confirmation target as a param of the method rather than a
struct level variable. We do this as this allows each caller to decide
at sweep time, what the fee rate should be, rather than using a global
value that is meant to work in all scenarios. For example, anytime
we're sweeping an output with a CLTV lock that's has a dependant
transaction we need to sweep/cancel, we may require a higher fee rate
than a regular force close with a CSV output.
2018-10-18 18:08:27 -07:00
Joost Jager
7d69df77ed
sweep: create new Input interface
This commit introduces a common interface for sweep
inputs. It eliminates the type checking from UtxoSweeper.

Also the formerly present Amount() getter is removed. It was redundant
because this value is present in SignDesc().Output.Value as well.
2018-10-17 12:44:33 +02:00
Joost Jager
4dab405623
sweep: move sweep tx generation into sweep package
Sweep txes are currently generated in multiple locations. Moving
the sweep tx generation into a shared package will allow us to
reuse that logic.
2018-10-17 12:44:33 +02:00
Joost Jager
9fcc7ee390
utxonursery: move spendable output structs to sweep package
This commit moves the output structs to a new package as a
preparation for moving more logic into that package.
2018-10-17 12:44:33 +02:00
Conner Fromknecht
10b35a8f20
main: remove disable log in testing + clean up imports 2018-10-05 13:04:45 +09:00
Joost Jager
77d6a6697d
utxonursery: check for quit channel 2018-09-24 20:40:23 -07:00
Joost Jager
9f6fb1e128
utxonursery: test restart behaviour 2018-09-23 15:52:45 -07:00
Johan T. Halseth
0a5f982280
utxonursery: pass broadcastHeight to registerPreschoolConf
In this commit IncubateOutputs are given an extra parameter
broadcastHeight, which is passed from the server and used when called
registerPresschoolConf.

Earlier the utxonursery used the bestHeight as height hint in this case,
which would be wrong in the cases where we got outputs for incubation
which was confirmed below the best height.
2018-09-20 13:16:39 +02:00
Valentine Wallace
1ffc3bb82e
multi: update to latest RegisterBlockEpochNtfn interface 2018-08-10 01:08:57 -07:00
Wilmer Paulino
a63677a381
multi: switch to transaction weight to calculate transaction fees
Due to a recent change within the codebase to return estimated fee rates
in sat/kw, this commit ensures that we use this fee rate properly by
calculing a transaction's fees using its weight. This includes all of
the different transactions that are created within lnd (funding, sweeps,
etc.). On-chain transactions still rely on a sat/vbyte fee rate since it's
required by btcwallet.
2018-08-09 17:29:50 -07:00
Olaoluwa Osuntokun
55d6586a67
utxonursery: update to register for confs using pkScripts 2018-07-31 21:28:51 -07:00
Conner Fromknecht
381579477c
utxonursery: use symmetric second level htlc witness size
This commit switches over the estimates for htlc success/timeout
witness sizes to use a symmetric variable, highlighting their
equivalence in size.
2018-07-24 22:53:17 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Conner Fromknecht
92711c4d32
utxonursery: rebroadcast finalized kinder txns on startup
Alters the utxonursery to rebroadcast finalized sweep txns
that sweep kindergarten (CSV-delayed) outputs. Currently, we
reregister for confirmation notifications, but we make no
attempt to rebroadcast. The htlc-timeout transactions are
rebroadcast correctly, so this changes make the handling of
crib and kinder outputs symmetric on startup.
2018-06-13 01:40:05 -07:00
maurycy
3be08e69cf multi: 64bit aligment of atomic vars on arm/x86-32 2018-06-04 20:02:34 -07:00
Dimitris Tsapakidis
4009f7f874 multi: fix typos in comments 2018-04-17 19:03:27 -07:00
practicalswift
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -07:00
Johan T. Halseth
5f267bcc5b
utxonursery: use EstimateFeePerVSize 2018-02-26 22:42:26 +01:00
Johan T. Halseth
7aaa15b8b5
utxonursery: don't ignore any returned error from PublishTransaction 2018-02-14 12:34:41 +01:00
Conner Fromknecht
04487a4a76
utxonursery: fix witness overwriting bug
Fixes a minor indexing bug that could cause the
utxonursery to accidentally overwrite CSV
witnesses with other CLTV witnesses when populating
a sweep txn. Each type of output is treated
separately internally, the bug is introduced by
using the relative indexes of both sets as the final
indexes into the txins.

The fix adds an offset, equal to the number of CSV
outputs, to the relative indexes of the CLTV inputs.
This matches the order in which CSV and CLTV outputs
are added to the raw txn.
2018-02-07 17:17:46 -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
Conner Fromknecht
aaebc28206
utxonursery: properly set height hint when recovering commit sweep
This commit alters the restart logic in the nursery
to load channel close summaries from disk when
restarting the process of sweeping commit txns.
The channel close summary contains a closing height,
which is used to set the lower bound of the height hint
when resubscribing to spend notifications.
2018-01-24 15:38:50 -08:00
Olaoluwa Osuntokun
2faafbcd93
breacharbiter: properly account for second-level spends during breach remedy
In this commit, we address an un accounted for case during the breach
remedy process. If the remote node actually went directly to the second
layer during a channel breach attempt, then we wouldn’t properly be
able to sweep with out justice transaction, as some HTLC inputs may
actually be spent at that point.

In order to address this case, we’ll now catch the transaction
rejection, then check to see which input was spent, promote that to a
second level spend, and repeat as necessary. At the end of this loop,
any inputs which have been spent to the second level will have had the
prevouts and witnesses updated.

In order to perform this transition, we now also store the second level
witness script in the database. This allow us to modify the sign desc
with the proper input value, as well as witness script.
2018-01-22 19:20:01 -08:00
Olaoluwa Osuntokun
d368bce1da
utxonursery: use proper weight estimation for second-level spends 2018-01-22 19:20:00 -08:00
Olaoluwa Osuntokun
d0f8b5f194
nursery_store: update IncubateOutputs to take a slice of kid outputs 2018-01-22 19:19:45 -08:00
Olaoluwa Osuntokun
2283960000
utxonursery: update output sweeping to be aware of new output types
In this commit, we modify the logic surrounding sweeping outputs to be
aware of the new types of outputs that the nursery is now responsible
for. Namely: incoming HTLC’s on our commitment transaction as well as
outgoing HTLC’s on the commitment transaction for the remote party. For
 the latter class of HTLC, we’ll now set the lock time on the sweeping
transaction in order to satisfy the CLTV clause in the output we’re
spending.
2018-01-22 19:19:44 -08:00
Olaoluwa Osuntokun
fb17f3aeb4
utxonursery: attempt to republish crib transaction on regraduation 2018-01-22 19:19:44 -08:00
Olaoluwa Osuntokun
12babb3cea
utxonursery: update NurseryReport with details of new output types
The utxo nursery is now responsible for two additional output types:
outgoing HTLC’s on the commitment transaction of the remote party, and
second-level claim transactions that we broadcast. In this commit,
we’ve updated the NurseryReport to now include details, so users are
able to properly keep track of the status of all their pending coins.
2018-01-22 19:19:44 -08:00
Olaoluwa Osuntokun
13b5019cc6
utxonursery: add new absoluteMaturity field to kid outputs
This new field is reserved for outgoing HTLC outputs on the commitment
transaction of the remote party. These outputs don’t have a CSV delay,
but instead have an absolute maturity time.
2018-01-22 19:19:43 -08:00
Olaoluwa Osuntokun
eeb6ab0b17
utxonursery: don't mark channel as fully closed in closeAndRemoveIfMature
The ChannelArbitrator for this channel will do this, so we don’t need
to do it at this point any longer.
2018-01-22 19:19:43 -08:00
Olaoluwa Osuntokun
6568330355
utxonursery: modify IncubateOutputs to accept each output type individually
In this commit, rather than the IncubateOutputs method taking a close
summary entirely, we now take resolutions for each possible output
type. We do this as it’s possible that each output is sent for
incubation at a different time as on-chain conditions change.
Additionally, if we get a baby output (CLTV locked transaction), we’ll
check to see if we can immediately broadcast it. Otherwise, we may
never sweep it unless a restart is attempted.
2018-01-22 19:19:43 -08:00
Olaoluwa Osuntokun
e884da4f03
utxonursery: within IncubateOutputs, don't mark channel as fully closed
We no longer need to mark the channel as fully closed as the
ChannelArbitrator for the channel that incubation was requested for
will handle this.
2018-01-22 19:19:42 -08:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Olaoluwa Osuntokun
4b05bad4f1
utxn: log the CSV value of kindergarten outputs on state transition 2017-11-29 16:10:25 -08:00
Olaoluwa Osuntokun
a3cd248404
funding+utxonursery+breacharbiter: use new FeeEstimator API 2017-11-23 23:10:13 -06:00
Conner Fromknecht
997a37ca23
utxonursery: integrate nursery store 2017-11-15 18:49:12 -08:00
Conner Fromknecht
d8688b7d67
utxonursery: adds compile-time iface check for baby and kid outputs 2017-10-05 18:13:48 -07:00
Conner Fromknecht
d2e5494ef3
utxonursery: improves documentation grammar and thoroughness 2017-10-03 19:40:09 -07:00
Conner Fromknecht
47f40014f5
utxonursery: adds babyOutput and CsvSpendableOutput 2017-10-03 19:40:08 -07:00
Olaoluwa Osuntokun
fe2b8ccb29
utxonursery: fix typo in contractMaturityReport definition 2017-09-25 12:48:25 -07:00
Conner Fromknecht
ec288ddf5b
ba+utxno: final pass for formatting 2017-09-19 19:18:21 -07:00
Conner Fromknecht
7f93aec31c
utxonursery: remove use of pointer to lnwallet.Signer iface 2017-09-19 19:18:19 -07:00
Olaoluwa Osuntokun
7be039adec
multi: ensure that BlockEpoch clients are cancelled
This commit fixes a prior goroutine leak that could result in a node
having thousands of goroutines, particularly due to many concurrent
channel fundings. We now ensure that for each BlockEpoch client
created, we ensure that the client is cancelled once the creating
grouting exits.
2017-08-30 20:26:17 -07:00
Conner Fromknecht
c0f1d12521 utxonursery: refactors kidOutput SignDescriptor serialization 2017-08-25 17:56:50 -07:00
Conner Fromknecht
6ffe33f01a lnw+ba+utxon+cdb: reverts OutPoint and TxOut encoding 2017-08-25 17:56:50 -07:00
Philip Hayes
56793a1041 utxonursery: finish migrating to lnwire OutPoint serialization 2017-08-25 17:56:50 -07:00
Philip Hayes
d8c56433e3 lnwallet: extract SignDescriptor serialization and witness generator 2017-08-25 17:56:50 -07:00
Philip Hayes
f0aa186a56 channeldb+utxonursery+lnwire: use lnwire's OutPoint,TxOut serialization 2017-08-25 17:56:50 -07:00
Olaoluwa Osuntokun
458138f6fa
utxonursery: update serialization, API usage for recent SignDescriptor changes 2017-07-30 17:52:00 -07:00