Commit Graph

5533 Commits

Author SHA1 Message Date
Conner Fromknecht
fa63ba2e37
watchtower/lookout/lookout_test: adds simple lookout tests 2018-10-31 20:42:15 -07:00
Conner Fromknecht
671be69743
watchtower/lookout/mock: adds mock backend 2018-10-31 20:42:14 -07:00
Conner Fromknecht
475ab01442
watchtower/lookout/lookout: adds Lookout 2018-10-31 20:42:12 -07:00
Conner Fromknecht
3ab34f8426
watchtower/lookout/punisher: adds Punisher craft+bcast justice txn 2018-10-31 20:42:11 -07:00
Conner Fromknecht
0632520f40
watchtower/lookout/justice_descriptor: adds justice txn creation 2018-10-31 20:42:10 -07:00
Conner Fromknecht
bd5ed47ce4
watchtower/lookout/interface: adds primary lookout ifaces 2018-10-31 20:42:08 -07:00
Conner Fromknecht
1d7e382097
watchtower/lookout/log: adds lookout subsystem logger 2018-10-31 20:42:07 -07:00
Conner Fromknecht
b79bab0920
watchtower/wtdb/mock: adds lookout-related mock functions 2018-10-31 20:42:06 -07:00
Conner Fromknecht
4e6dc3863b
watchtower/wtdb/session_info: compute rewards outputs 2018-10-31 20:42:04 -07:00
Conner Fromknecht
740e8fd686
watchtower/blob/justice_kit_test: remove external nonce
The nonce is now passed in as the prefix to the
ciphertext, and is generated randomly in calls
to Encrypt.
2018-10-31 20:42:03 -07:00
Conner Fromknecht
c5eba3b608
watchtower/blob/justice_kit: use randomized 192-bit nonce
This commit modifies the blob encryption scheme to
use chacha20-poly1305 with a randomized 192-bit nonce.
The previous approach used a deterministic nonce scheme,
which is being replaced to simplify the requirements of
a correct implementation.  As a result, each payload
gains an addtional 24-bytes prepended to the ciphertext.
2018-10-31 20:42:01 -07:00
Conner Fromknecht
2dd399ca52
watchtower/blob/justice_kit: return DER signatures
This commit fixes an issue with the witness stack
construction for to-local and to-remote inputs,
that would cause the justice kit to return
signatures as fixed-size, 64-byte signatures.
The correct behavior is to return DER-encoded
signatures so that they will properly verify on
the network, since the consensus rules won't
be able to understand the fixed-size variant.
2018-10-31 17:36:18 -07:00
Olaoluwa Osuntokun
fb4d3909a1
Merge pull request #2122 from cfromknecht/blob-variable-length-addr
[watchtower/blob] variable length sweep addr
2018-10-31 17:31:29 -07:00
Johan T. Halseth
08c2ee05f6
Merge pull request #2107 from vwoo/grpc-ruby-doc-macaroon
gRPC ruby doc updates
2018-10-31 08:26:56 +01:00
Olaoluwa Osuntokun
67a9c4916f
Merge pull request #2112 from AdamISZ/LUW-include-max
Add a maxconfirms argument to ListUnspentWitness
2018-10-30 20:29:49 -07:00
Olaoluwa Osuntokun
9f0b008773
Merge pull request #2004 from wpaulino/spend-tx-notifier
chainntnfs: handle spend notifications within TxConfNotifier
2018-10-30 20:24:17 -07:00
Harald Nordgren
433c5506ce build: bump Go versions, use '.x' to always get latest patch versions 2018-10-30 20:15:42 -07:00
Wilmer Paulino
e6b1a27cd7
chainntnfs/neutrinonotify: make filter update synchronous
In this commit, we modify the notifier to handle filter updates
synchronously. We do this to prevent race conditions between new block
notifications and filter updates. Otherwise, it's possible for a new
block to come in that should match our filter, but doesn't due to the
filter being updated after.

We also modify their order so that the filter is updated first. We do
this so we can immediately start watching for the event at tip while the
rescan is ongoing.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
60a1d73e08
chainntnfs/txnotifier: commit height hint after rescan is complete
In this commit, we'll now commit the current height of the TxNotifier as
the height hint for an outpoint/transaction after a rescan has been
completed and has determined that the outpoint is unspent/transaction is
unconfirmed. We do this to prevent another potentially long rescan if
the daemon is restarted before a new block comes in (which is when the
hints will be updated again).
2018-10-30 17:59:31 -07:00
Wilmer Paulino
6458868ba0
chainntnfs/interface_test: add spend reorg test 2018-10-30 17:59:31 -07:00
Wilmer Paulino
deca4cfe44
chainntnfs/neutrinonotify: remove old spend notification handling logic
In this commit, we remove the old spend notification logic within the
NeutrinoNotifier as it's been phased out by the TxNotifier.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
bfd11a251e
chainntnfs/neutrinonotify: handle spend notification registration w/ TxNotifier
In this commit, we modify the logic within RegisterSpendNtfn for the
NeutrinoNotifier to account for the recent changes made to the
TxNotifier. Since it is now able to handle spend notification
registration and dispatch, we can bypass all the current logic within
the NeutrinoNotifier and interact directly with the TxNotifier instead.

