diff options
| author | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-13 18:11:30 -0300 |
|---|---|---|
| committer | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-13 18:11:30 -0300 |
| commit | 540ed06974ff6b05364d4922895288744f076f6b (patch) | |
| tree | 6d7ba6802278f148fd98ffc3a482a47991dc08a7 /src/selftest.cpp | |
| parent | 805c5757b801d80ea575c6a8b58e2855254f9046 (diff) | |
wallet: add storage sanity check
Diffstat (limited to 'src/selftest.cpp')
| -rw-r--r-- | src/selftest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp index 73c2935..5e5bab6 100644 --- a/src/selftest.cpp +++ b/src/selftest.cpp | |||
| @@ -1329,6 +1329,19 @@ static int RunWalletPortabilitySelfTest() | |||
| 1329 | FileContainsText(strOriginalStorageAudit, "malformed records: 0"), | 1329 | FileContainsText(strOriginalStorageAudit, "malformed records: 0"), |
| 1330 | "the storage audit recognizes a plaintext phrase wallet") ? 0 : 1; | 1330 | "the storage audit recognizes a plaintext phrase wallet") ? 0 : 1; |
| 1331 | 1331 | ||
| 1332 | string strOriginalStorageCheck = tmp + "/original-storage-check.txt"; | ||
| 1333 | vector<string> vOriginalStorageCheckArgs; | ||
| 1334 | vOriginalStorageCheckArgs.push_back("-datadir=" + strOriginal); | ||
| 1335 | vOriginalStorageCheckArgs.push_back("-nomanagedtor"); | ||
| 1336 | vOriginalStorageCheckArgs.push_back("-nogui"); | ||
| 1337 | vOriginalStorageCheckArgs.push_back("-walletstoragecheck"); | ||
| 1338 | int nOriginalStorageCheckRet = | ||
| 1339 | RunBitflashChild(strExe, vOriginalStorageCheckArgs, NULL, &strOriginalStorageCheck); | ||
| 1340 | nFail += Check(nOriginalStorageCheckRet == 0 && | ||
| 1341 | FileContainsText(strOriginalStorageCheck, "storage sanity: ok") && | ||
| 1342 | FileContainsText(strOriginalStorageCheck, "plain HD seed: complete"), | ||
| 1343 | "the storage sanity check accepts a plaintext phrase wallet") ? 0 : 1; | ||
| 1344 | |||
| 1332 | string strOriginalStorageAuditJson = tmp + "/original-storage-audit.json"; | 1345 | string strOriginalStorageAuditJson = tmp + "/original-storage-audit.json"; |
| 1333 | vector<string> vOriginalStorageAuditJsonArgs; | 1346 | vector<string> vOriginalStorageAuditJsonArgs; |
| 1334 | vOriginalStorageAuditJsonArgs.push_back("-datadir=" + strOriginal); | 1347 | vOriginalStorageAuditJsonArgs.push_back("-datadir=" + strOriginal); |
| @@ -1419,6 +1432,20 @@ static int RunWalletPortabilitySelfTest() | |||
| 1419 | FileContainsText(strEncryptedStorageAudit, "malformed records: 0"), | 1432 | FileContainsText(strEncryptedStorageAudit, "malformed records: 0"), |
| 1420 | "the storage audit recognizes an encrypted wallet") ? 0 : 1; | 1433 | "the storage audit recognizes an encrypted wallet") ? 0 : 1; |
| 1421 | 1434 | ||
| 1435 | string strEncryptedStorageCheck = tmp + "/encrypted-storage-check.txt"; | ||
| 1436 | vector<string> vEncryptedStorageCheckArgs; | ||
| 1437 | vEncryptedStorageCheckArgs.push_back("-datadir=" + strOriginal); | ||
| 1438 | vEncryptedStorageCheckArgs.push_back("-nomanagedtor"); | ||
| 1439 | vEncryptedStorageCheckArgs.push_back("-nogui"); | ||
| 1440 | vEncryptedStorageCheckArgs.push_back("-walletstoragecheck"); | ||
| 1441 | int nEncryptedStorageCheckRet = | ||
| 1442 | RunBitflashChild(strExe, vEncryptedStorageCheckArgs, NULL, &strEncryptedStorageCheck); | ||
| 1443 | nFail += Check(nEncryptedStorageCheckRet == 0 && | ||
| 1444 | FileContainsText(strEncryptedStorageCheck, "storage sanity: ok") && | ||
| 1445 | FileContainsText(strEncryptedStorageCheck, "plain private keys: 0") && | ||
| 1446 | FileContainsText(strEncryptedStorageCheck, "encrypted HD seed: complete"), | ||
| 1447 | "the storage sanity check accepts an encrypted wallet") ? 0 : 1; | ||
| 1448 | |||
| 1422 | string strEncryptedStorageAuditJson = tmp + "/encrypted-storage-audit.json"; | 1449 | string strEncryptedStorageAuditJson = tmp + "/encrypted-storage-audit.json"; |
| 1423 | vector<string> vEncryptedStorageAuditJsonArgs; | 1450 | vector<string> vEncryptedStorageAuditJsonArgs; |
| 1424 | vEncryptedStorageAuditJsonArgs.push_back("-datadir=" + strOriginal); | 1451 | vEncryptedStorageAuditJsonArgs.push_back("-datadir=" + strOriginal); |