Commit Graph

91 Commits

Author SHA1 Message Date
Johan T. Halseth
306c0c8aab
lnwallet: return ErrNoOutputs in case no outputs are sent to 2019-03-15 23:47:15 +01:00
Johan T. Halseth
6fb664dbe1
lnwallet/btcwallet: implement CreateSimpleTx 2019-03-15 23:46:50 +01:00
Wilmer Paulino
5c5c542f94
lnwallet/btcwallet: remove unnecessary tx in mempool/chain checks
The checks to determine whether the transaction broadcast failed due to
it already existing in the mempool/chain are no longer needed since the
underlying btcwallet PublishTransaction call will not return an error
when running into these cases.
2019-03-13 17:57:19 -07:00
Olaoluwa Osuntokun
8c1181af3b
lnwallet: add LastUnusedAddress to WalletController interface
In this commit, we add a new `LastUnusedAddress` method to the
`WalletController` interface. Callers can use this new method to graph
the last unused address, which can be useful for UIs that want to
refresh the address, but not cause nearly unbounded address generation.

The implementation for `btcwallet` uses the existing `CurrentAddress`
method. We've also added a new integration tests to exercise the new
functionality.
2019-03-05 15:35:24 -08:00
Joost Jager
9e012ecc93
multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input
interface and implementations in a separate package along with all their
dependencies from lnwallet.
2019-01-31 13:25:33 +01:00
Olaoluwa Osuntokun
bd9ebbd5af
lnwallet: add more godoc to InputScript rename ScriptSig field to SigScript 2019-01-09 15:55:18 -08:00
AdamISZ
9bb2a26948
Add listunspent RPC call
Returns a brief json summary of each utxo found by calling
ListUnspentWitness in the wallet. The two arguments are the
minimum and maximum number of conrfirmations (0=include
unconfirmed)
2018-12-11 15:26:38 +01:00
Valentine Wallace
3c1e0f2aef lnwallet/btcwallet: return best header timestamp while wallet is rescanning.
One way applications built on top of lnd can estimate sync percentage is
through comparing the current time to the best known timestamp of the
lnd wallet's sync state. Therefore, we should always return this
information even if the the wallet is not synced.
2018-11-21 02:15:11 +00:00
Wilmer Paulino
9ca9802d9c
lnwallet/btcwallet: check wallet rescan is complete within IsSynced
In this commit, we add an additional check to btcwallet's IsSynced
method to ensure that it is not currently undergoing a rescan. We do
this to block upon starting the server and all other dependent
subsystems until the rescan is complete.
2018-11-14 20:17:36 -08:00
Wilmer Paulino
b1860a95e0
lnwallet/btcwallet: add lightning addr scope before wallet start
In this commit, we add the lightning address scope before the wallet
starts to prevent a race condition between the wallet syncing and adding
the scope itself. This became more apparent with the recent btcwallet
fixes, as several database transactions now occur between the wallet
being started and it syncing.
2018-11-14 20:17:36 -08:00
Wilmer Paulino
255f38e72d
lnwallet/btcwallet: check output is under our control in FetchInputInfo
In this commit, we add an additional check to btcwallet's FetchInputInfo
method to ensure the output is actually under control of the wallet.
Previously, the wallet would assume the output was under its control if
the txid of the output was found within the wallet. This is not a safe
assumption to make however, because if we happened to be the sender of
this transaction, it would be found within the wallet but it's not
actually under our control. To fix this, we explicitly check that there
exists an address in our wallet for this output.
2018-11-14 20:17:36 -08:00
Johan T. Halseth
776059bdab
Merge pull request #2155 from joostjager/return-tx
lnwallet: update to new SendOutputs signature
2018-11-13 16:39:54 +01:00
Joost Jager
e14678030c
lnwallet: update to new SendOutputs signature 2018-11-10 07:57:19 +01:00
AdamISZ
53b1b8837f
fix two comment typos in signer.go 2018-11-08 20:54:02 +01: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
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
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
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
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -07:00
Conner Fromknecht
1ded697e8d
multi: sort import paths with gofmt 2018-08-02 18:20:49 -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
84c458cc9f
lnwallet/btcwallet: update neutrino GetUtxo impl to use new API 2018-07-31 21:28:57 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Oliver Gugger
24a085bf7d btcwallet: extend config to allow passing of an unlocked wallet 2018-06-12 19:27:56 -07:00
Oliver Gugger
4cefb6b8dc btcwallet: use already unlocked wallet if available 2018-06-12 19:27:56 -07:00
Conner Fromknecht
06a53aa5cc
lnwallet/btcwallet/config: add recovery window and bday 2018-04-26 16:03:28 -07:00
Conner Fromknecht
ae604061bf
lnwallet/btcwallet/btcwallet: pass recovery window to CreateNewWallet 2018-04-26 16:03:27 -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
Olaoluwa Osuntokun
af4afdb6f0
lnwallet: use btcutil.NewAmount for BTC -> SAT conversions
In this commit, we fix an existing rounding related bug in the codebase.
The RPC interface for btcd and bitcoind return values in BTC rather than
in satoshis. So in several places, we're forced to convert ourselves
manually. The existing logic attempted to do this, but didn't properly
account for rounding. As a result, our values can be off due to not
rounding incorrectly.

