Commit graph

1410 commits

Author SHA1 Message Date
Oliver Gugger
b5fd915162
internal/prompt: allow compilation in js/wasm environment
The wallet loader has a dependency to the internal/prompt package for
prompting the user for certain inputs (e.g. wallet password or new
seed).
This makes it impossible for projects that use the wallet as a
dependency and always provide those inputs as parameters to compile for
JavaScript/WebAssembly targets because the prompt code uses some
terminal functionality that is not available in JS syscalls.
By providing a JS specific implementation that just returns an error we
can compile the dependent projects.
Adding acutal support for prompting the user in the browser is currently
not planned as that can easily be circumvented by providing all inputs
as parameters.
2021-05-14 12:41:35 +02:00
Olaoluwa Osuntokun
36f4c930d7
Merge pull request #748 from lightninglabs-deploy/go-mod-update-2021-5
build: update pinned modules to latest versions
2021-05-13 17:12:18 -07:00
Olaoluwa Osuntokun
47e0edadcd
build: update pinned modules to latest versions 2021-05-13 16:36:34 -07:00
Olaoluwa Osuntokun
3a2f12e3a9
Merge pull request #745 from bhandras/walletdb_foreach
walletdb: add ForEachBucket to the ReadTx with bbolt implementation
2021-05-12 21:38:50 -07:00
Olaoluwa Osuntokun
82fa030bda
Merge pull request #746 from wpaulino/import-dry-run
wallet: add dry run implementation of ImportAccount
2021-05-06 18:27:17 -07:00
Wilmer Paulino
5053325946
wallet: add dry run implementation of ImportAccount
This method returns the first N external and internal addresses, which
can be presented to users to confirm whether the account has been
imported correctly.
2021-05-06 16:32:58 -07:00
Olaoluwa Osuntokun
a7a9234968
Merge pull request #734 from bhandras/external_db
wallet: allow using external wallet db
2021-04-29 15:48:04 -07:00
Andras Banki-Horvath
13966db554
waddrmgr: test flake fix 2021-04-29 11:31:04 +02:00
Andras Banki-Horvath
98ba16748e
loader: add txn callback when wallet is created 2021-04-28 17:44:11 +02:00
Andras Banki-Horvath
a795db6b12
wallet: support for external wallet DB 2021-04-28 17:44:10 +02:00
Olaoluwa Osuntokun
0b7de5efbb
Merge pull request #735 from guggero/signet
Update btcd dependency, add Signet params
2021-04-27 17:04:10 -07:00
Olaoluwa Osuntokun
cf6b7830cb
Merge pull request #744 from wpaulino/pruned-node-getnodeaddresses
chain: implement GetNodeAddresses fallback for PrunedBlockDispatcher
2021-04-27 16:43:14 -07:00
Andras Banki-Horvath
c6f007b74a
walletdb: add ForEachBucket to the ReadTx with bbolt implementation
This commit extends the ReadTx (and ReadWriteTx) interface with
ForEachBucket which can be used to iterate through all top level
buckets. This is a missing piece from the walletdb abstraction which
will allow us to iterate all keys in a walletdb opening the possibility
to build generic tools to browse and edit walletdb files regardless of
the underlying driver.
2021-04-27 11:14:43 +02:00
Oliver Gugger
1f1ffb56b5
multi: add signet params
With this commit we add the signet test network parameters to all switch
cases where we distinguish between the different networks.
2021-04-27 09:59:14 +02:00
Oliver Gugger
c7c36be14b
build: update btcd dependency 2021-04-27 09:15:55 +02:00
Wilmer Paulino
526d132f09
chain: implement GetNodeAddresses fallback for PrunedBlockDispatcher
It's possible for bitcoind instances to only have connections to pruned
nodes after its initial block download, which are incompatible with the
PrunedBlockDispatcher. This would result in GetBlock requests for pruned
blocks to never resolve. Since bitcoind also exposes a GetNodeAddresses
RPC, which returns random reachable addresses from its address manager,
we can leverage it to obtain a new candidate set of peers that we
otherwise wouldn't obtain through GetPeers.
2021-04-23 13:28:56 -07:00
Wilmer Paulino
f7241cd95f
chain: prevent logging of ping/pong msgs in PrunedBlockDispatcher
These messages are also part of normal operation, so we should log
stating they are unexpected.
2021-04-23 13:28:55 -07:00
Wilmer Paulino
61d3b2da6d
chain: use correct pruned node service bit 2021-04-23 13:28:55 -07:00
Olaoluwa Osuntokun
50978fcf79
Merge pull request #743 from wpaulino/simnet-account-import
waddrmgr+wallet: allow account import for simnet wallets
2021-04-20 19:19:04 -07:00
Wilmer Paulino
0388171622
build: bump goacc commit
Addresses an issue with the previous version where one of its
dependencies was removed:

go: github.com/ory/x@v0.0.216 requires
        github.com/ory/cli@v0.0.49 requires
        github.com/ory/kratos@v0.5.5-alpha.1.0.20210319103511-3726ed4d145a requires
        github.com/ory/kratos/corp@v0.0.0-00010101000000-000000000000: invalid version: unknown revision 000000000000
2021-04-20 14:54:57 -07:00
Wilmer Paulino
e1dfc4d1b7
waddrmgr+wallet: allow account import for simnet wallets
Simnet was previously left out as it didn't have defined HD versions for
some of our key scopes. To allow testing importing accounts into simnet
wallets, we fall back to use the mainnet HD versions.

This commit also addresses an issue with simnet wallets that would arise
whenever ScopedKeyManager.AccountProperties was invoked:

`failed to retrieve account public key: unsupported net SimNet`
2021-04-14 17:21:07 -07:00
Olaoluwa Osuntokun
fe61cc5d78
Merge pull request #742 from wpaulino/bitcoind-conn-atomic-alignment
chain: fix alignment of atomic integers in bitcoind conn struct
2021-04-13 15:30:01 -07:00
Olaoluwa Osuntokun
2ff451f6bc
chain: fix alignment of atomic integers in bitcoind conn struct
As reported by https://github.com/lightningnetwork/lnd/issues/5196, the
new atomic integer isn't properly aligned which can caus panics on
32-bit operating systems.. Tof fix this issue, we move the 64-bit
integer to lay after the two 32-bit integers at the top of the struct.
2021-04-11 16:32:45 -07:00
Olaoluwa Osuntokun
683061f797
Merge pull request #737 from wpaulino/block-from-network
chain: request pruned blocks from backend peers
2021-04-05 13:14:49 -07:00
Wilmer Paulino
20c02df1e3
chain: request pruned blocks from backend peers
At the moment, this is only done for the BitcoindClient, as the other
backends don't support block pruning.
2021-04-02 17:28:07 -07:00
Wilmer Paulino
3fed46822c
chain: refactor BitcoindConn init params into config struct 2021-04-02 17:28:06 -07:00
Wilmer Paulino
178d124b76
chain: add PrunedBlockDispatcher implementation
To minimally support wallets connected to pruned nodes, we add a new
subsystem that can be integrated with chain clients to request blocks
that the server has already pruned. This is done by connecting to the
server's full node peers and querying them directly. Ideally, this is a
capability supported by the server, though this is not yet possible with
bitcoind.
2021-04-02 17:28:05 -07:00
Wilmer Paulino
e3523abe7b
build: update btcd dependency
This exposes the new AllowSelfConns config option allowing external
testing of peer.Peer.
2021-04-02 17:28:03 -07:00
Olaoluwa Osuntokun
e0607006dc
Merge pull request #733 from wpaulino/watch-only-account-utils
waddrmgr+wallet: support transaction creation and signing for watch-only accounts
2021-03-29 16:32:42 -07:00
Wilmer Paulino
02fedd6780
build: remove goveralls 2021-03-29 16:01:27 -07:00
Wilmer Paulino
b9b4d4efe1
wallet: include redeem script for NP2WKH inputs in PSBT generation
This allows external signers to properly sign NP2WKH inputs.

