Commit Graph

138 Commits

Author SHA1 Message Date
yyforyongyu
987edc9d81 multi: add a rpc endpoint to track the recovery process 2020-06-25 15:49:54 +08:00
carla
099161ed0b
multi: add label to WalletController SendOutputs and dependent rpcs
Add a label parameter to the WalletController SendOutputs endpoint and
update rpcs that use it to allow optional provision of labels.
2020-05-19 13:31:51 +02:00
carla
75370ce6b4
multi: update WalletController PublishTransaction to include label
Add label parameter to PublishTransaction in WalletController
interface. A labels package is added to store generic labels that are
used for the different types of transactions that are published by lnd.

To keep commit size down, the two endpoints that require a label
parameter be passed down have a todo added, which will be removed in
subsequent commits.
2020-05-19 13:30:00 +02:00
carla
537dac3c62
multi: specify start and end height for ListTransactionDetails
Add start and end height parameters to the rpc and cli GetTransactions
endpoints. Default to returning all transactions from genesis to tip,
including unconfirmed transactions to maintain backwards compatibility.
2020-05-05 21:10:06 +02:00
Andras Banki-Horvath
556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Conner Fromknecht
0f94b8dc62
multi: return input.Signature from SignOutputRaw 2020-04-10 14:27:35 -07:00
Conner Fromknecht
2b2c8b5a10
lnwallet/interface_test: wait for bitcoind startup
Flakes locally for me on darwin.
2020-04-09 12:49:07 -07:00
Oliver Gugger
5a52420ab6
lnwallet+fundingmgr: interrupt funding flow for PSBT
In case the funding manager detects that a funding flow is requested
to be executed with the help of a PsbtIntent, the normal channel
negotiation with the remote peer is interrupted, as soon as the
accept_channel message was received. With the remote peer's funding
multisig key and our local key, we can derive the funding output
script and its address. This is enough to start the PSBT funding
and signing process which the user will do externally to the daemon.
2020-03-31 09:17:24 +02:00
Olaoluwa Osuntokun
c85f6bb364
lnwallet: mark channel as frozen based on ShimIntent
In this commit, we make the internal channel funding flow aware of
frozen channels. We also update the testSingleFunderReservationWorkflow
method to ensure that the created channels have the proper type bit set.
2020-03-23 16:57:00 -07:00
Olaoluwa Osuntokun
98170e00ef
lnwallet: convert to use new kvdb abstraction 2020-03-18 19:35:13 -07:00
Johan T. Halseth
f95a82bf5f
lnwallet+funding: create CommitmentType enum 2020-03-09 12:59:34 +01:00
Matheus Degiovani
5dffa7da1c lnwallet: Re-enable tests
Tests were erroneously disabled in commit b1940d67.
2019-12-23 10:32:03 -03:00
Matheus Degiovani
02d616d9b7 lnwallet: Fix external funding test 2019-12-23 10:31:03 -03:00
Olaoluwa Osuntokun
b1940d6779
lnwallet: fix bug in verifyFundingInputs skip dual funder tests for neutrino
In this commit, we fix a long standing bug within the newly created
`verifyFundingInputs` method. Before this commit, the method would
attempt to derive the pkScript by looking at the last items on the
witness stack, and making a p2wsh output script from that. This is
incorrect as typically non of these scripts will actually be p2wsh, and
instead will be p2wkh. We fix this by using the newly available
`txscript.ComputePkScript` method to derive the proper pkScript.