The most notable change is that now we'll only attempt a historical
rescan if the TxNotifier tells us so.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
74139c9a3f
chainntnfs/btcdnotify: remove old spend notification handling logic
In this commit, we remove the old spend notification logic within the
BtcdNotifier as it's been phased out by the TxNotifier.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
88edd320d5
chainntnfs/btcdnotify: handle spend notification registration w/ TxNotifier
In this commit, we modify the logic within RegisterSpendNtfn for the
BtcdNotifier to account for the recent changes made to the TxNotifier.
Since it is now able to handle spend notification registration and
dispatch, we can bypass all the current logic within the
BtcdNotifier and interact directly with the TxNotifier instead.

The most notable change is that now we'll only attempt a historical
rescan if the TxNotifier tells us so.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
0927f35dc1
chainntnfs/bitcoindnotify: remove old spend notification handling logic
In this commit, we remove the old spend notification logic within the
BitcoindNotifier as it's been phased out by the TxNotifier.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
180dffd154
chainntnfs/bitcoindnotify: handle spend notification registration w/ TxNotifier
In this commit, we modify the logic within RegisterSpendNtfn for the
BitcoindNotifier to account for the recent changes made to the
TxNotifier. Since it is now able to handle spend notification
registration and dispatch, we can bypass all the current logic within
the BitcoindNotifier and interact directly with the TxNotifier instead.

The most notable changes include the following:

  1. We'll only attempt a historical rescan if the TxNotifier tells us
  so.

  2. We'll dispatch the historical rescan within the main goroutine to
  prevent WaitGroup panics, due to the asynchronous nature of the
  notifier.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
1fe3d59836
chainntnfs/txnotifier_test: extend tests to handle spend notifications 2018-10-30 17:59:31 -07:00
Wilmer Paulino
2935392f51
chainntnfs/txnotifier: correctly update confirm/spend hints on chain updates
In this commit, we address an issue w.r.t. updating the confirm hints
for transactions and spend hints for outpoints on chain updates.
Previously, upon a block being disconnected, we'd attempt to commit a
new height hint for all outstanding confirmation notifications. This is
not correct because we'll end up modifying the height hint for things
that have confirmed at a previous height than the one being
disconnected. This would cause issues on restart when attempting a
historical dispatch, as we would start scanning at a height above which
the transaction actually confirmed in.

This has been addressed by only updating the hints for outstanding
notifications that are still unconfirmed/unspent and for notifications
that were confirmed/spent within the block being connected/disconnected.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
f27e73fcb8
chainntnfs/txnotifier: detect reorgs for spending transactions of registered outpoints
In this commit, we introduce support to the TxNotifier to detect
spending transactions of registered outpoints being reorged out of the
chain. In the event that a reorg does occur, we'll consume the Spend
notification if it hasn't been consumed yet, and dispatch a Reorg
notification instead.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
e6b2755a57
chainntnfs/txnotifier: watch for spends at tip
In this commit, we add support to allow the TxNotifier to properly
determine whether a new block extending the chain contains a transaction
that spends a registered outpoint. In the event that it does, spend
notifications will be dispatched to all active registered clients for
such outpoint.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
4d7fa9ecc4
chainntnfs/txnotifier: allow registration of spend notifications
In this commit, we introduce the registration logic for spend
notifications to the TxNotifier. Most of this logic was taken from the
different existing ChainNotifier implementations, however, it features
some useful additions in order to make the ChainNotifier a bit more robust.

Some of these additions include the following:

  1. RegisterSpend will now return a HistoricalSpendDispatch struct,
  which includes the details for successfully determining if an outpoint
  was spent in the past. A HistoricalSpendDispatch will only be returned
  upon the first registration of an outpoint. This is done as,
  previously, if multiple clients registered for the same outpoint, then
  multiple historical rescans would also be dispatched, incurring a toll
  on the backend itself.

  2. UpdateSpendDetails will now be used to determine when a historical
  rescan has completed, no matter if a spending transaction was found or
  not. This is needed in order to responsibly update the spend hints for
  outpoints at tip, otherwise we'd attempt to update them even though we
  haven't yet determined if they have been spent or not. This will
  dispatch notifications to all currently registered clients for the
  same outpoint. In the event that another client registers later on,
  then the spending details are cached in memory in order to prevent
  further historical rescans.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
