Commit Graph

839 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
2dcbdf2622
lnwallet: fix logging error when fee is too low in BtcdFeeEstimator 2018-10-23 18:42:26 -07:00
Olaoluwa Osuntokun
6aa7c09308
lnwallet: properly set the short chan ID for remote unilateral close summaries
In this commit, we fix an existing bug wherein we wouldn't set the short
channel ID for the close summary in the database in the case that the
remote party force closed. The fix is simple, ensure that within
NewUnilateralCloseSummary we properly set the short channel ID. A test
has also been added in this commit, which fails without the
modifications to lnwallet/channel.go.

Fixes #2072.
2018-10-19 13:49:15 -07:00
Johan T. Halseth
146875ba65
lnwallet/btcwallet: remove filter check
GetBestBlock will now return only blocks where the filter header is synced.
2018-10-16 19:24:22 -07:00
Joost Jager
cf57c1daa3
lnwallet: export the Ripemd160H function
The reason for exporting this function is that we now have external
applications that generate custom Bitcoin scripts.
2018-10-12 08:50:07 +02:00
Conner Fromknecht
59b459674d
multi: init subsystem loggers via build pkg 2018-10-05 13:04:45 +09:00
Dave Kerr
1977d45de5 multi: fix function references in comments and clarify grammar 2018-09-27 20:59:59 -07:00
CirroStorm
f594a57c94 lnwallet: remove need for lnwallet to have access to the private key
This paves the way for lnd to work with hardware wallets, in which case it will not have access to the private key.
2018-09-27 20:58:46 -07:00
Olaoluwa Osuntokun
6afee3d099
Merge pull request #1856 from maurycy/typos
multi: fix various typos in comments
2018-09-27 20:38:10 -07:00
Olaoluwa Osuntokun
64681214f4
lnwallet: add test to execrise unconfirmed transcations notified by SubscribeTransactions
In this commit, we add a new test to ensure that all backends will
properly send out notifications when an unconfirmed transcation that we
send is inserted into the tx store. Before we updated the btcwallet
build commit in dep, this would fail for neutrino but now passes.
2018-09-12 21:01:59 -07:00
Olaoluwa Osuntokun
27abad92f6
lnwallet: update for new API change in NewBitcoindClient 2018-09-12 21:01:47 -07:00
Olaoluwa Osuntokun
2509ecd8d8
lnwallet: fix ListTransactionDetails to ensure unconfirmed transactions are installed
In this commit, we fix a bug in the arguments to GetTransactions for the
btcwallet implementation of the WalletController interface. Before this
commit, we wouldn't properly return unconfirmed transactions. The issue
was that we didn't specify the special mempool height of "-1", as the
ending height. The mempool height is actually internally converted to
the highest possible height that can fit into a int32.

In this commit, we set the start to zero, and end to -1 (actually
2^32-1) to properly scan for unconfirmed transactions.

Fixes #1422.
2018-09-12 21:01:40 -07:00
Olaoluwa Osuntokun
24f9504e27
lnwallet: add test to ensure that all backends show unconf txns in ListTransactionDetails
In this commit, we add a new test to the set of lnwallet integration
tests. In this new test, we aim to ensure that all backends are able to
display unconfirmed transactions in ListChainTransactions. As of this
commit, this test fails as no backends will return unconfirmed
transactions properly.
2018-09-12 20:51:32 -07:00
maurycy
ac24b12bf2
multi: fix various typos in comments 2018-09-07 06:51:49 +02:00
Olaoluwa Osuntokun
2c8914e7bc
lnwallet: ensure that each backend uses a distinct seed in integration tests
In this commit, we add an additional degree of isolation to the set of
integration tests. A bug was recently fixed to ensure that the wallet
always starts rescans from _after_ it's birthday. In the past it would
miss some funds that were deposited _right_ before the birthday of the
wallet. Fixing this bug exposed a test flake wherein the btcd node would
itself rescan back and collect some of the funds that were last sent to
the bitcoind node.

