diff options
| author | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-13 17:36:09 -0300 |
|---|---|---|
| committer | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-13 17:59:25 -0300 |
| commit | 8e62e362e2fbe6fd6c5d66ddb354ec544f8cf0db (patch) | |
| tree | d9773fd4b52f3ae7c316c6ff11fc2ab4d924a122 /src/selftest.cpp | |
| parent | c0f886f0683ebd1321751355ddc0c757496320c9 (diff) | |
wallet: add storage audit command
Diffstat (limited to 'src/selftest.cpp')
| -rw-r--r-- | src/selftest.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp index 8a448f0..b112238 100644 --- a/src/selftest.cpp +++ b/src/selftest.cpp | |||
| @@ -1314,6 +1314,21 @@ static int RunWalletPortabilitySelfTest() | |||
| 1314 | FileContainsText(strOriginalAudit, "SLIP-0044 BITFLASH"), | 1314 | FileContainsText(strOriginalAudit, "SLIP-0044 BITFLASH"), |
| 1315 | "the original wallet reports its recovery phrase") ? 0 : 1; | 1315 | "the original wallet reports its recovery phrase") ? 0 : 1; |
| 1316 | 1316 | ||
| 1317 | string strOriginalStorageAudit = tmp + "/original-storage-audit.txt"; | ||
| 1318 | vector<string> vOriginalStorageAuditArgs; | ||
| 1319 | vOriginalStorageAuditArgs.push_back("-datadir=" + strOriginal); | ||
| 1320 | vOriginalStorageAuditArgs.push_back("-nomanagedtor"); | ||
| 1321 | vOriginalStorageAuditArgs.push_back("-nogui"); | ||
| 1322 | vOriginalStorageAuditArgs.push_back("-walletstorageaudit"); | ||
| 1323 | int nOriginalStorageAuditRet = | ||
| 1324 | RunBitflashChild(strExe, vOriginalStorageAuditArgs, NULL, &strOriginalStorageAudit); | ||
| 1325 | nFail += Check(nOriginalStorageAuditRet == 0 && | ||
| 1326 | FileContainsText(strOriginalStorageAudit, "Wallet storage audit") && | ||
| 1327 | FileContainsText(strOriginalStorageAudit, "plain HD seed: complete") && | ||
| 1328 | FileContainsText(strOriginalStorageAudit, "encrypted HD seed: none") && | ||
| 1329 | FileContainsText(strOriginalStorageAudit, "malformed records: 0"), | ||
| 1330 | "the storage audit recognizes a plaintext phrase wallet") ? 0 : 1; | ||
| 1331 | |||
| 1317 | string strPortableWallet = tmp + "/portable-wallet.dat"; | 1332 | string strPortableWallet = tmp + "/portable-wallet.dat"; |
| 1318 | string strBackupOut = tmp + "/backupwallet.txt"; | 1333 | string strBackupOut = tmp + "/backupwallet.txt"; |
| 1319 | vector<string> vBackupArgs; | 1334 | vector<string> vBackupArgs; |
| @@ -1368,6 +1383,23 @@ static int RunWalletPortabilitySelfTest() | |||
| 1368 | nFail += Check(nEncryptRet == 0 && | 1383 | nFail += Check(nEncryptRet == 0 && |
| 1369 | !DirectoryHasFileWithPrefix(strOriginal + "/database", "log."), | 1384 | !DirectoryHasFileWithPrefix(strOriginal + "/database", "log."), |
| 1370 | "the encryptwallet command purges Berkeley DB environment logs") ? 0 : 1; | 1385 | "the encryptwallet command purges Berkeley DB environment logs") ? 0 : 1; |
| 1386 | |||
| 1387 | string strEncryptedStorageAudit = tmp + "/encrypted-storage-audit.txt"; | ||
| 1388 | vector<string> vEncryptedStorageAuditArgs; | ||
| 1389 | vEncryptedStorageAuditArgs.push_back("-datadir=" + strOriginal); | ||
| 1390 | vEncryptedStorageAuditArgs.push_back("-nomanagedtor"); | ||
| 1391 | vEncryptedStorageAuditArgs.push_back("-nogui"); | ||
| 1392 | vEncryptedStorageAuditArgs.push_back("-walletstorageaudit"); | ||
| 1393 | int nEncryptedStorageAuditRet = | ||
| 1394 | RunBitflashChild(strExe, vEncryptedStorageAuditArgs, NULL, &strEncryptedStorageAudit); | ||
| 1395 | nFail += Check(nEncryptedStorageAuditRet == 0 && | ||
| 1396 | FileContainsText(strEncryptedStorageAudit, "plain private keys: 0") && | ||
| 1397 | FileContainsText(strEncryptedStorageAudit, "encrypted private keys:") && | ||
| 1398 | FileContainsText(strEncryptedStorageAudit, "plain HD seed: none") && | ||
| 1399 | FileContainsText(strEncryptedStorageAudit, "encrypted HD seed: complete") && | ||
| 1400 | FileContainsText(strEncryptedStorageAudit, "wallet minimum version: present") && | ||
| 1401 | FileContainsText(strEncryptedStorageAudit, "malformed records: 0"), | ||
| 1402 | "the storage audit recognizes an encrypted wallet") ? 0 : 1; | ||
| 1371 | } | 1403 | } |
| 1372 | catch (const std::exception& e) | 1404 | catch (const std::exception& e) |
| 1373 | { | 1405 | { |