Skip to content

Conversation

jgarzik
Copy link
Contributor

@jgarzik jgarzik commented May 14, 2012

Cleans up and organizes several scattered functions and variables related to
the BDB env. Class CDBInit() existed to provide a
guaranteed-via-C++-destructor cleanup of the db environment.

A formal CDBEnv class provides all of this inside a single wrapper.

NOTES:

  1. Other db.cpp-related operations might be candidates for CDBEnv inclusion. This current commit was chosen as a good starting point, only encapsulating clearly-dbenv-related items.
  2. Further wrappers may easily encapsulate remaining direct bitdb.dbenv accesses, though it hardly seems worth it.
  3. CDBEnv is a starting point for easy cross-database transactions. BDB supports this, but bitcoin codebase hardcodes txn<->database association into CDB.

@jgarzik
Copy link
Contributor Author

jgarzik commented May 14, 2012

Rebased on top of #1295 (check return values of TxnBegin, TxnCommit)

@jgarzik
Copy link
Contributor Author

jgarzik commented May 14, 2012

DEPENDENCY UPDATE: this sits on top of #1300, in addition to #1295

@@ -13,7 +13,6 @@

static uint64 nAccountingEntryNumber = 0;

extern CCriticalSection cs_db;
extern map<string, int> mapFileUseCount;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does mapFileUseCount need to remain global?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that and mapFiles[] could be moved into CDBEnv as well.

@jgarzik
Copy link
Contributor Author

jgarzik commented May 15, 2012

Moved mapDb and mapFileUseCount into class CDBEnv. mapFileUseCount had to remain public for the moment, until some wrappers may be written that eliminates the need for walletdb and CDB::Rewrite() to directly access these internals.

It doesn't help that we use this reference counting scheme sometimes, and other times we wish to immediately close regardless of reference count.

@jgarzik
Copy link
Contributor Author

jgarzik commented May 19, 2012

This seems stable in testing, though the encapsulation isn't the best. Some of the mapFileUseCount[] stuff is rather delicate, and relies on implicit behavior. Best left to complete the encapsulation of that to a separate commit, IMO. Once done, that will fit naturally inside CDBEnv::OpenDb(), which would be split out from CDB::CDB().

Jeff Garzik added 6 commits May 19, 2012 20:40
If Reorganize() fails, then its caller, CBlock::SetBestChain(),
will call TxnAbort().

Redundant TxnAbort() calls are harmless.  The second will return an
error return value, with no other side effects.  TxnAbort() return
values are generally never checked.  The impact is nil.
Cleans up and organizes several scattered functions and variables related to
the BDB env.  Class CDBInit() existed to provide a
guaranteed-via-C++-destructor cleanup of the db environment.

A formal CDBEnv class provides all of this inside a single wrapper.
@sipa
Copy link
Member

sipa commented May 22, 2012

ACK

@jgarzik jgarzik merged commit ffe8b77 into bitcoin:master May 22, 2012
@jgarzik jgarzik deleted the dbenv branch August 24, 2014 04:19
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Jan 22, 2019
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
… proofs

29c02c7 [Cleanup] Remove ZerocoinParams from legacy CoinSpend classes (random-zebra)
a038651 [zPIV][Cleanup] Remove old CoinSpend proofs files (random-zebra)
26f407a [Cleanup][zPIV] Remove Acc Witness (random-zebra)
0052be4 [Cleanup][zPIV] Start removing old/unused zerocoin spend validation code (random-zebra)

Pull request description:

  Based on top of bitcoin#1291 .

  Old (v2) `CoinSpend` proofs are no longer checked. We can thus remove most of `AccumulatorProofOfKnowledge`, `SerialNumberSignatureOfKnowledge`
  and `CommitmentProofOfKnowledge`.
  We save only the structure and serialize methods (inside `CoinSpend.h`) to be able to parse them from the chain.

ACKs for top commit:
  furszy:
    ACK 29c02c7
  Fuzzbawls:
    ACK 29c02c7

Tree-SHA512: f4198443bf760fb398badff5bb31579bb0feb97677bbd55b23a136c07e35d3150588883ef7645f9f6122a0bbf394180d78012916e9bff41597756666945106ab
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
…t cleaning

79dccae [Trivial][RPC] Fix spendzerocoin num of arguments (random-zebra)
c9aefbf [Doc] Update rel notes: remove zPIV backup - mintchange/minimizechange (random-zebra)
35dae21 [Cleanup][Trivial] Remove unused variable nStakeSetUpdateTime in wallet (random-zebra)
f95af41 [Wallet][Cleanup] Refactor zPIV legacy functions at the end of wallet.* (random-zebra)
565b963 [Wallet][RPC] Remove fMintChange / fMinimizeChange from zc spends/mints (random-zebra)
76b7386 [Wallet][zPIV] Remove auto-backups. Lock minting only for tests. (random-zebra)

Pull request description:

  Builds on top of bitcoin#1293 .
  This removes zerocoin backups and locks minting only for tests. Mints and v2 spends are rejected from mempool. Removes `fMintChange/fMinimizeChange` options from RPC functions. Cleans up unused variables and functions. Zerocoin specific implementations have been moved from wallet.cpp to a new file wallet_zerocoin.cpp in the wallet directory.

ACKs for top commit:
  furszy:
    cool refactor, utACK 79dccae.
  Fuzzbawls:
    ACK 79dccae

Tree-SHA512: bb69e9e79e2a5664d351fdce1a35a16642576290ead7198e74b04213b478a5e1e9a96ff9aa800ca714c5c6f2045e780a533921681d2ab79af6761a8acebec7c8
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants