Commit Graph

68 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
9c685433f3
rpc: non-existence of a nursery report is no longer an error
This commit fixes a slight logic error that could render the
`pendingchannels` RPC unusable if a node was on the reciting end of a
channel force close with no time-locked balance. In such a case the
channel wouldn’t be sent to the utxoNursery, resulting in an “contract
not found error”.

To fix this behavior, we’ve created a typed error that can be checked
within the RPC, thus we no longer treat this routine case as an error
case.
2017-05-14 19:20:31 -07:00
Olaoluwa Osuntokun
d9e2d7d22c
utxonursery: modify ChainNotifier usage due to recent API change 2017-05-11 15:20:50 -07:00
Olaoluwa Osuntokun
36fe8a730e
utxonursery: once all funds have been swept, mark chan as fully closed 2017-05-04 17:40:04 -07:00
Olaoluwa Osuntokun
17c5deb369
utxonursery: add new public NurseryReport method
This commit adds a new public facing method to the utxoNursery:
NurseryReport. This method is intended to be used by callers to
introspect into the current state of the utxo nursery. With this
information, callers will be able to ascertain: the number of immature
outputs, the total number of funds in limbo, and when funds can be
fully swept.
2017-05-04 17:39:35 -07:00
Olaoluwa Osuntokun
79ceaca747
utxonursery: add to new index buckets to enable querying nursery state
This commit adds to new index buckets to the undo nursery: one that
allows searching the preschool bucket by origin chan point, and another
that allows querying the kindergarten bucket using an identical key.
These index buckets are updated in tandem with their regular buckets.

A note has been named in this commit to re-work the bucket structure
for a time in the near future in which we have implemented full
on-chain HTLC handling.
2017-05-04 17:39:32 -07:00
Olaoluwa Osuntokun
ed7e4ad715
utxonursery: store the chanPoint of the source channel in kidOutput
This commit adds an additional field to the kidOutput struct: the
outpoint of the channel that originally created the output. This field
is now needed in order to add some additional indexes that are required
to enable callers to query the internal state of the utxoNursery.
2017-05-04 17:39:29 -07:00
Olaoluwa Osuntokun
dbed552d8e
utxonursery: properly return dropped error 2017-05-04 17:39:27 -07:00
Olaoluwa Osuntokun
e43d1dd7ca
utxonursery: log process of catch up graduation on restart 2017-04-13 14:50:29 -07:00