Commit graph

40157 commits

Author SHA1 Message Date
furszy
83b762845f
wallet: batch and simplify ZapSelectTx process
The goal of the function is to erase the wallet transactions that
match the inputted hashes. There is no need to traverse the database,
reading record by record, to then perform single entry removals for
each of them.

To ensure consistency and improve performance, this change-set removes
all tx records within a single atomic db batch operation, as well as
it cleans up code, improves error handling and simplifies the
transactions removal process entirely.

This optimizes the removal of watch-only transactions during the wallet
migration process and the 'removeprunedfunds' RPC command.
2024-02-09 14:54:50 -03:00
Murch
13161ecf03
opt: Skip over barren combinations of tiny UTXOs
Given a lot of small amount UTXOs it is possible that the lookahead
indicates sufficient funds, but any combination of them would push us
beyond the current best_weight.
We can estimate a lower bound for the minimal necessary weight to reach
target from the maximal amount and minimal weight in the tail of the
UTXO pool: if adding a number of hypothetical UTXOs of this maximum
amount and minimum weight would not be able to beat `best_weight`, we
can SHIFT to the omission branch, and CUT if the last selected UTXO is
not heavier than the minimum weight of the remainder.
2024-02-09 11:03:18 +01:00
Murch
b7672c7cdd opt: Skip checking max_weight separately
Initialize `best_selection_weight` as `max_weight` allows us to skip the
separate `max_weight` check on every loop.
2024-02-09 10:58:44 +01:00
Murch
1edd2baa37 opt: Cut if last addition was minimal weight
In situations where we have UTXO groups of various weight, we can CUT
rather than SHIFT when we exceeded the max_weight or the best
selection’s weight while the last step was equal to the minimum weight
in the lookahead.
2024-02-09 10:58:43 +01:00
Murch
5248e2a60d opt: Skip heavier UTXOs with same effective value
When two successive UTXOs differ in weight but match in effective value,
we can skip the second if the first is not selected, because all input
sets we can generate by swapping out a lighter UTXOs with a heavier UTXO
of matching effective value would be strictly worse.
2024-02-09 10:58:17 +01:00
Murch
9124c73742 opt: Tiebreak UTXOs by weight for CoinGrinder 2024-02-09 10:58:17 +01:00
Murch
451be19dc1 opt: Skip evaluation of equivalent input sets
When two successive UTXOs match in effective value and weight, we can
skip the second if the prior is not selected: adding it would create an
equivalent input set to a previously evaluated.

E.g. if we have three UTXOs with effective values {5, 3, 3} of the same
weight each, we want to evaluate
{5, _, _}, {5, 3, _}, {5, 3, 3}, {_, 3, _}, {_, 3, 3},
but skip {5, _, 3}, and {_, _, 3}, because the first 3 is not selected,
and we therefore do not need to evaluate the second 3 at the same
position in the input set.

If we reach the end of the branch, we must SHIFT the previously selected
UTXO group instead.
2024-02-09 10:58:15 +01:00
Murch
407b1e3432 opt: Track remaining effective_value in lookahead
Introduces a dedicated data structure to track the total
effective_value available in the remaining UTXOs at each index of the
UTXO pool. In contrast to the approach in BnB, this allows us to
immediately jump to a lower index instead of visiting every UTXO to add
back their eff_value to the lookahead.
2024-02-09 10:51:17 +01:00
Murch
5f84f3cc04 opt: Skip branches with worse weight
Once we exceed the weight of the current best selection, we can always
shift as adding more inputs can never yield a better solution.
2024-02-09 10:50:53 +01:00
Murch
d68bc74fb2 fuzz: Test optimality of CoinGrinder
Co-authored-by: Pieter Wuille <pieter@wuille.net>
2024-02-09 10:50:10 +01:00
Murch
67df6c629a fuzz: Add CoinGrinder fuzz target 2024-02-09 10:50:10 +01:00
Murch
1502231229 coinselection: Track whether CG completed
CoinGrinder may not be able to exhaustively search all potentially
interesting combinations for large UTXO pools, so we keep track of
whether the search was terminated by the iteration limit.
2024-02-09 10:50:10 +01:00
Murch
7488acc646 test: Add coin_grinder_tests 2024-02-09 10:48:57 +01:00
Murch
6cc9a46cd0 coinselection: Add CoinGrinder algorithm
CoinGrinder is a DFS-based coin selection algorithm that
deterministically finds the input set with the lowest weight creating a
change output.
2024-02-09 10:44:32 +01:00
Hernan Marino
8d20602e55 test, assumeutxo: Add test to ensure failure when mempool not empty 2024-02-09 00:30:17 -03:00
Ava Chow
b2b2b1e9e4
Merge bitcoin/bitcoin#28996: test: maxuploadtarget: check for mempool msg disconnect if limit is reached, improve existing test coverage
b58f009d95 test: check that mempool msgs lead to disconnect if uploadtarget is reached (Sebastian Falbesoner)
dd5cf38818 test: check for specific disconnect reasons in feature_maxuploadtarget.py (Sebastian Falbesoner)
73d7372115 test: verify `-maxuploadtarget` limit state via `getnettotals` RPC result (Sebastian Falbesoner)

