0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-14 11:26:09 -05:00
Commit graph

11 commits

Author SHA1 Message Date
Ryan Ofsky
a23cca56c0 refactor: Replace BResult with util::Result
Rename `BResult` class to `util::Result` and update the class interface to be
more compatible with `std::optional` and with a full-featured result class
implemented in https://github.com/bitcoin/bitcoin/pull/25665. Motivation for
this change is to update existing `BResult` usages now so they don't have to
change later when more features are added in #25665.

This change makes the following improvements originally implemented in #25665:

- More explicit API. Drops potentially misleading `BResult` constructor that
  treats any bilingual string argument as an error. Adds `util::Error`
  constructor so it is never ambiguous when a result is being assigned an error
  or non-error value.

- Better type compatibility. Supports `util::Result<bilingual_str>` return
  values to hold translated messages which are not errors.

- More standard and consistent API. `util::Result` supports most of the same
  operators and methods as `std::optional`. `BResult` had a less familiar
  interface with `HasRes`/`GetObj`/`ReleaseObj` methods. The Result/Res/Obj
  naming was also not internally consistent.

- Better code organization. Puts `src/util/` code in the `util::` namespace so
  naming reflects code organization and it is obvious where the class is coming
  from. Drops "B" from name because it is undocumented what it stands for
  (bilingual?)

- Has unit tests.
2022-08-03 07:33:01 -04:00
fanquake
d6787bc19b
refactor: remove unused using directives 2022-07-18 17:25:03 +01:00
furszy
111ea3ab71
wallet: refactor GetNewDestination, use BResult 2022-07-08 11:18:35 -03:00
Andrew Chow
e673d8b475 bench: Enable loading benchmarks depending on what's compiled
Add descriptor wallet benchmark only if sqlite is compiled. Add legacy
wallet benchmark only if bdb is compiled.
2022-05-10 11:54:02 -04:00
Andrew Chow
4af3547eba bench: Use mock wallet database for wallet loading benchmark
Using in-memory only databases speeds up the benchmark, at the cost of
real world accuracy.
2022-05-10 11:54:02 -04:00
Andrew Chow
7c0d34476d bench: reduce the number of txs in wallet for wallet loading bench 2022-04-20 13:56:16 -04:00
Andrew Chow
f85b54ed27 bench: Add transactions directly instead of mining blocks 2022-04-20 13:55:56 -04:00
Andrew Chow
d94244c4bf bench: reduce number of epochs for wallet loading benchmark 2022-04-20 13:53:57 -04:00
Andrew Chow
817c051364 bench: use unsafesqlitesync in wallet loading benchmark 2022-04-20 13:53:34 -04:00
Andrew Chow
9e404a9831 bench: Remove minEpochIterations from wallet loading benchmark
This is probably unnecessary and just makes it slower.
2022-04-19 12:22:44 -04:00
Andrew Chow
464a162817 bench: Add a benchmark for wallet loading 2022-04-18 17:02:57 -04:00