Files
bitcoin/src
Sebastian Falbesoner f811a24421 wallet: cache descriptor ID to avoid repeated descriptor string creation
Right now a wallet descriptor is converted to it's string representation
(via `Descriptor::ToString`) repeatedly at different instances:
- on finding a `DescriptorScriptPubKeyMan` for a given descriptor
  (`CWallet::GetDescriptorScriptPubKeyMan`, e.g. used by the
  `importdescriptors` RPC); the string representation is created once
  for each spkm in the wallet and at each iteration again for
  the searched descriptor (`DescriptorScriptPubKeyMan::HasWalletDescriptor`)
- whenever `DescriptorScriptPubKeyMan::GetID()` is called, e.g. in
  `TopUp` or any instances where a descriptor is written to the DB
  to determine the database key etc.

As there is no good reason to calculate a fixed descriptor's string/ID
more than once, add the ID as a field to `WalletDescriptor` and
calculate it immediately at initialization (or deserialization).
`HasWalletDescriptor` is changed to compare the spkm's and searched
descriptor's ID instead of the string to take use of that.

This speeds up the functional test `wallet_miniscript.py` by a factor of
5-6x on my machine (3m30.95s on master vs. 0m38.02s on PR). The recently
introduced "max-size TapMiniscript" test-case introduced a descriptor
that takes 2-3 seconds to create a string representation, so the
repeated calls to that were significantly hurting the performance.
2023-11-05 23:50:58 +01:00
..
2023-10-12 11:27:19 +02:00
2023-08-08 17:50:41 +02:00
2023-09-27 15:05:15 -04:00
2023-10-12 11:27:19 +02:00
2022-12-24 23:49:50 +00:00
2023-06-16 10:38:19 +01:00
2023-06-16 10:38:19 +01:00
2022-12-24 23:49:50 +00:00
2023-09-19 16:38:08 +02:00
2023-10-12 11:27:19 +02:00
2023-06-16 10:38:19 +01:00
2023-09-13 11:37:45 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-10-12 11:27:19 +02:00
2023-10-12 11:27:19 +02:00
2023-01-12 13:42:44 +00:00
2023-06-16 10:38:19 +01:00
2023-07-19 18:12:42 +02:00
2023-10-12 11:27:19 +02:00