Pull request description:

  This PR improves existing and adds new test coverage for the `-maxuploadtarget` mechanism (feature_maxuploadtarget.py) in the following ways, one commit each:
  * verify the uploadtarget state via the `getnettotals` RPC (`uploadtarget` result field):
  160d23677a/src/rpc/net.cpp (L581-L582)
  Note that reaching the total limit (`target_reached` == True) always implies that the historical blocks serving limits is also reached (`serve_historical_blocks` == False), i.e. it's impossible that both flags are set to True.

  * check for peer's specific disconnect reason (in this case, `"historical block serving limit reached, disconnect peer"`):
  160d23677a/src/net_processing.cpp (L2272-L2280)

  * add a test for a peer disconnect if the uploadtarget is reached and a `mempool` message is received (if bloom filters are enabled):
  160d23677a/src/net_processing.cpp (L4755-L4763)
  Note that another reason for disconnect after receiving a MEMPOOL msg of a peer is if bloom filters are disabled on the node. This case is already covered in the functional test `p2p_nobloomfilter_messages.py`.

ACKs for top commit:
  maflcko:
    lgtm ACK b58f009d95
  achow101:
    ACK b58f009d95
  sr-gi:
    tACK [b58f009](b58f009d95)

Tree-SHA512: 7439134129695c9c3a7ddc5e39f2ed700f91e7c91f0b7a9e0a783f275c6aa2f9918529cbfd38bb37f9139184e05e0f0354ef3c3df56da310177ec1d6b48b43d0
2024-02-08 19:31:23 -05:00
Ava Chow
0b3202d8ef
Merge bitcoin/bitcoin#29377: test: Add makefile target for running unit tests
5ca9b24da1 test: Add makefile target for running unit tests (TheCharlatan)

Pull request description:

  `make check` runs a bunch of other subtree tests that exercise code that is hardly ever changed and have a comparatively long runtime. There seems to be no target for running just the unit tests, so add one.

  Alternatively the secp256k1 tests could be removed from the `check-local` target, reducing its runtime. This was rejected before though in https://github.com/bitcoin/bitcoin/pull/20264.

ACKs for top commit:
  delta1:
    utACK 5ca9b24da1
  edilmedeiros:
    Tested ACK 5ca9b24da1
  achow101:
    ACK 5ca9b24da1
  ryanofsky:
    Tested ACK 5ca9b24da1.

Tree-SHA512: 470969d44585d7cc33ad038a16e791db9e2be8469f52ddf122c46f20776fad34e6a48f988861a132c42540158fed05f3cf66fcc3bea05708253daaa35af54339
2024-02-08 18:01:46 -05:00
Ava Chow
5cdf31343b
Merge bitcoin/bitcoin#29372: test: fix intermittent failure in rpc_setban.py --v2transport, run it in CI
cc87ee4c39 test: fix intermittent failure in rpc_setban.py --v2transport (Martin Zumsande)

Pull request description:

  This test failed for me on master locally:
  The reason is that when initiating a v2 connection and being immediately disconnected, a node cannot know if the disconnect happens because the peer only supports v1, or because it has banned you, so it schedules to reconnect with v1. If the test doesn't wait for that, the reconnect can happen at a bad time, resulting in failure in a later `connect_nodes` call.
  Also add the test with `--v2transport` to the test runner because banning with v2 seems like a useful thing to have test coverage for.