Co-authored-by: Oliver Gugger <gugger@gmail.com>
2021-03-29 16:00:53 -07:00
Wilmer Paulino
b318e99f4f
wallet: extend ChangeSource to support all key scopes 2021-03-29 16:00:53 -07:00
Wilmer Paulino
ddbe5ecee4
wallet: expose AccountPropertiesByName 2021-03-29 16:00:52 -07:00
Wilmer Paulino
bbd7f8f887
waddrmgr+wallet: expose LookupAccount
This exposes a mapping of account name to its corresponding key scope
and internal account number to facilitate the use of external APIs by
users.
2021-03-29 16:00:51 -07:00
Wilmer Paulino
a180b0fcaa
wallet: allow filtering of transactions by account 2021-03-29 16:00:50 -07:00
Wilmer Paulino
f5845dfb42
wallet: prevent input signing for transactions on watch-only accounts
Watch-only accounts don't have any type of private key information
stored, so we avoid populating input signatures in those cases.
2021-03-29 16:00:49 -07:00
Wilmer Paulino
2301069644
wallet: require key scope of account for transaction creation methods
Now that we're able to fund transactions from multiple accounts within
different key scopes, we extend our transaction creation methods to
accept a key scope parameter as well, to determine the correct account
to select inputs from.
2021-03-29 16:00:48 -07:00
Wilmer Paulino
7fa80abc44
waddrmgr: include master key fingerprint in derivation path
Following the previous commit, some external hardware signers require a
master key fingerprint to be present within the PSBT input derivation
paths so that the signer can recognize which inputs are relevant and
must be signed.
2021-03-29 16:00:47 -07:00
Wilmer Paulino
35b4b237c9
wallet: include BIP 32 derivation paths for inputs in PSBTs
Watch-only accounts are usually backed by an external hardware signer,
some of which require derivation paths to be populated for each relevant
input to sign.
2021-03-29 16:00:46 -07:00
Olaoluwa Osuntokun
07d4cc155e
Merge pull request #738 from guggero/build-improvement
Add Makefile, use golangci-lint
2021-03-29 15:55:46 -07:00
Oliver Gugger
371f7a583d
appveyor: remove appveyor configuration
This configuration to run the checks on appveyor looks very old and
unused since it still refers to glide for dependency management. We
remove the file as it no longer serves a purpose.
2021-03-24 14:44:33 +01:00
Oliver Gugger
8d9d0b9001
Travis: use make commands instead of goclean.sh
Now that we have a Makefile with all tasks previously executed in
goclean.sh, we no longer need to use that file.
2021-03-24 14:44:33 +01:00
Oliver Gugger
3a5d9f84b0
multi: fix linter issues 2021-03-24 14:44:32 +01:00
Oliver Gugger
ac3ec4fa03
lint: add new linter configuration
We use the golangci-lint in lnd and it has quite a few more detections
enabled than what's in the current gotest.sh script.
We don't start with a given base commit on purpose but instead fix
everything the linter finds in the following commits.
2021-03-24 14:44:32 +01:00
Oliver Gugger
40414fde37
rpc: run make fmt to format all code 2021-03-24 13:45:11 +01:00
Oliver Gugger
41e12c16c5
make: add Makefile
As a preparation to get rid of the clunky to handle goclean.sh, we add a
Makefile that behaves in mostly the same way as does lnd's Makefile.
2021-03-24 13:44:16 +01:00
Olaoluwa Osuntokun
5c08d49e19
Merge pull request #732 from wpaulino/import-account-or-pubkey
wallet: support derived public key import
2021-03-23 18:39:13 -07:00
Wilmer Paulino
f1b329f680
waddrmgr: add TODO to determine proper address type of imported key
For key scopes which have an address schema where the external and
internal branches differ, we always assume that imported keys use the
external address type defined in the scope's address schema. This may
not always be the case however, and should be handled correctly.
Ideally, we generate two addresses per imported key (only if the
external and internal address types differ) and scan for both in the
chain.
2021-03-15 19:27:13 -07:00
Wilmer Paulino
b0a4956231
wallet: add derived public key import
Co-authored-by: Oliver Gugger <gugger@gmail.com>
2021-03-15 19:27:12 -07:00
Wilmer Paulino
9d909110f9
waddrmgr: use proper version for account key of non-watch-only accounts 2021-03-15 19:27:11 -07:00