Commit Graph

25 Commits

Author SHA1 Message Date
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