ACKs for top commit:
  delta1:
    tested ACK cc87ee4c39
  epiccurious:
    Concept ACK cc87ee4c39.
  achow101:
    ACK cc87ee4c39
  stratospher:
    tested ACK cc87ee4. nice find!

Tree-SHA512: ae234d9b771d9c9c11501ddd93c99cf93257c999de3da62280d4d51806cd246b289c10a5f41fa7d5651b2fb4fdaee753f5b2d6939a99f89d71aa012af4a4d231
2024-02-08 17:57:03 -05:00
glozow
29029df5c7 [doc] v3 signaling in mempool-replacements.md 2024-02-08 21:50:55 +00:00
glozow
e643ea795e [fuzz] v3 transactions and sigop-adjusted vsize
Ensure we are checking sigop-adjusted virtual size by creating setups
and packages where sigop cost is larger than bip141 vsize.

Co-authored-by: Gregory Sanders <gsanders87@gmail.com>
2024-02-08 21:50:55 +00:00
glozow
1fd16b5c62 [functional test] v3 transaction submission
Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
Co-authored-by: Gregory Sanders <gsanders87@gmail.com>
2024-02-08 21:50:55 +00:00
MarcoFalke
27c8786ba9 test framework: Add and use option for tx-version in MiniWallet methods 2024-02-08 21:50:55 +00:00
glozow
9a1fea55b2 [policy/validation] allow v3 transactions with certain restrictions
Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
2024-02-08 21:50:55 +00:00
glozow
eb8d5a2e7d [policy] add v3 policy rules
Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
2024-02-08 21:50:55 +00:00
Ava Chow
2bd0bf7cd9
Merge bitcoin/bitcoin#27319: addrman, refactor: improve stochastic test in AddSingle
e064487ca2 addrman, refactor: improve stochastic test in `AddSingle` (brunoerg)

Pull request description:

  This PR changes this algorithm to be O(1) instead of O(n). Also, in the current implementation, if `pinfo->nRefCount` is 0, we created an unnecessary variable (`nFactor`), this changes it. the change is relatively simple and does not cause conflicts.

ACKs for top commit:
  achow101:
    ACK e064487ca2
  amitiuttarwar:
    ACK e064487ca2
  stratospher:
    ACK e064487ca2. simple use of << instead of a loop, didn't observe any behaviour difference before and after.

Tree-SHA512: ff0a65155e47f65d2ce3cb5a3fd7a86efef1861181143df13a9d8e59cb16aee9be2f8801457bba8478b17fac47b015bff5cc656f6fac2ccc071ee7178a38d291
2024-02-08 13:49:15 -05:00
Ava Chow
ecbf4bae9c
Merge bitcoin/bitcoin#29114: util: Faster std::byte (pre)vector (un)serialize
fab41697a5 Allow int8_t optimized vector serialization (MarcoFalke)
facaa14785 Faster std::byte (pre)vector (un)serialize (MarcoFalke)

Pull request description:

  Currently, large vectors of `std::byte` are (un)serialized byte-by-byte, which is slow. Fix this, by enabling the already existing optimization for them.

  On my system this gives a 10x speedup for `./src/bench/bench_bitcoin --filter=PrevectorDeserializeTrivial`, when `std::byte` are used:

  ```diff
  diff --git a/src/bench/prevector.cpp b/src/bench/prevector.cpp
  index 2524e215e4..76b16bc34e 100644
  --- a/src/bench/prevector.cpp
  +++ b/src/bench/prevector.cpp
  @@ -17,7 +17,7 @@ struct nontrivial_t {
   static_assert(!std::is_trivially_default_constructible<nontrivial_t>::value,
                 "expected nontrivial_t to not be trivially constructible");

  -typedef unsigned char trivial_t;
  +typedef std::byte trivial_t;
   static_assert(std::is_trivially_default_constructible<trivial_t>::value,
                 "expected trivial_t to be trivially constructible");

  ```

  However, the optimization does not cover `signed char`. Fix that as well.

ACKs for top commit:
  sipa:
    utACK fab41697a5
  achow101:
    ACK fab41697a5
  TheCharlatan:
    ACK fab41697a5