This resolves an issue w.r.t passing incorrect arguments for all
backends, but an issue still stands for the neutrino backend. As is, we
pass a height hint of zero into the `GetUtxo` method call. With the way
the current utxo scanner is set up for neutrino, this'll cause it to
never find the UTXO, as it takes the height hint as a UTXO birth height,
rather than a lower bound of the birth of the UTXO.
2019-12-02 17:12:05 -06:00
Olaoluwa Osuntokun
6b729ec9f5
lnwallet: break early in TestLightningWallet when a sub-test fails 2019-12-02 17:11:58 -06:00
Olaoluwa Osuntokun
c3a7da5ce7
lnwallet: add new test to exercise external channel funding 2019-12-02 17:11:54 -06:00
Olaoluwa Osuntokun
7a64a7d3a4
lnwallet: delegate all channel funding logic to the new chanfunding package
In this commit, we begin to integrate the new channel funding package
into the existing codebase. With this set of changes, we'll no longer
construct and sign the funding transaction within this package, instead
delegating it to the new chanfunding package. We use the new
chanfunding.WalletAssembler to carry out all channel funding, providing
it with an implementation of all its interfaces backed by the wallet.
2019-12-02 17:11:36 -06:00
Wilmer Paulino
9587a2259f
lnwallet: fix test inconsistencies to support bitcoind 0.19.0
bitcoind's sendrawtransaction API in v0.19.0 now enforces a maximum fee
rate of 0.1 BTC/kb and valid output scripts.
2019-11-12 20:34:37 -08:00
Olaoluwa Osuntokun
4592f87033
Merge pull request #3653 from Roasbeef/external-funding-chainfees
chainfees: create new chainfees package extracting fees from lnwallet
2019-10-31 17:44:00 -07:00
Olaoluwa Osuntokun
777ed104a3
chainfee: create new chainfee package extracting fees from lnwallet
In this commit, we create a new chainfee package, that houses all fee
related functionality used within the codebase. The creation of this new
package furthers our long-term goal of extracting functionality from the
bloated `lnwallet` package into new distinct packages. Additionally,
this new packages resolves a class of import cycle that could arise if a
new package that was imported by something in `lnwallet` wanted to use
the existing fee related functions in the prior `lnwallet` package.
2019-10-31 16:41:57 -07:00
Olaoluwa Osuntokun
a73ee28e46
multi: convert the existing channeldb.ChannelType uint8 into a bit field
In this commit, we convert the existing `channeldb.ChannelType` type
into a _bit field_. This doesn't require us to change the current
serialization or interpretation or the type as it is, since all the
current defined values us a distinct bit. This PR lays the ground work
for any future changes that may introduce new channel types (like anchor
outputs), and also any changes that may modify the existing invariants
around channels (if we're the initiator, we always have the funding
transaction).
2019-10-31 16:34:37 -07:00
Wilmer Paulino
194a9dea81
multi: support sync freelist option within btcwallet 2019-10-04 12:19:40 -04:00
Joost Jager
b58dbb2d70
multi: fix canceled spelling 2019-10-03 17:27:36 +02:00
Olaoluwa Osuntokun
0b62126067
multi: update funding workflow to be aware of new tweakless commits
In this commit, we update the funding workflow to be aware of the new
channel type that doesn't tweak the remote party's output within the
non-delay script on their commitment transaction. To do this, we now
allow the caller of `InnitChannelReservation` to signal if they want the
old or new (tweakless) commitment style.

The funding tests are also updated to test both funding variants, as
we'll still need to understand the legacy format for older nodes.
2019-09-25 18:25:46 -07:00
Johan T. Halseth
2e9452916e
lnwallet/interface_test: add RBF test cases to testPublishTransaction
Checks that we get ErrDoubleSpend as expected when publishing a
conflicting mempool transaction with the same fee as the existing one,
and that we can publish a replacement with a higher fee successfully.
2019-09-25 08:04:04 +02:00
Johan T. Halseth
7897b96e6a
lnwallet/interface_test: extract local utility functions
In preparation for extending the testPublishTransaction test, shorten it
by moving utility methods out of the local scope.
2019-09-25 08:01:42 +02:00
Lars Lehtonen
a600d1eefe lnwallet: fix in-goroutine tests 2019-09-19 19:49:45 +00:00
Joost Jager
3d7de2ad39
multi: remove dead code 2019-09-10 17:21:59 +02:00
Olaoluwa Osuntokun
cc4daa04ad
lnwallet: when signing create account if not found
In this commit, we address an edge case that can happen a user rescans
w/ their seed, while retaining their existing `channel.db`. Once they
rescan, if they go to sign for a channel sweep for example, the
commitment key family (actually an account) may not yet have been
created, causing the signing attempt to fail.

