Commit Graph

101 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
d93e3e6fbe
server: assume default port if one not present for --externalip 2017-04-13 14:41:58 -07:00
Olaoluwa Osuntokun
55e0dd32c6
utxonursery: typo fix 2017-04-04 14:32:57 +02:00
Andrey Samokhvalov
143a6e01bb lnd: fix unconvert warnings 2017-03-13 16:30:23 -07:00
Andrey Samokhvalov
8fb54782e2 lnd: fix gosimple warnings 2017-03-13 16:30:23 -07:00
Christopher Jämthagen
ce1fcc0bd6 utxonursery: handle non-existant to-self outputs
If a forceClose happens and the to-self output is below the dust value,
then that output will be non-existant in the commitment transaction.
UtxoNursery now handles that case by checking to see if the accompanying
selfOutPutSignDescriptor is nil. If it is nil, then it will ignore it.
2017-03-09 15:32:31 -08:00
Olaoluwa Osuntokun
8731fadb46
utxonursery: log txid when sending sweep transaction 2017-02-01 16:53:14 -08:00
Olaoluwa Osuntokun
1cbdf6473f
utxonursery: ensure we don't attempt to create negative value'd outputs
This commit fixes a slight bug in the utxoNursery. Previously, if we
forced closed a channel that was solely funded by the other party
without pushing any satoshis, then the utxoNursery would attempt to
sweep a target output even though it didn’t actually exist. This would
result in the creation of a negative value’d output due to the hard
coded fees currently used in several areas.

To fix his, we now ignore any “output” with a value of zero, when
adding new outputs to the kindergarden bucket.
2017-01-17 16:21:59 -08:00
Olaoluwa Osuntokun
7d6d8187fb
rpcserver: return full path payments go over in SendPayment
This commit augments the server’s response to successful SendPayment
commands by also returning the full path taken in order to fulfill the
payment. With this information, the user now obtains more context about
their payment whcih can be useful when debugging, or just exploring the
capabilities of the daemon.
2017-01-16 20:41:38 -08:00
Olaoluwa Osuntokun
ccb12ab0a8
utxonursery: add additional comments to new sections 2017-01-07 21:22:05 -08:00
Olaoluwa Osuntokun
5affed38fc
multi: update btcsuite API's to latest upstream changes
This commit makes a large number of minor changes concerning API usage
within the deamon to match the latest version on the upstream btcsuite
libraries.

The major changes are the switch from wire.ShaHash to chainhash.Hash,
and that wire.NewMsgTx() now takes a paramter indicating the version of
the transaction to be created.
2017-01-05 13:56:34 -08:00
Olaoluwa Osuntokun
798b0b9c9f
utxonursery: minor post-merge formatting clean ups
This commit implements so minor changes in formatting: character column
limits, error returning, scoped, errors. The aforementioned changes are
a bit of minor clean up after the merge of the latest PR in order to
ensure the new code in the file conforms to the code style in the rest
of the project.
2017-01-05 13:25:55 -08:00
bryanvu
aa04f82a15 utxonursery: added persistence to transaction output states
Moved transaction states from in-memory maps to persistent BoltDB
buckets. This allows channel force closes to operate reliably if the
daemon is shut down and restarted at any point during the forced
channel closure process.
2017-01-03 16:23:07 -08:00
Olaoluwa Osuntokun
702f214972
utxonursery: update inner loop to use new ChainNotifier API
Within the inner loop of the utxoNursery when waiting for a new
sweepable transaction to be confirmed, we now use the new ChainNotifier
API for ConfirmationEvent’s which exposes additional details as to
exactly where in the chain the transaction was ultimately confirmed.
2016-12-27 16:44:00 -08:00
Olaoluwa Osuntokun
343cd7779f
utxonursery: use a two value read from the epoch chan for graceful shutdown
Within the utoxNursery we now use a two value read fro the block epoch
channel in order to exit early if/when the ChainNotifier begins the
shutdown process before the signal reaches the utxoNursery.
2016-12-27 16:13:41 -08:00
Olaoluwa Osuntokun
a5d9ce2fac
utxonursery: remove contract breach retribution duties
This commit removes the previously added contract breach retribution
duties from the utxoNursery. Much of the code removed will instead be
moved to a new sub-system which continuously monitors the state of ALL
active contracts for their entire life time.
2016-11-28 16:53:23 -08:00
Olaoluwa Osuntokun
a29cd563f6
utxonursery: expand duties to channel contract breach retribution
This commit expands the duties of the utxoNursery (which should maybe
be renamed), to handle carrying out retribution against a counter-party
who breaches the channel contract by broadcasting a prior revoked state
on-chain.

As part of the retribution, once the breach transaction (the revoked
commitment transaction) has been confirmed within a block, the nursery
then sweep ALL funds pending within the channel to the daemon’s wallet.

This new section of the code has been implemented without full
persistence logic similar to time-locked output sweeping workflow of
the nursery. In a later commit, this section will gain full persistence
logic so the workflows can survive restarts of the daemon.
2016-11-21 13:28:56 -06:00
Olaoluwa Osuntokun
7b953c9c61
rpcserver: add REST workarounds, implement new RPC calls
This commit adds a few workarounds in order to concurrently support the
REST proxy as well as the regular gRPC interface. Additionally,
concrete support for the following RPC calls has been added:
GetTransactions, SubscriptTransactions, SubscribeInvoices, and
NewWitnessAddress.
2016-10-15 14:42:25 -07:00
Olaoluwa Osuntokun
bfa2a1d698
lnd: introduce the utxoNursery which incubates outputs until maturity
This commit introduces the utxoNursery. The duty of the utxoNursery is
to watch over CSV-locked immature outputs until they’ve fully matured.
An output is mature once both its sequence lock indicated by the CSV op
code within its output has become active. Once an output is mature the
nursery sweeps the outputs in batches into the source wallet.

The utxoNursery executes its duties once a commitment transaction has
been broadcast on-chain.
2016-09-12 19:07:39 -07:00