Tree-SHA512: a3e20f375fd1d0e0dedb827a8ce528de1173ea69660c8c891ad1343a86b422072f6505096fca0d3f8af4442fbe1378a02e32d5974919d4e88ff06934d0258cba
2024-02-08 13:30:31 -05:00
brunoerg
864e2e9097 fuzz: increase length of string used for NetWhitelist{bind}Permissions::TryParse 2024-02-08 15:09:03 -03:00
Hennadii Stepanov
0471aee507
Merge bitcoin/bitcoin#29397: release: Update translations for v27.0 soft translation string freeze
71927b24e5 qt: Update translation source file (Hennadii Stepanov)
4d0b0bf225 qt: Bump Transifex slug for 27.x (Hennadii Stepanov)
42cbf561a7 qt: Translation updates from Transifex (Hennadii Stepanov)

Pull request description:

  This PR follows our [Release Process](https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md).

  Required to open Transifex translations for v27.0 as it's scheduled in https://github.com/bitcoin/bitcoin/issues/29028.

  The previous similar PR: https://github.com/bitcoin/bitcoin/pull/28383.

ACKs for top commit:
  jarolrod:
    ACK 71927b24e5
  johnny9:
    ACK 71927b24e5

Tree-SHA512: 9492ffc39518fc4e519cdf9bc558b1f17325b27f17e3bfba0c11e54af13c2d98ca08d9bad51880d0b577f855f95fd0c4bd8e35570336f16a5b154597737f3943
2024-02-08 15:59:53 +00:00
Ava Chow
835948d44b
Merge bitcoin/bitcoin#26836: wallet: batch and simplify addressbook migration process
86960cdb7f wallet: migration, batch addressbook records removal (furszy)
342c45f80e wallet: addressbook migration, batch db writes (furszy)
595bbe6e81 refactor: wallet, simplify addressbook migration (furszy)
d0943315b1 refactor: SetAddressBookWithDB, minimize number of map lookups (furszy)
bba4f8dcb5 refactor: SetAddrBookWithDB, signal only if write succeeded (furszy)
97b0753923 wallet: clean redundancies in DelAddressBook (furszy)

Pull request description:

  Commits decoupled from #28574, focused on the address book cloning process

  Includes:

  1) DB batch operations and flow simplification for the address book migration process.
  2) Code improvements to `CWallet::DelAddressBook` and `Wallet::SetAddrBookWithDB` methods.

  These changes will let us consolidate all individual write operations that take place during the wallet migration process into a single db txn in the future.

ACKs for top commit:
  achow101:
    ACK 86960cdb7f
  josibake:
    reACK 86960cdb7f

Tree-SHA512: 10c941df3cd84fd8662b9c9ca6a1ed2c7402d38c677d2fc66b8b6c9edc6d73e827a5821487bbcacb5569d502934fa548fd10699e2ec45185f869e43174d8b2a1
2024-02-08 09:05:00 -05:00
Ryan Ofsky
801ef07ebd
Merge bitcoin/bitcoin#29112: sqlite: Disallow writing from multiple SQLiteBatchs
cfcb9b1ecf test: wallet, coverage for concurrent db transactions (furszy)
548ecd1155 tests: Test for concurrent writes with db tx (Ava Chow)
395bcd2454 sqlite: Ensure that only one SQLiteBatch is writing to db at a time (Ava Chow)

Pull request description:

  The way that we have configured SQLite to run means that only one database transaction can be open at a time. Typically, each individual read and write operation will be its own transaction that is opened and committed automatically by SQLite. However, sometimes we want these operations to be batched into a multi-statement transaction, so `SQLiteBatch::TxnBegin`, `SQLiteBatch::TxnCommit`, and `SQLiteBatch::TxnAbort` are used to manage the transaction of the database.

  However, once a db transaction is begun with one `SQLiteBatch`, any operations performed by another `SQLiteBatch` will also occur within the same transaction. Furthermore, those other `SQLiteBatch`s will not be expecting a transaction to be active, and will abort it once the `SQLiteBatch` is destructed. This is problematic as it will prevent some data from being written, and also cause the `SQLiteBatch` that opened the transaction in the first place to be in an unexpected state and throw an error.

  To avoid this situation, we need to prevent the multiple batches from writing at the same time. To do so, I've implemented added a `CSemaphore` within `SQLiteDatabase` which will be used by any `SQLiteBatch` trying to do a write operation. `wait()` is called by `TxnBegin`, and at the beginning of `WriteKey`, `EraseKey`, and `ErasePrefix`. `post()` is called in `TxnCommit`, `TxnAbort` and at the end of `WriteKey`, `EraseKey`, and `ErasePrefix`. To avoid deadlocking on ` TxnBegin()` followed by a `WriteKey()`, `SQLiteBatch will now also track whether a transaction is in progress so that it knows whether to use the semaphore.

  This issue is not a problem for BDB wallets since BDB uses WAL and provides transaction objects that must be used if an operation is to occur within a transaction. Specifically, we either pass a transaction pointer, or a nullptr, to all BDB operations, and this allows for concurrent transactions so it doesn't have this problem.

  Fixes #29110