We remedy this always creating the account if we go to sign, and the
account isn't found. The change has been structured to make this the
exception, so we'll avoid always needing to do 2 DB hits (check if
account exists, sign), each time we sign.

A new test has been added to exercise this behavior. If the diff from
the `signer.go` file is removed, then the test will fail.
2019-08-20 19:08:03 -07:00
Johan T. Halseth
44384a1b5b
lnwallet: move coin selection before ChannelReservation
Now that coin selection is independent of creating the channel
reservation, we can move it first, in preparation for doing custom coin
selection.
2019-07-18 00:33:14 +02:00
Johan T. Halseth
fcf74debe6
lnwallet+funding: rename Capacity and FundingAmt
Instead use LocalFundingAmt and RemoteFundingAmt to make it clear who is
contributing funds.
2019-07-18 00:33:14 +02:00
Yaacov Akiba Slama
fe2a565bec Add test for unmined transaction DestAddresses
Co-authored-by: Christopher Coverdale <chris.coverdale24@gmail.com>
2019-07-10 09:39:46 +03:00
Olaoluwa Osuntokun
2012b5dc1a
lnwallet: fix logic in testCreateSimpleTx test case
In this commit, we fix a logic flaw in the testCreateSimpleTx test case
which emerged once we the bug fix for dust outputs landed. Before this
commit, we would erroneously fail during valid test execution.
2019-06-18 19:55:24 -07:00
Unknown
16aad1a9ee lnwallet+chainregistry: remove unused FeeEstimator from wallet cfg 2019-04-16 14:16:56 -07:00
Johan T. Halseth
54f1f32e71
lnwallet/interface_test: add testCreateSimpleTx 2019-03-15 23:47:15 +01: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
b220c47ce7
Revert "funding+lnwallet: ensure max_htlc_value_in_flight smaller than capacity"
This reverts commit 4aa52d267f000f84caf912c62fc14a5b8e7cacb5.

It turns out that the other implementations set values for this field
which aren't based on the actual capacity of the channel. As a result,
we'll no reject most of their channel offerings, since they may offer a
value of a max `uint64` or something else hard coded that's above the
size of the channel. As a result, we're reverting this check for now to
maintain proper compatibility.
2019-01-29 17:58:04 -08:00
Johan T. Halseth
4aa52d267f
funding+lnwallet: ensure max_htlc_value_in_flight smaller than capacity
Return an error to the remote if larger.
2019-01-22 08:42:29 +01:00
Wilmer Paulino
c72da48111
multi: update to latest ChainNotifier impl New method 2019-01-21 13:57:43 -08:00
Wilmer Paulino
71410f6a08
lnwallet+fundingmanager: use ChannelConstraints struct with CommitConstraints 2019-01-11 17:01:27 -08:00
Joost Jager
91f3df07e4
lnwallet: prevent static fee estimator fees from being modified
Modifying the static fees is not thread safe. In this commit the fees
are made immutable.
2018-12-18 10:50:05 +01:00
Olaoluwa Osuntokun
1fd3aac925
multi: switch from bolt packge to bbolt package for all imports 2018-11-29 20:33:49 -08:00
Wilmer Paulino
5b42a38c0f
lnwallet/interface_test: add test to detect confirmation of change output spend tx
In this commit, we add a new test to the existing set of wallet tests to
ensure we can properly detect the confirmation of transactions that
spend our change outputs. We do this as a measure to prevent future
regressions from happening where the wallet doesn't request its backend
to be notified of when an on-chain transaction pays to a change address,
like with the recently discovered SendOutputs bug.

As is, this test will not pass until we update the btcwallet dependency
in the next commit.
2018-11-14 20:17:36 -08:00
Joost Jager
e14678030c
lnwallet: update to new SendOutputs signature 2018-11-10 07:57:19 +01:00
Wilmer Paulino
c740b8b85f
Revert "lnwallet/interface_test: run tests with disabled hint cache"
This reverts commit 70ba3119b77151600d2b00c607ba89dfa6408254.
2018-10-31 09:20:22 -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
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