fc7a33b64f
chainntnfs/txnotifier: add fields/structs to track spend notifications
In this commit, we introduce the required fields for the TxNotifier to
properly carry its duties in notifying its registered clients about the
spend of an outpoint. These are not yet used, but will be throughout the
some of the following commits.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
87123d5e23
chainntnfs: extend SpendEvent with reorg channel
In this commit, we add a new channel within the SpendEvent struct that
will be sent upon whenever the spending transaction of the registered
outpoint gets reorged out of the chain. This will pave the road for
successfully handling a funding transaction getting reorged out of the
chain among other things.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
f4128c9afb
chainntnfs/txnotifier: move rescanState & confNtfnSet decl to top 2018-10-30 17:59:31 -07:00
Wilmer Paulino
405e8f0fad
chainntnfs/txnotifier: rename hintCache -> confirmHintCache 2018-10-30 17:59:31 -07:00
Wilmer Paulino
f65401b439
chainntnfs/txnotifier: rename Register -> RegisterConf 2018-10-30 17:59:31 -07:00
Wilmer Paulino
82f6fd7a91
chainntnfs: rename TxConfNotifier -> TxNotifier 2018-10-30 17:59:31 -07:00
Wilmer Paulino
f8789e9db0
chainntnfs: rename txconfnotifier.go -> txnotifier.go 2018-10-30 17:59:31 -07:00
Wilmer Paulino
f4cf1073d4
chainntnfs/height_hint_cache: prevent db transactions with no updates
In this commit, we modify our height hint cache to no longer start a
database transaction if no outpoints/txids are provided to update the
height hints for.
2018-10-30 17:59:31 -07:00
Wilmer Paulino
39d86d5731
chainntnfs/interface_test: stop UnsafeStart notifiers within test
In this commit, we modify the set of tests that start the different
backend notifiers with UnsafeStart to stop them within the tests
themselves. This prevents us from running into a panic when attempting
to run the package-level tests with a filter (using test.run).
2018-10-30 17:59:31 -07:00
Conner Fromknecht
2255ce17db
watchtower/blob/justice_kit_test: add sweep addr tests
Adds vectors to the justice kit tests to
ensure variable length sweep addresses are
properly encoded/decoded.
2018-10-29 16:48:43 -07:00
Conner Fromknecht
b7d811b3dd
watchtower/blob/justice_kit: add variable length sweep addr
This commit fixes an oversight in the previous
design of the watchtower blob, by introducing
a length byte for sweep addresses. The previous
format supposed that addresses would be padded
to 42 bytes, but had no indication of the
address's actual length.

To rememdy this, we introduce a single byte
indicating the actual size of the address,
such that the padding can be removed upon
decoding.
2018-10-29 16:48:43 -07:00
Conner Fromknecht
ae6f06155a
watchtower/blob/justice_kit_test: use test.Run for sub tests 2018-10-29 16:34:31 -07:00
Oscar Lafarga
832bd8101c docs: update INSTALL.md
- Provides clarity to the sample `lnd.conf` to reduce friction on a first-time mainnet set up of lnd (avoiding the `loadConfig: debug-htlc mode cannot be used on bitcoin mainnet` error)

- Removes `debughtlc` from the sample `lnd.conf` since it is not something most people would use anymore
- Adds link to `sample-lnd.conf` with proper line-wrapping
2018-10-29 15:39:35 -07:00
Olaoluwa Osuntokun
68d96488cc
server: properly set node pubkey within initTorController 2018-10-28 16:54:05 -07:00
AdamISZ
567306b010
Add a maxconfirms argument to ListUnspentWitness
This change was inspired by #1984 - the underlying call to
ListUnspent supports a (min, max) range so it makes sense that
the WalletController interface can also support this; a
default no-maximum can be expressed using a MaxInt32 value.
2018-10-28 15:55:18 +01:00
Olaoluwa Osuntokun
eaba39d20e
Merge pull request #1787 from cfromknecht/isolate-scanning-ntfns
chainntnfs: Isolate conf notifications during historical scans
2018-10-26 19:08:18 -07:00
Conner Fromknecht
ba28ec3be0
chainntnfs/neutrinonotify/neutrino: fix debug logs 2018-10-26 18:32:32 -07:00
Conner Fromknecht
e03c818aa7
chainntnfs/txconfnotifier: remove ntfn details, bound conf depth
Removes details field from conf notifications, in favor
of using the details on the confSet. We also bound the
requested conf depth to the reorg saftey limit, as the
behavior of state tracking within the notifier is
undefined otherwise.
2018-10-26 18:32:31 -07:00
Wilmer Paulino
589dc96d88
chainntnfs/tx_notifier: extract conf reorg dispatch into method 2018-10-26 18:32:31 -07:00