ACKs for top commit:
  josibake:
    ACK cfcb9b1ecf
  furszy:
    ACK cfcb9b1ecf
  ryanofsky:
    Code review ACK cfcb9b1ecf. This looks great and I think it is ready for merge. Just holding off because josibake seemed ready to review https://github.com/bitcoin/bitcoin/pull/29112#issuecomment-1930372190 and might have more feedback.

Tree-SHA512: 2dd5a8e76df52451a40e0b8a87c7139d68a0d8e1bf2ebc79168cc313e192dab87cfa4270ff17fea4f7b370060d3bc9b5d294d50f7e07994d9b5a69b40397c927
2024-02-07 21:46:06 -05:00
furszy
86960cdb7f
wallet: migration, batch addressbook records removal
Instead of doing one db transaction per removed record,
we now batch all removals in a single db transaction.

Speeding up the process and preventing the wallet from entering
an inconsistent state when any of the intermediate writes fail.
2024-02-07 18:15:38 -03:00
furszy
342c45f80e
wallet: addressbook migration, batch db writes
Optimizing the process performance and consistency.
2024-02-07 18:15:38 -03:00
furszy
595bbe6e81
refactor: wallet, simplify addressbook migration
Same process written in a cleaner manner.
Removing code duplication.
2024-02-07 18:15:38 -03:00
furszy
d0943315b1
refactor: SetAddressBookWithDB, minimize number of map lookups 2024-02-07 18:15:38 -03:00
furszy
bba4f8dcb5
refactor: SetAddrBookWithDB, signal only if write succeeded 2024-02-07 18:15:38 -03:00
furszy
97b0753923
wallet: clean redundancies in DelAddressBook
1) Encode destination only once (instead of three).
2) Fail if the entry's linked data cannot be removed.
3) Don't remove entry from memory if db write fail.
4) Notify GUI only if removal succeeded
2024-02-07 18:11:51 -03:00
Hennadii Stepanov
60ac503800
Merge bitcoin-core/gui#497: Enable users to configure their monospace font specifically
a17fd33edd GUI: OptionsDialog: Replace verbose two-option font selector with simple combobox with Custom... choice (Luke Dashjr)
98e9ac5199 GUI: Use FontChoice type in OptionsModel settings abstraction (Luke Dashjr)
3a6757eed9 GUI: Load custom FontForMoney from QSettings (Luke Dashjr)
49eb97eff9 GUI: Add possibility for an explicit QFont for FontForMoney in OptionsModel (Luke Dashjr)
f2dfde80b8 GUI: Move "embedded font or not" decision into new OptionsModel::getFontForMoney method (Luke Dashjr)

Pull request description:

  This replaces the overly-verbose radio-button font setting (which only allows embedded or autodetected from system) with a simple combobox providing both existing options as well as a custom option to allow the user to select any font of their choice/style.

ACKs for top commit:
  pablomartin4btc:
    tested ACK  a17fd33edd
  hebasto:
    ACK a17fd33edd, I have reviewed the code and tested it on Ubuntu 22.04. This is a UX improvement. https://github.com/bitcoin-core/gui/pull/497#issuecomment-1341222673 might be addressed in a follow-up.

Tree-SHA512: 2f0a8bc1242a374c4b7dc6e34014400428b6d36063fa0b01c9f62a8bd6078adfbbca93d95c87e4ccb580d982fe10173e1d9a28bcec586591dd3f966c7b90fc5d
2024-02-07 19:28:37 +00:00
Hennadii Stepanov
7b39702513
Merge bitcoin-core/gui#553: Change address / amount error background
fe7c81e34e qt: change QLineEdit error background (w0xlt)