In order to fix this, we now ensure that each backend will use a unique
HD seed such that the tests are still deterministic for each backend and
role.
2018-09-04 18:52:30 -07:00
Conner Fromknecht
70ba3119b7
lnwallet/interface_test: run tests with disabled hint cache 2018-08-26 15:32:10 -07:00
Wilmer Paulino
191c4f3e28
multi: enable txindex on miner harness 2018-08-24 03:36:25 -07:00
Olaoluwa Osuntokun
de92dac6a8
lnwallet: fix logging message for fee floor 2018-08-23 19:38:13 -07:00
Johan T. Halseth
f4f7b64b2d
lnwallet/channel: add FwdMinHtlc(), returning MinHTLC from localChanCfg 2018-08-23 07:50:17 +02:00
Olaoluwa Osuntokun
c9bead7c21
Merge pull request #1278 from wpaulino/persistent-chain-notifiers
chainntnfs: introduce persistent height hint layer to ChainNotifier implementations
2018-08-22 21:02:27 -07:00
Wilmer Paulino
2931b2d3b2
lnwallet: add height hint cache to backend tests 2018-08-21 13:02:15 -04:00
Conner Fromknecht
05308ec22c
lnwallet/channel: concrete HTLC errors and ack AddRefs 2018-08-21 00:31:41 -07:00
Conner Fromknecht
0dca373bcd
lnwallet/errors: create concrete errors for settle/fail 2018-08-21 00:30:27 -07:00
Wilmer Paulino
ae3e66dccc
fundingmanager+lnwallet: allow specifying number of min confs for coin selection 2018-08-16 20:19:30 -07:00
Wilmer Paulino
d76f97d497
fundingmanager+lnwallet: make InitChannelReservation take in req rather than many args 2018-08-16 20:19:25 -07:00
Wilmer Paulino
51fc193ddc
lnwallet/wallet: export InitFundingReserveMsg and required fields 2018-08-16 20:19:24 -07:00
Olaoluwa Osuntokun
b06dabfcb9 lnwallet: properly set auxiliary channel recovery info in NewUnilateralCloseSummary
In this commit, we fix a slight bug by ensuring that the revocation info
at the final state of the channel, as well as the local chan config is
properly set within the channel close summary created within
NewUnilateralCloseSummary. Before this commit, for all cooperative close
transactions, this state would _only_ include the pubkey itself, which
in some cases may not be sufficient to re-derive the key if needed.
2018-08-14 19:11:18 -07:00
Olaoluwa Osuntokun
d2612e51bd
Merge pull request #1644 from wpaulino/kw-fees
multi: switch to sat/kw fees
2018-08-09 20:19:28 -07:00
Olaoluwa Osuntokun
d64bb5921e
Merge pull request #1635 from halseth/funding-broadcast-fail
Move funding tx broadcasting to Fundingmanager
2018-08-09 20:04:30 -07:00
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -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
Wilmer Paulino
b3d5d7ab9c
lnwallet: switch fee estimation to return sat/kw fee rates
In this commit, we modify our FeeEstimator interface to return an
estimated fee rate in sat/kw. Recently, due to low fees on the network,
users have been experiencing failures broadcasting transactions due to
not meeting specific fee requirements. This was happening more often
than not, as the estimated fee returned by backend nodes (bitcoind and
btcd) only takes into account vbytes, rather than weight. The fees
returned are also expressed in sat/kb, so we must take care that we do
not lose precision while converting to sat/kw. In the event that this
happens, a fee floor of 253 sat/kw has been added. This fee rate
originates from bitcoind rounding up the conversion from weight to
vbytes.
2018-08-09 17:29:48 -07:00
Wilmer Paulino
936fcc1f16
multi: update to latest BitcoindClient interface
In this commit, we introduce a nice optimization with regards to lnd's
interaction with a bitcoind backend. Within lnd, we currently have three
different subsystems responsible for watching the chain: chainntnfs,
lnwallet, and routing/chainview. Each of these subsystems has an active
RPC and ZMQ connection to the underlying bitcoind node. This would incur
a toll on the underlying bitcoind node and would cause us to miss ZMQ
events, which are crucial to lnd. We remedy this issue by sharing the
same connection to a bitcoind node between the different clients within
lnd.
2018-08-08 20:26:30 -07:00
Olaoluwa Osuntokun
31117e6b30
lnwallet: lower timeout for waitForWalletSync back to 10s 2018-08-08 19:48:21 -07:00
Conner Fromknecht
cf2c371042
multi: fix linting errors 2018-08-02 18:20:50 -07:00
Conner Fromknecht
1ded697e8d
multi: sort import paths with gofmt 2018-08-02 18:20:49 -07:00
Olaoluwa Osuntokun
f7d9b8e6b0
lnwallet: increase timeout in waitForWalletSync for new neutrino re-org logic 2018-07-31 21:29:03 -07:00
Olaoluwa Osuntokun
293a377edd
lnwallet: modify IsSynced() for neutrino backend to ensure filter headers are synced 2018-07-31 21:29:02 -07:00
Olaoluwa Osuntokun
343c1b80d2
lnwallet: update NewBreachRetribution to include pkScripts for htlc outputs
In this commit, we update the NewBreachRetribution method to include
pkScripts for htlc outputs. We do this now, as the breach arbiter will
need the raw pkScript when attempting to request spend notifications for
each HTLC.
2018-07-31 21:28:57 -07:00
Olaoluwa Osuntokun
84c458cc9f
lnwallet/btcwallet: update neutrino GetUtxo impl to use new API 2018-07-31 21:28:57 -07:00
Olaoluwa Osuntokun
f9f9eefab4
lnwallet: update GetUtxo to accept the pkScript to comply with new gcs filter 2018-07-31 21:28:56 -07:00
Olaoluwa Osuntokun
21451bf251
lnwallet: update dual funder verification code to use pkscript in GetUtxo 2018-07-31 21:28:56 -07:00
Olaoluwa Osuntokun
8dd0b56d35
lnwallet: publicy export WitnessScriptHash and GenMultiSigScript
In this commit, we export WitnessScriptHash and GenMultiSigScript as
external sub-systems may now need to use these methods in order to be
able to watch for confirmations based on the script of a transaction.
2018-07-31 21:28:50 -07:00
Olaoluwa Osuntokun
a5174a2228
Merge pull request #1543 from cfromknecht/wtblob
[watchtower/blob]: Blob of Justice encryption/decryption and v0 plaintext encoding
2018-07-31 20:55:29 -07:00
Johan T. Halseth
410b730778
lnwallet/channel test: add TestChanSyncFailure 2018-07-31 15:16:23 +02:00
Johan T. Halseth
78a4a15bb4
lnwallet/channel: check validity of received commitPoint
This commit adds a check for the LocalUnrevokedCommitPoint sent to us by
the remote during channel reestablishment, ensuring it is the same point
as they have previously sent us.
2018-07-31 15:16:23 +02:00
Johan T. Halseth
a2f2d28d0b
lnwallet/channel: enumerate error cases from remote chain desync
This commit enumerates the various error cases we can encounter when we
compare our remote commit chain to the view the remote communicates to us
via msg.NextLocalCommitHeight.

