Merge bitcoin/bitcoin#26702: refactor: walletdb: drop unused FindWalletTx parameter and rename

f496528556 walletdb: refactor: drop unused `FindWalletTx` parameter and rename (Sebastian Falbesoner)

Pull request description:

  Since commit 3340dbadd3 ("Remove -zapwallettxes"), the `FindWalletTx` helper is only needed to read tx hashes, so drop the other parameter and rename the method accordingly.

ACKs for top commit:
  S3RK:
    code review ACK f496528556
  achow101:
    ACK f496528556
  vincenzopalazzo:
    ACK https://github.com/bitcoin/bitcoin/pull/26702/commits/f496528556a67107d3d75d9c2ae345f7f4565d77

Tree-SHA512: ead85bc724462f9e920f9d7fe89679931361187579ffd6e63427c8bf5305cd5f71da24ed84f3b1bd22a12be46b5abec13f11822e71a3e1a63bf6cf49de950ab5
This commit is contained in:
Andrew Chow committed 2023-01-03 11:54:51 -05:00
commit 1e6b384d59
2 files changed
+5 -8

No files matched your search

+4 -7
View File
@@ -974,7 +974,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
return result; return result;
} }
DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWalletTx>& vWtx) DBErrors WalletBatch::FindWalletTxHashes(std::vector<uint256>& tx_hashes)
{ {
DBErrors result = DBErrors::LOAD_OK; DBErrors result = DBErrors::LOAD_OK;
@@ -1012,9 +1012,7 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWal
if (strType == DBKeys::TX) { if (strType == DBKeys::TX) {
uint256 hash; uint256 hash;
ssKey >> hash; ssKey >> hash;
vTxHash.push_back(hash); tx_hashes.push_back(hash);
vWtx.emplace_back(/*tx=*/nullptr, TxStateInactive{});
ssValue >> vWtx.back();
} }
} }
} catch (...) { } catch (...) {
@@ -1027,10 +1025,9 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWal
DBErrors WalletBatch::ZapSelectTx(std::vector<uint256>& vTxHashIn, std::vector<uint256>& vTxHashOut) DBErrors WalletBatch::ZapSelectTx(std::vector<uint256>& vTxHashIn, std::vector<uint256>& vTxHashOut)
{ {
// build list of wallet TXs and hashes // build list of wallet TX hashes
std::vector<uint256> vTxHash; std::vector<uint256> vTxHash;
std::list<CWalletTx> vWtx; DBErrors err = FindWalletTxHashes(vTxHash);
DBErrors err = FindWalletTx(vTxHash, vWtx);
if (err != DBErrors::LOAD_OK) { if (err != DBErrors::LOAD_OK) {
return err; return err;
} }
+1 -1
View File
@@ -273,7 +273,7 @@ public:
bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal); bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal);
DBErrors LoadWallet(CWallet* pwallet); DBErrors LoadWallet(CWallet* pwallet);
DBErrors FindWalletTx(std::vector<uint256>& vTxHash, std::list<CWalletTx>& vWtx); DBErrors FindWalletTxHashes(std::vector<uint256>& tx_hashes);
DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut); DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
/* Function to determine if a certain KV/key-type is a key (cryptographical key) type */ /* Function to determine if a certain KV/key-type is a key (cryptographical key) type */
static bool IsKeyType(const std::string& strType); static bool IsKeyType(const std::string& strType);