Pull request description:

  This PR proposes a small change in QLineEdit when there is an error in the input.

  master |
  --- |
  ![image](https://user-images.githubusercontent.com/94266259/154762427-b816267e-ec70-4a8f-a7fb-1317ebacf1a4.png)

  PR |
  --- |
  ![image](https://user-images.githubusercontent.com/94266259/154761933-15eb3d81-ca81-4498-b8ec-cf1139ae2f8a.png) |

  This also shows good results when combined with other open PRs.

  #537 |
  --- |
  ![image](https://user-images.githubusercontent.com/94266259/154763411-6266a283-2d8a-4365-b3f2-a5cb545e773e.png)

  #533 |
  --- |
  ![image](https://user-images.githubusercontent.com/94266259/154765638-f38b13d6-a4f8-4b46-a470-f882668239f3.png) |

ACKs for top commit:
  GBKS:
    ACK fe7c81e
  jarolrod:
    ACK fe7c81e34e
  shaavan:
    ACK fe7c81e34e

Tree-SHA512: eccc53f42d11291944ccb96efdbe460cb10af857f1d4fa9b5348ddcb0796c82faf1cdad9040aae7a25c5d8f4007d6284eba868d7af14acf56280f6acae170b91
2024-02-07 18:03:11 +00:00
fanquake
6737331c4c
Merge bitcoin/bitcoin#29363: test: Fix CPartialMerkleTree.nTransactions signedness
facafa90f7 test: Fix CPartialMerkleTree.nTransactions signedness (MarcoFalke)

Pull request description:

  It is unsigned in Bitcoin Core, so the tests should match it:

  aa9231fafe/src/merkleblock.h (L59)

  Large positive values, or "negative" values, are rejected anyway, but it still seems fine to fix this.

  The bug was introduced when the code was written in d280617bf5.

  (Lowercase `i` means signed, see https://docs.python.org/3/library/struct.html#format-characters)

ACKs for top commit:
  theStack:
    LGTM ACK facafa90f7
  Empact:
    ACK facafa90f7

Tree-SHA512: 35ac11bb5382dffe132bfae6097efc343ef6c06b1b4b1545130ca27b228ca6894679004862fee921b095172abaddbef5972c24d9bc195ce970f35643bd4a0f09
2024-02-07 15:08:02 +00:00
MarcoFalke
fa0ceae970
test: Fix utxo set hash serialisation signedness 2024-02-07 11:47:17 +01:00
Hennadii Stepanov
71927b24e5
qt: Update translation source file
The diff is generated by executing `make -C src translate`.
2024-02-07 09:40:41 +00:00
Hennadii Stepanov
4d0b0bf225
qt: Bump Transifex slug for 27.x 2024-02-07 09:24:32 +00:00
Hennadii Stepanov
42cbf561a7
qt: Translation updates from Transifex
The diff is generated by executing the `update-translations.py` script.
2024-02-07 09:23:42 +00:00
Ryan Ofsky
5b8990a1f3
Merge bitcoin/bitcoin#29388: fuzz: remove unused args and context from FuzzedWallet
b14298c5bc fuzz: remove unused `args` and `context` from `FuzzedWallet` (brunoerg)

Pull request description:

  `ArgsManager args` and `WalletContext context` were previously used to create the wallet into `FuzzedWallet`. After fa15861763, they are not used anymore. This PR removes them.

ACKs for top commit:
  maflcko:
    lgtm ACK b14298c5bc
  epiccurious:
    utACK b14298c5bc
  ryanofsky:
    Code review ACK b14298c5bc

Tree-SHA512: 164e6a66ba05e11176a0cf68db6257f0ac07459cf7aa01ec4302b303c156c205a68128373a0b8daba0a6dfbff990af7fa14465a6341a296312fb20ea778c7a8c
2024-02-06 19:45:04 -05:00
Ava Chow
592e01398e
Merge bitcoin/bitcoin#28833: wallet: refactor: remove unused SignatureData instances in spkm's FillPSBT methods
e2ad343f69 wallet: remove unused `SignatureData` instances in spkm's `FillPSBT` methods (Sebastian Falbesoner)

Pull request description:

  These are filled with signature data from a PSBT input, but not used anywhere after, hence they can be removed. Note that the same code is in the `SignPSBTInput` function where the `sigdata` result is indeed used.

ACKs for top commit:
  achow101:
    ACK e2ad343f69
  brunoerg:
    crACK e2ad343f69

Tree-SHA512: f0cabcc000bcea6bc7d7ec9d3be2e2a8accbdbffbe35252250ea2305b65a5813fde2b8096fbdd2c7cccdf417ea285183dc325fc2d210d88bce62978ce642930e
2024-02-06 13:35:41 -05:00
Ava Chow
03d95cc630
Merge bitcoin/bitcoin#29375: wallet: remove unused 'accept_no_keys' arg from decryption process
2bb25ce502 wallet: remove unused 'accept_no_keys' arg from decryption process (furszy)

Pull request description:

  Found it while reviewing other PR. Couldn't contain myself from cleaning it up.

  The wallet decryption process (`CheckDecryptionKey()` and `Unlock()`)
  contains an arg 'accept_no_keys,' introduced in #13926, that has
  never been used.
  Additionally, this also removes the unimplemented `SplitWalletPath`
  function.

ACKs for top commit:
  delta1:
    ACK 2bb25ce502
  epiccurious:
    utACK 2bb25ce502.
  achow101:
    ACK 2bb25ce502
  theStack:
    Code-review ACK 2bb25ce502

Tree-SHA512: e0537c994be19ca0032551d8a64cf1755c8997e04d21ee0522b31de26ad90b9eb02a8b415448257b60bced484b9d2a23b37586e12dc5ff6e35bdd8ff2165c6bf
2024-02-06 13:02:47 -05:00
furszy
cfcb9b1ecf test: wallet, coverage for concurrent db transactions
Verifying that a database handler can't commit/abort changes
occurring in a different database handler.
2024-02-06 12:24:36 -05:00
Ava Chow
548ecd1155 tests: Test for concurrent writes with db tx
There are occasions where a multi-statement tx is begun in one batch,
and a second batch is created which does a normal write (without a
multi-statement tx). These should not conflict with each other and all
of the data should end up being written to disk.
2024-02-06 12:24:36 -05:00
Ava Chow
395bcd2454 sqlite: Ensure that only one SQLiteBatch is writing to db at a time
A SQLiteBatch need to wait for any other batch to finish writing before
it can begin writing, otherwise db txn state may be incorrectly
modified. To enforce this, each SQLiteDatabase has a semaphore which
acts as a lock and is acquired by a batch when it begins a write, erase,
or a transaction, and is released by it when it is done.

To avoid deadlocking on itself for writing during a transaction,
SQLiteBatch also keeps track of whether it has begun a transaction.
2024-02-06 12:24:36 -05:00
glozow
4de84557d6
Merge bitcoin/bitcoin#29356: test: make v2transport arg in addconnection mandatory and few cleanups
e7fd70f4b6 [test] make v2transport arg in addconnection mandatory and few cleanups (stratospher)

Pull request description:

  - make `v2transport` argument in `addconnection` regression-testing only RPC mandatory. https://github.com/bitcoin/bitcoin/pull/24748#discussion_r1470738750
  - previously it was an optional arg with default `false` value.
  - only place this RPC is used is in the [functional tests](11b436a66a/test/functional/test_framework/test_node.py (L742)) where we always pass the appropriate `v2transport` option to the RPC anyways. (and that too just for python dummy peer(`P2PInterface`) and bitcoind(`TestNode`) interactions)
  - rename `v2_handshake()` to `_on_data_v2_handshake()` https://github.com/bitcoin/bitcoin/pull/24748#discussion_r1466958424
  - more compact return statement in `wait_for_reconnect()` https://github.com/bitcoin/bitcoin/pull/24748#discussion_r1466979708
  - assertion to check that empty version packets are received from `TestNode`.

ACKs for top commit:
  glozow:
    ACK e7fd70f4b6
  theStack:
    Code-review ACK e7fd70f4b6
  mzumsande:
    Code Review ACK e7fd70f4b6

Tree-SHA512: e66e29baccd91e1e4398b91f7d45c5fc7c2841d77d8a6178734586017bf2be63496721649da91848dec71da605ee31664352407d5bb896e624cc693767c61a1f
2024-02-06 11:02:36 +00:00