We now compare this height to our remote tail and tip height, returning
relevant error in case of a unrecoverable desync, and re-send a
commitment signature (including log updates) in case we owe one.
2018-07-31 15:16:23 +02:00
Johan T. Halseth
f1757d6da4
lnwallet/channel: enumerate error cases from local chain desync
This commit enumerates the various error cases we can encounter when we
compare our local commit chain to the view the remote communicates to us
via msg.RemoteCommitTailHeight.

We now compare this height to our local tail height (note that there's
never a local "tip" at this point), returning relevant error in case of
a unrecoverable desync, and re-send a revocation in case we owe one.
2018-07-31 15:16:23 +02:00
Johan T. Halseth
7fb3be84df
lnwallet/channel test: rename ErrCommitSyncDataLoss->ErrCommitSyncLocalDataLoss 2018-07-31 15:16:23 +02:00
Johan T. Halseth
48f1458ae5
lnwallet/channel: define channel sync errors
This commit defines a few new errors that we can potentially encounter
during channel reestablishment:
* ErrInvalidLocalUnrevokedCommitPoint
* ErrCommitSyncLocalDataLoss
* ErrCommitSyncRemoteDataLoss

in addition to the already defined errors
* ErrInvalidLastCommitSecret
* ErrCannotSyncCommitChains
2018-07-31 15:16:23 +02:00
Johan T. Halseth
3825ca71dd
lnwallet/channel: reduce scope of commitSecretCorrect 2018-07-31 15:16:22 +02:00