Commit graph

1436 commits

Author SHA1 Message Date
Oliver Gugger
4e131c23d0 waddrmgr: fix test compilation 2022-05-24 03:09:33 -07:00
Olaoluwa Osuntokun
e0c5ce72cf waddrmgr: add new DeriveFromKeyPathCache method for faster key retrieval
In this commit, we add a new method `DeriveFromKeyPathCache` that gives
callers a way to more quickly obtain a private key they know they'll be
using frequently. This method lets a caller avoid the write database
transaction as well as the EC operations to derive the key itself (BIP
32).
2022-05-24 03:09:33 -07:00
Oliver Gugger
4a75796117 wallet+waddrmgr: refactor to use extended key instead of seed
To allow a wallet to be created directly from an extended master root
key (xprv), we move the derivation from seed to extended key to the
loader instead of the address manager itself.
2022-05-24 03:09:33 -07:00
Olaoluwa Osuntokun
6f4c9ce731
Merge pull request #758 from Crypt-iQ/btcd_isdust_08032021
mod+wallet: use btcd/mempool IsDust for calculating mempool dust
2021-08-10 16:44:39 -07:00
eugene
3cb2c46b02
mod+wallet: use btcd/mempool IsDust for calculating mempool dust
We can now get rid of our incorrect dust calculation which did not
give exact values for segwit outputs as it was based on spending a
P2PKH output instead.
2021-08-03 16:42:20 -04:00
Olaoluwa Osuntokun
eebed51155
Merge pull request #757 from guggero/wallet-db-tx
wallet+walletdb: remove manual DB transactions, use custom `View/Update` implementation when provided
2021-08-02 17:40:36 -07:00
Oliver Gugger
a27bab6eb9
walletdb: add View and Update to DB interface
We want to make sure that every database backend has their own
implementation of the View() and Update() methods to make sure any
custom retry/commit/rollback strategies are used even when invoked
through the package-provided View() and Update() functions.
2021-07-29 16:53:09 +02:00
Oliver Gugger
f07fdfb6b9
wallet: refactor txToOutputs to use walletdb.Update
To make sure we don't create any manual DB transactions, we refactor the
txToOutputs method to use walletdb.Update and the new
walletdb.ErrDryRunRollBack error for making sure a rollback is issued.
2021-07-23 12:49:38 +02:00
Oliver Gugger
178152bcd0
wallet: refactor ImportAccountDryRun to use walletdb.Update
To make sure we don't create any manual DB transactions, we refactor the
ImportAccountDryRun method to use walletdb.Update and the new
walletdb.ErrDryRunRollBack error for making sure a rollback is issued.
2021-07-23 12:49:37 +02:00
Oliver Gugger
9c839caddf
walletdb: add new ErrDryRunRollBack error
We need a way to signal that a DB transaction should be rolled back
because its changes were a dry-run only. We add a new specific error for
that case so the automatic rollback on error in the walletdb.View and
walletdb.Update comes to play. But we can still return the result of a
dry-run where we need to by inspecting for this specific error.
2021-07-23 12:49:37 +02:00
Oliver Gugger
33a0a065f9
wallet: use walletdb.Update in FundPsbt
To make sure we don't create any manual DB transactions, we refactor
FundPsbt to use walletdb.Update instead.
2021-07-23 12:49:37 +02:00
Oliver Gugger
60a04006d6
wtxmgr: remove unused functions 2021-07-23 12:49:36 +02:00
Olaoluwa Osuntokun
5e96a26171
Merge pull request #752 from guggero/go-mod-fix
mod: fix submodule versions
2021-07-13 16:08:50 -07:00
Olaoluwa Osuntokun
5649a66307
Merge pull request #751 from LN-Zap/fix-2398
Prevent duplicate notifications for (un)confirmed transactions
2021-07-13 16:05:48 -07:00
Bjarne Magnussen
419381b749
wallet: call InsertTxCheckIfExists to add a relevant tx
Let the method `addRelevantTx` use `InsertTxCheckIfExists` to insert a relevant 
transaction. If the transaction has already been recorded, the method call 
`addRelevantTx` will return early and not proceed with duplicating work of 
checking every output and duplicating the tx notification to the notification 
server.
2021-07-13 09:24:53 +02:00
Olaoluwa Osuntokun
8e18674563
Merge pull request #753 from joostjager/zero-output-psbt
wallet: allow zero output psbt funding
2021-07-12 17:00:24 -07:00
Olaoluwa Osuntokun
aaf03fee73
Merge pull request #754 from joostjager/filter-leases
wtxmgr: filter out expired leases
2021-07-06 16:48:07 -07:00
Joost Jager
5b1e64abde
wtxmgr: filter out expired leases
Expired leases are kept in the database until the next cleaning round.
This commit makes sure that expired leases look like they do not exist
to outside callers.
2021-07-05 08:57:33 +02:00
Joost Jager
9f1d73d6d3
wallet: allow zero output psbt funding
To support the cpfp fee bump use case where no external outputs are
required.
2021-06-28 12:06:36 +02:00
Oliver Gugger
6a822c2bf2
mod: fix submodule versions
The submodules wallet/txauthor and wallet/txsizes were updated without a
new tag being created. This works fine when compiling btcwallet from
source but fails when using "go get" as that ignores the replace
directives.
2021-05-31 09:18:27 +02:00
Bjarne Magnussen
0066eee3ea
wtxmgr: add InsertTxCheckIfExsists to check if a tx already recorded
Adds new error `ErrDuplicateTx` and method `InserTxCheckIfExists` to check if a transaction to be inserted was already recorded.
2021-05-28 14:29:48 +02:00
Olaoluwa Osuntokun
6ab9b61557
Merge pull request #740 from bottlepay/random-coins
wallet: add random coin selection
2021-05-19 15:53:59 -07:00
Joost Jager
0efc499b8c build: extend unit-race timeout 2021-05-19 09:11:31 +02:00
Joost Jager
4d2665ee3a
wallet: add random coin selection 2021-05-19 08:34:55 +02:00
Olaoluwa Osuntokun
c31e149775
Merge pull request #749 from guggero/wasm
internal/prompt: allow compilation in js/wasm environment
2021-05-18 16:50:50 -07:00
Oliver Gugger
825ff779a1
make: increase test timeout to 20 minutes 2021-05-18 13:26:45 +02:00
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