The fix for this is easy: simply properly use btcutil.NewAmount
everywhere which does rounding properly.

Fixes #939.
2018-03-25 19:15:18 -07:00
Conner Fromknecht
ca7992e8dd
lnwallet/btcwallet/singer: use chainKeyScope to fetch scoped mgr 2018-03-13 16:33:46 -07:00
Conner Fromknecht
fbef815530
lnwallet/btcwallet/config: add CoinType to configuration 2018-03-13 16:33:46 -07:00
Conner Fromknecht
e760963ead
lnwallet/btcwallet/btcwallet: use coin type in key scope 2018-03-13 16:33:46 -07:00
Olaoluwa Osuntokun
18e9475a9a
lnwallet/btcwallet: grab best header timestamp directly from wallet
In this commit, we modify the way we obtain the current best header
timestamp. In doing this, we fix an intermittent flake that would pop
up at times on the integration tests. This could occur as if the wallet
was lagging behind the chain backend for a re-org, then a hash that the
backend knew of, may not be known by the wallet.

To remedy this, we’ll take advantage of a recent change to btcwallet to
actually include the timestamp in its sync state.
2018-03-06 16:04:07 -05:00
Olaoluwa Osuntokun
a144018e98
lnwallet: remove p2pkh as an address type, wallet is now pure segwit
In this commit, we modify the mechanics of the wallet to only allow
derivation of segwit-like addresses. Additionally, the ConfirmedBalance
method on the WalletController now only has a single argument, as it’s
assumed that the wallet is itself only concerned with segwit outputs.
2018-03-06 16:04:03 -05:00
Olaoluwa Osuntokun
af1fd65655
lnwallet/btcwallet: update Signer implementation to use keychain.KeyDescriptor 2018-03-06 16:04:01 -05:00
Olaoluwa Osuntokun
93280ad60a
lnwallet/btcwallet: update implementation to account for recent API changes
The new version of the internal core of btcwallet now uses KeyScopes
rather than address types to derive particular addresses. As a result,
in this commit, we update our API usage to ensure that proper addresses
are still derived.
2018-03-06 16:04:00 -05:00
Olaoluwa Osuntokun
6290a520fd
lnwallet/btcwallet: remove pruned interface methods
These methods are no longer a part of the interface. As a result, we
can safely delete them.
2018-03-06 16:04:00 -05:00
Olaoluwa Osuntokun
d8ce90306d
lnwallet/btcwallet: during initial creation catch the case of an existing wallet
In this commit, due to the recent changes within lnd itself, it may be
possible that a wallet already exists when the wallet has been signaled
to be created. As a result, *always* open the wallet ourselves, but
allow an existing wallet to already be in place.
2018-03-05 11:07:07 -05:00
Johan T. Halseth
f6ac5658e2
lnwallet: make SendOutputs take feerate in SatPerVByte 2018-02-26 22:42:24 +01:00
Conner Fromknecht
4449038ae5
lnwallet/btcwallet/btcwallet: adds extra double spend case
Adds an extra case to the select statement to catch
an error produced by btcd. The error is meant to signal
that an output was previously spent, which can appear
under certain race conditions in spending/broadcasting.
This caused our final itest to fail because it would
not try to recraft the justice txn.
2018-02-20 20:48:53 -08:00
Olaoluwa Osuntokun
d5923f3832
Merge pull request #594 from halseth/publish-transaction-error-codes
Ignore ErrRejectDuplicate errors
2018-02-20 19:05:53 -08:00
Jason Dufair
84551c616f lnwallet/lnrpc: Expose sync status to gRPC interface
This commit adds wallet_best_block_timestamp to the gRPC interface.
This is done in order to allow clients to calculate progress while
lnd syncs to the blockchain. wallet_best_block_timestamp is exposed
via the GetInfo() rpc call. Additionally, IsSynced() returns the
WalletBestBlockTimestamp as the second value in the tuple
that is returned, providing additional detail when querying about the
status of the sync. The BtcWallet interface has also been updated
accordingly.

This commit was created to support the issue to
[Add progress bar for chain sync] (lightninglabs/lightning-app#10) in
lightning-app
2018-02-20 19:00:06 -08:00
Johan T. Halseth
1dcc89cca9
lnwallet/btcwallet: return concrete error type from PublishTransaction 2018-02-14 12:34:40 +01: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
Alex
187f59556a multi: add bitcoind drivers and tests 2018-01-15 13:59:34 -08:00
Conner Fromknecht
c17b695128
lnwallet/btcwallet/blockchain: properly handle nil spend report
This commit adds an additional check in GetUtxo that
tests for the nil-ness of the spend report returned by
the neutrino backend. Previously, a nil error and
spend report could be returned if the rescan did not
find the output at or above the start height. This
was observed to have cause a nil pointer dereference
when the returning line attempted to access the output.
This case is now handled by returning a distinct error
signaling that the output was not found.
2018-01-09 18:14:25 -08:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Micah Lerner
6ae7d275ab lnwallet: Add destination addresses to listchaintxns 2017-12-08 15:11:23 -08:00