refactor: encapsulate vector/array keys into Obfuscation

This commit is contained in:
Lőrinc
2025-07-05 14:39:19 +02:00
parent 377aab8e5a
commit 478d40afc6
13 changed files with 136 additions and 85 deletions

View File

@@ -64,7 +64,7 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active
if (version == MEMPOOL_DUMP_VERSION_NO_XOR_KEY) {
file.SetObfuscation({});
} else if (version == MEMPOOL_DUMP_VERSION) {
std::vector<std::byte> obfuscation(Obfuscation::KEY_SIZE);
Obfuscation obfuscation;
file >> obfuscation;
file.SetObfuscation(obfuscation);
} else {
@@ -183,8 +183,7 @@ bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, FopenFn mock
file << version;
if (!pool.m_opts.persist_v1_dat) {
std::vector<std::byte> obfuscation(Obfuscation::KEY_SIZE);
FastRandomContext{}.fillrand(obfuscation);
const Obfuscation obfuscation{FastRandomContext{}.randbytes<Obfuscation::KEY_SIZE>()};
file << obfuscation;
file.SetObfuscation(obfuscation);
} else {