diff options
Diffstat (limited to 'src/selftest.cpp')
| -rw-r--r-- | src/selftest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp index 5e5bab6..638aa66 100644 --- a/src/selftest.cpp +++ b/src/selftest.cpp | |||
| @@ -1134,6 +1134,13 @@ static int RunWalletEncryptSelfTest() | |||
| 1134 | TopUpKeyPool(); | 1134 | TopUpKeyPool(); |
| 1135 | 1135 | ||
| 1136 | vector<unsigned char> vchDefaultPubKey = keyUser.GetPubKey(); | 1136 | vector<unsigned char> vchDefaultPubKey = keyUser.GetPubKey(); |
| 1137 | CKey publicLabelKey; | ||
| 1138 | publicLabelKey.MakeNewKey(); | ||
| 1139 | string strPublicLabelAddress = PubKeyToAddress(publicLabelKey.GetPubKey()); | ||
| 1140 | nFail += Check(CWalletDB().WriteName(strPublicLabelAddress, "rewrite-public-name") && | ||
| 1141 | CWalletDB().WriteSetting("rewrite-public-setting", (int64)424242), | ||
| 1142 | "public wallet records can be written before encryption") ? 0 : 1; | ||
| 1143 | |||
| 1137 | CPrivKey vchDefaultPrivKey; | 1144 | CPrivKey vchDefaultPrivKey; |
| 1138 | nFail += Check(GetWalletPrivKey(vchDefaultPubKey, vchDefaultPrivKey, strError), | 1145 | nFail += Check(GetWalletPrivKey(vchDefaultPubKey, vchDefaultPrivKey, strError), |
| 1139 | "the default private key is readable before encryption") ? 0 : 1; | 1146 | "the default private key is readable before encryption") ? 0 : 1; |
| @@ -1161,6 +1168,7 @@ static int RunWalletEncryptSelfTest() | |||
| 1161 | #else | 1168 | #else |
| 1162 | string strExe = cwd + "/bitflash-node"; | 1169 | string strExe = cwd + "/bitflash-node"; |
| 1163 | #endif | 1170 | #endif |
| 1171 | string strStorageAudit = tmp + "/encrypted-storage-audit.txt"; | ||
| 1164 | string strWrongDump = tmp + "/wrong-pass-dump.txt"; | 1172 | string strWrongDump = tmp + "/wrong-pass-dump.txt"; |
| 1165 | string strRightDump = tmp + "/right-pass-dump.txt"; | 1173 | string strRightDump = tmp + "/right-pass-dump.txt"; |
| 1166 | string strLiteralDump = tmp + "/literal-pass-dump.txt"; | 1174 | string strLiteralDump = tmp + "/literal-pass-dump.txt"; |
| @@ -1173,6 +1181,18 @@ static int RunWalletEncryptSelfTest() | |||
| 1173 | WriteTextFile(strRightPassFile, "btf-test-passphrase\n"), | 1181 | WriteTextFile(strRightPassFile, "btf-test-passphrase\n"), |
| 1174 | "passphrase files can be written for restarted commands") ? 0 : 1; | 1182 | "passphrase files can be written for restarted commands") ? 0 : 1; |
| 1175 | 1183 | ||
| 1184 | vector<string> vStorageAuditArgs; | ||
| 1185 | vStorageAuditArgs.push_back("-datadir=" + tmp); | ||
| 1186 | vStorageAuditArgs.push_back("-walletstorageaudit"); | ||
| 1187 | vStorageAuditArgs.push_back("-nogui"); | ||
| 1188 | int nStorageAuditRet = RunBitflashChild(strExe, vStorageAuditArgs, NULL, &strStorageAudit); | ||
| 1189 | nFail += Check(nStorageAuditRet == 0 && | ||
| 1190 | FileContainsText(strStorageAudit, "address book labels: 3"), | ||
| 1191 | "the encrypted rewrite keeps address-book records") ? 0 : 1; | ||
| 1192 | nFail += Check(nStorageAuditRet == 0 && | ||
| 1193 | FileContainsText(strStorageAudit, "settings: 1"), | ||
| 1194 | "the encrypted rewrite keeps wallet setting records") ? 0 : 1; | ||
| 1195 | |||
| 1176 | vector<string> vWrongArgs; | 1196 | vector<string> vWrongArgs; |
| 1177 | vWrongArgs.push_back("-datadir=" + tmp); | 1197 | vWrongArgs.push_back("-datadir=" + tmp); |
| 1178 | vWrongArgs.push_back("-walletpassphrase=@" + strWrongPassFile); | 1198 | vWrongArgs.push_back("-walletpassphrase=@" + strWrongPassFile); |