Commit graph

22 commits

Author SHA1 Message Date
Andrew Poelstra
18986689be Merge 907d636e5e into merged_master (Bitcoin PR bitcoin/bitcoin#21353) 2021-07-21 20:30:59 +00:00
Andrew Poelstra
f2bd5dd18b Merge f0b457212f into merged_master (Bitcoin PR #21467) 2021-07-27 01:26:50 +00:00
Andrew Poelstra
770892540f Merge 6664211be2 into merged_master (Bitcoin PR #21574) 2021-06-29 22:00:51 +00:00
Andrew Poelstra
833ebac2fb Merge aa69471ecd into merged_master (Bitcoin PR #21572) 2021-06-29 21:16:38 +00:00
Andrew Poelstra
d20af8f9ea Merge 602b038d43 into merged_master (Bitcoin PR #21366) 2021-06-29 00:32:18 +00:00
Andrew Poelstra
8c54b98b25 Merge e0bc27a14c into merged_master (Bitcoin PR #21404) 2021-06-26 22:39:09 +00:00
Andrew Poelstra
578ee6183f Merge a9335e4f12 into merged_master (Bitcoin PR #16546)
There are a few layers of bullshit to this PR.

First, there is the fact that it adds a functional test gated on a new
config flag which is disabled by default, so it actually adds broken
code with no tests, waiting to ruin your day 520 PRs later when #21935
enables the broken test.

Second, the test appears to be superficially nonsensical because it
generates two transactions from different wallets and tries to compare
them for byte-for-byte equality, which doesn't make sense (at least)
because change outputs are randomly located...so something fishy is
going on.

Of course, in Elements the transactions are *not* equal half the time
because the outputs are permuted, which may have let me quickly figure
out the issue, except...

Third, there is a red herring of a bug where the two transactions have
slightly different feerates. This turns out to be caused by
CWallet::CalculateMaximumSignedTxSize using differently sized dummy
transactions depending on whether watchonly outputs are included (this
fact is conveniently disguised by #17211 slightly changing this logic;
this is an unmerged PR in Core that Elements has a backport of an old
version of). And the two wallets have different watchonly settings.

A sub-red-herring is the fact that this bug results in a discrepancy
of 0.25 vbytes, so it does not appear in Core but does appear in
Elements (there is a 3/16 probability that we should be so unlucky...
we are).

But this is all irrelevant, because...

Fourth, this test is actually super bullshit. The way it works is by
constructing a PSBT legitimately, saving this to disk, then re-"signs"
using the external signer interface by using a mock signer that
COMPLETELY REPLACES THE TRANSACTION UNDER CONSTRUCTION. So it doesn't
matter what the fee output looks like and it doesn't matter what the
order of the outputs. Core does not detect this malfeasance and
neither does Elements. For some reason, Core has a functional test
that explicitly checks that you can do this even though it is insane
and it is hard to think of non-malicious reasons to do it.

Fifth, while Elements fails to detect that its external signer is
actually changing the transaction out from under it, it DOES assume
that this won't happen. In CWallet::SignPSBT it blithely un-replaces
the transaction, which undermines the functional test.

Sixth, the original PR where this test was introduced has comments
locked, so anyone who spent six hours reverse-engineering this idiotic
broken test, and is still feeling charitable enough to discuss it with
the Core developors, can go pound sand.

Anyway, just disabled the broken test and move on with our lives.
2021-07-27 00:19:01 +00:00
Andrew Poelstra
0cabbc6b4a Merge ffc4d04990 into merged_master (Bitcoin PR #20275)
As always, `git diff HEAD^ HEAD^2 -- <filename>` is your friend when understanding conflicts..
2021-06-14 01:22:11 +00:00
Andrew Poelstra
34db56ae3a Merge 9385549a31 into merged_master (Bitcoin PR #20581) 2021-06-11 13:09:57 +00:00
Andrew Poelstra
1521881ad8 Merge 24e4857b29 into merged_master (Bitcoin PR #20494) 2021-06-10 18:09:55 +00:00
W. J. van der Laan
907d636e5e
Merge bitcoin/bitcoin#21353: interfaces: Stop exposing wallet destdata to gui
f5ba424cd4 wallet: Add IsAddressUsed / SetAddressUsed methods (Russell Yanofsky)
62252c95e5 interfaces: Stop exposing wallet destdata to gui (Russell Yanofsky)
985430d9b2 test: Add gui test for wallet receive requests (Russell Yanofsky)

Pull request description:

  Stop giving GUI access to destdata rows in database. Replace with narrow API just for saving and reading receive request information.

  This simplifies code and should prevent the GUI from interfering with other destdata like address-used status. It also adds some more GUI test coverage.

  There are no changes in behavior.

ACKs for top commit:
  jarolrod:
    tACK f5ba424cd4
  laanwj:
    Code review ACK f5ba424cd4

Tree-SHA512: 5423df4786e537a59013cb5bfb9e1bc29a7ca4b8835360c00cc2165a59f925fdc355907a4ceb8bca0285bb4946ba235bffa7645537a951ad03fd3b4cee17b6b0
2021-06-03 15:57:30 +02:00
Sjors Provoost
b54b2e7b1a
Move external signer out of wallet module
This commit moves the ExternalSigner class and RPC methods out of the wallet module.

The enumeratesigners RPC can be used without a wallet since #21417.
With additional modifications external signers could be used without a wallet in general, e.g. via signrawtransaction.

The signerdisplayaddress RPC is ranamed to walletdisplayaddress because it requires wallet context.
A future displayaddress RPC call without wallet context could take a descriptor argument.

This commit fixes a rpc_help.py failure when configured with --disable-wallet.
2021-04-08 17:56:00 +02:00
Russell Yanofsky
9044522ef7 Drop JSONRPCRequest constructors after #21366
This just makes an additional simplification after #21366 replaced
util::Ref with std::any. It was originally suggested
https://github.com/bitcoin/bitcoin/pull/21366#issuecomment-792044351 but
delayed for a followup. It would have prevented usage bug
https://github.com/bitcoin/bitcoin/pull/21572.
2021-04-07 04:53:26 -04:00
Russell Yanofsky
937fd4a66f Fix wrong wallet RPC context set after #21366
This bug doesn't have any effects currently because it only affects
external signer RPCs which aren't currently using the wallet context,
but it does cause an appveyor failure in a upcoming PR:

https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/38512882

This bug is subtle and could have been avoided if JSONRPCRequest didn't
have constructors that were so loose with type checking.  Suggested
change
https://github.com/bitcoin/bitcoin/pull/21366#issuecomment-792044351
eliminates these and would be a good followup for a future PR.
2021-04-02 12:48:20 -04:00
Sebastian Falbesoner
8dbb87a393 refactor: replace util::Ref by std::any (C++17) 2021-03-29 23:29:42 +02:00
fanquake
3ba2840e7e
scripted-diff: remove MakeUnique<T>()
-BEGIN VERIFY SCRIPT-
git rm src/util/memory.h
sed -i -e 's/MakeUnique/std::make_unique/g' $(git grep -l MakeUnique src)
sed -i -e '/#include <util\/memory.h>/d' $(git grep -l '#include <util/memory.h>' src)
sed -i -e '/util\/memory.h \\/d' src/Makefile.am
-END VERIFY SCRIPT-
2021-03-11 13:45:14 +08:00
Russell Yanofsky
62252c95e5 interfaces: Stop exposing wallet destdata to gui
Stop giving GUI access to destdata rows in database. Replace with narrow
API just for saving and reading receive request information.

This simplifies code and should prevent the GUI from interfering with
other destdata like address-used status.

Note: No user-visible behavior is changing in this commit. New
CWallet::SetAddressReceiveRequest() implementation avoids a bug in
CWallet::AddDestData() where a modification would leave the previous
value in memory while writing the new value to disk. But it doesn't
matter because the GUI doesn't currently expose the ability to modify
receive requests, only to add and erase them.
2021-03-03 10:19:35 -04:00
Sjors Provoost
07b7c940a7
rpc: add external signer RPC files 2021-02-23 14:34:30 +01:00
MarcoFalke
ffc4d04990
Merge #20275: wallet: List all wallets in non-SQLite and non-BDB builds
f3d870fc22 wallet: List all wallets in non-SQLite or non-BDB builds (Russell Yanofsky)
d70dc89e78 refactor: Consolidate redundant wallet database path and exists functions (Russell Yanofsky)
6a7a63644c refactor: Drop call to GetWalletEnv in wallet salvage code (Russell Yanofsky)
6ee9cbdd18 refactor: Replace ListWalletDir() function with ListDatabases() (Russell Yanofsky)
5aaeb6cf87 MOVEONLY: Move IsBDBFile, IsSQLiteFile, and ListWalletDir (Russell Yanofsky)

Pull request description:

  This PR does not change behavior when bitcoin is built normally with both the SQLite and BDB libraries. It just makes non-SQLite and non-BDB builds more similar to the normal build. Specifically:

  - It makes wallet directory lists always include all wallets so wallets don't appear missing depending on the build.

  - It now triggers specific "Build does not support SQLite database format" and "Build does not support Berkeley DB database format" errors if a wallet can't be loaded instead of the more ambiguous and scary "Data is not in recognized format" error.

  Both changes are implemented in the last commit. The previous commits are just refactoring cleanups that make the last commit possible and consolidate and reduce code.

ACKs for top commit:
  achow101:
    ACK f3d870fc22
  promag:
    Tested ACK f3d870fc22. Tested a --without-sqlite build with sqlite wallets.

Tree-SHA512: 029ad21559dbc338b5f351d05113c51bc25bce830f4f4e18bcd82287bc528275347a60249da65b91d252632aeb70b25d057bd59c704bfcaafb9f790bc5b59762
2020-12-12 09:20:11 +01:00
practicalswift
12dcdaaa54 Don't make "in" parameters look like "out"/"in-out" parameters: pass by ref to const instead of ref to non-const 2020-12-06 00:22:40 +00:00
Russell Yanofsky
6ee9cbdd18 refactor: Replace ListWalletDir() function with ListDatabases()
No change to behavior. This is just cleanup after previous MOVEONLY commit to
make db.h list function fit conventions of surrounding functions.
2020-12-04 11:03:28 -04:00
Russell Yanofsky
629a9299b2 Move WalletImpl from interfaces/wallet.cpp to wallet/interfaces.cpp 2020-11-24 10:20:16 -05:00
Renamed from src/interfaces/wallet.cpp (Browse further)