Skip to content

Conversation

sipa
Copy link
Member

@sipa sipa commented Jun 1, 2011

Introduce a new class, CWallet, to manage wallets, and move all wallet-specific code there. All wallet-related globals are turned into fields of CWallet, and one single global, pwalletMain, is added instead.

It consists of two commits: the first one adds the new source files, and moves as much there as possible without actually changing any code. The second commit adds the class definitions, and all other changes.

Forum thread is here: http://forum.bitcoin.org/index.php?topic=9492.0

@sipa
Copy link
Member Author

sipa commented Jun 15, 2011

Rebased.

sipa added 2 commits June 15, 2011 11:05
This introduces two new source files, keystore.cpp and wallet.cpp with
corresponding headers. Code is moved from main and db, in a preparation
for a follow-up commit which introduces the classes CWallet and CKeyStore.
* A new class CKeyStore manages private keys, and script.cpp depends on access to CKeyStore.
* A new class CWallet extends CKeyStore, and contains all former wallet-specific globals; CWallet depends on script.cpp, not the other way around.
* Wallet-specific functions in CTransaction/CTxIn/CTxOut (GetDebit, GetCredit, GetChange, IsMine, IsFromMe), are moved to CWallet, taking their former 'this' argument as an explicit parameter
* CWalletTx objects know which CWallet they belong to, for convenience, so they have their own direct (and caching) GetDebit/... functions.
* Some code was moved from CWalletDB to CWallet, such as handling of reserve keys.
* Main.cpp keeps a set of all 'registered' wallets, which should be informed about updates to the block chain, and does not have any notion about any 'main' wallet. Function in main.cpp that require a wallet (such as GenerateCoins), take an explicit CWallet* argument.
* The actual CWallet instance used by the application is defined in init.cpp as "CWallet* pwalletMain". rpc.cpp and ui.cpp use this variable.
* Functions in main.cpp and db.cpp that are not used by other modules are marked static.
* The code for handling the 'submitorder' message is removed, as it not really compatible with the idea that a node is independent from the wallet(s) connected to it, and obsolete anyway.
sipa added a commit that referenced this pull request Jun 19, 2011
@sipa sipa merged commit a6b2115 into bitcoin:master Jun 19, 2011
dexX7 added a commit to dexX7/bitcoin that referenced this pull request Nov 28, 2015
a3007eb Remove extra character in help message (zathras-crypto)
49d36db Expose payload over RPC and add payload size (zathras-crypto)
jamoes referenced this pull request in jamoes/bitcoinclassic Feb 8, 2017
….0.0-typos-release-branch

Fix a few more typos and URLs
classesjack pushed a commit to classesjack/bitcoin that referenced this pull request Jan 2, 2018
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Oct 16, 2019
cryptapus pushed a commit to cryptapus/bitcoin that referenced this pull request May 3, 2021
09ac45c Get rid of CBaseMerkleTx. (Daniel Kraft)
a33a190 Decouple CAuxPow from CBaseMerkleTx. (Daniel Kraft)
4d606ae Zero CAuxPow's hashBlock field. (Daniel Kraft)

Pull request description:

  This change refactors the auxpow code so that the `hashBlock` field of a serialised `CAuxPow` is always set to zero.  Since that field is never actually used or checked in code (also not in the existing network without this change), that is a safe change to make.  It increases compressibility of the data, which can help SPV clients (see bitcoin#288 for discussion about that).

  In addition, this also changes the code to ignore the `nIndex` field when deserialising a `CAuxPow`.  This value is not necessary either, as it has to be always zero (for a coinbase tx as in an auxpow).  This change affects consensus:  Nodes with this patch applied will accept auxpows with a non-zero `nIndex`, while nodes without will reject those auxpows.  But since the auxpow is only there to provide PoW for a block and does not affect the consensus state itself, this change is safe.  All that an attacker could do is make old nodes reject blocks that new nodes accept, *due to invalid PoW*.  Once relayed by a new node, the same blocks will be accepted by the old code as well.  Thus, this "attack" is not different from an attacker simply trying to withhold blocks for certain peers, which they can do already if they want.

ACKs for commit 09ac45:

Tree-SHA512: b6c1c439949add20337874477366429f6d567bbb7e71d898f046bbcbcefc0c6ca8dbad73d5098ed27a403ff5090dd48eb51cb39d8834e95d66ec102b9cd9a87f
hebasto added a commit that referenced this pull request May 27, 2021
…lator comments

8b77133 qt: Replace disambiguation strings with translator comments (Hennadii Stepanov)

Pull request description:

  Since #21694 is merged, translator comments is the right way to pass context to translators.

  This PR fixes changes were made:
  - in #220 before #21694
  - in #21694 on testing purpose
  - in #125

  Closes #288.

ACKs for top commit:
  jarolrod:
    ACK 8b77133

Tree-SHA512: 466ade35f4969a41fbf3196780b1ae9fa810bab5d2f09077f8631604636cc63b24a901c719f6b5797366d2aa307993d0aa419ce35200c8d0a741a3d81cad3e6b
rajarshimaitra pushed a commit to rajarshimaitra/bitcoin that referenced this pull request Aug 5, 2021
@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.

1 participant