diff options
| author | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-13 17:40:20 -0300 |
|---|---|---|
| committer | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-13 17:59:25 -0300 |
| commit | 805c5757b801d80ea575c6a8b58e2855254f9046 (patch) | |
| tree | 5faf35daa569d987b87dbb161bb18ec170f944b0 /src/selftest.cpp | |
| parent | 8e62e362e2fbe6fd6c5d66ddb354ec544f8cf0db (diff) | |
wallet: export storage audit json
Diffstat (limited to 'src/selftest.cpp')
| -rw-r--r-- | src/selftest.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp index b112238..73c2935 100644 --- a/src/selftest.cpp +++ b/src/selftest.cpp | |||
| @@ -1329,6 +1329,24 @@ 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 strOriginalStorageAuditJson = tmp + "/original-storage-audit.json"; | ||
| 1333 | vector<string> vOriginalStorageAuditJsonArgs; | ||
| 1334 | vOriginalStorageAuditJsonArgs.push_back("-datadir=" + strOriginal); | ||
| 1335 | vOriginalStorageAuditJsonArgs.push_back("-nomanagedtor"); | ||
| 1336 | vOriginalStorageAuditJsonArgs.push_back("-nogui"); | ||
| 1337 | vOriginalStorageAuditJsonArgs.push_back("-walletstorageauditjson=" + | ||
| 1338 | strOriginalStorageAuditJson); | ||
| 1339 | int nOriginalStorageAuditJsonRet = | ||
| 1340 | RunBitflashChild(strExe, vOriginalStorageAuditJsonArgs); | ||
| 1341 | nFail += Check(nOriginalStorageAuditJsonRet == 0 && | ||
| 1342 | FileContainsText(strOriginalStorageAuditJson, | ||
| 1343 | "\"format\": \"bitflash-wallet-storage-audit-v1\"") && | ||
| 1344 | FileContainsText(strOriginalStorageAuditJson, | ||
| 1345 | "\"plain_hd_seed\": \"complete\"") && | ||
| 1346 | FileContainsText(strOriginalStorageAuditJson, | ||
| 1347 | "\"encrypted_hd_seed\": \"none\""), | ||
| 1348 | "the storage audit can write plaintext-wallet JSON") ? 0 : 1; | ||
| 1349 | |||
| 1332 | string strPortableWallet = tmp + "/portable-wallet.dat"; | 1350 | string strPortableWallet = tmp + "/portable-wallet.dat"; |
| 1333 | string strBackupOut = tmp + "/backupwallet.txt"; | 1351 | string strBackupOut = tmp + "/backupwallet.txt"; |
| 1334 | vector<string> vBackupArgs; | 1352 | vector<string> vBackupArgs; |
| @@ -1400,6 +1418,26 @@ static int RunWalletPortabilitySelfTest() | |||
| 1400 | FileContainsText(strEncryptedStorageAudit, "wallet minimum version: present") && | 1418 | FileContainsText(strEncryptedStorageAudit, "wallet minimum version: present") && |
| 1401 | FileContainsText(strEncryptedStorageAudit, "malformed records: 0"), | 1419 | FileContainsText(strEncryptedStorageAudit, "malformed records: 0"), |
| 1402 | "the storage audit recognizes an encrypted wallet") ? 0 : 1; | 1420 | "the storage audit recognizes an encrypted wallet") ? 0 : 1; |
| 1421 | |||
| 1422 | string strEncryptedStorageAuditJson = tmp + "/encrypted-storage-audit.json"; | ||
| 1423 | vector<string> vEncryptedStorageAuditJsonArgs; | ||
| 1424 | vEncryptedStorageAuditJsonArgs.push_back("-datadir=" + strOriginal); | ||
| 1425 | vEncryptedStorageAuditJsonArgs.push_back("-nomanagedtor"); | ||
| 1426 | vEncryptedStorageAuditJsonArgs.push_back("-nogui"); | ||
| 1427 | vEncryptedStorageAuditJsonArgs.push_back("-walletstorageauditjson=" + | ||
| 1428 | strEncryptedStorageAuditJson); | ||
| 1429 | int nEncryptedStorageAuditJsonRet = | ||
| 1430 | RunBitflashChild(strExe, vEncryptedStorageAuditJsonArgs); | ||
| 1431 | nFail += Check(nEncryptedStorageAuditJsonRet == 0 && | ||
| 1432 | FileContainsText(strEncryptedStorageAuditJson, | ||
| 1433 | "\"plain_private_keys\": 0") && | ||
| 1434 | FileContainsText(strEncryptedStorageAuditJson, | ||
| 1435 | "\"plain_hd_seed\": \"none\"") && | ||
| 1436 | FileContainsText(strEncryptedStorageAuditJson, | ||
| 1437 | "\"encrypted_hd_seed\": \"complete\"") && | ||
| 1438 | FileContainsText(strEncryptedStorageAuditJson, | ||
| 1439 | "\"wallet_minimum_version\": \"present\""), | ||
| 1440 | "the storage audit can write encrypted-wallet JSON") ? 0 : 1; | ||
| 1403 | } | 1441 | } |
| 1404 | catch (const std::exception& e) | 1442 | catch (const std::exception& e) |
| 1405 | { | 1443 | { |