diff options
| author | Bitflash <admin@bitflash.network> | 2026-08-18 10:28:04 -0300 |
|---|---|---|
| committer | Bitflash <admin@bitflash.network> | 2026-08-18 10:28:04 -0300 |
| commit | 243b635267b6d34ef3b4b50ed559f743db161ad7 (patch) | |
| tree | 914f2851ce35919230c51ca083d3a964d6722408 /src/selftest.cpp | |
| parent | a6eb8dab830be3135c054ae3ae442886f1867b4e (diff) | |
| parent | 00c7aaed74e57da18598faa6751b7720598de3bd (diff) | |
Merge pull request 'wallet: run the node on a SQLite backend (opt-in)' (#59) from wallet-sqlite-activate into main
Diffstat (limited to 'src/selftest.cpp')
| -rw-r--r-- | src/selftest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp index 9fa0938..098eed6 100644 --- a/src/selftest.cpp +++ b/src/selftest.cpp | |||
| @@ -1230,6 +1230,31 @@ static int RunWalletSQLiteSelfTest() | |||
| 1230 | 1230 | ||
| 1231 | nFail += Check(!FileExists((strRuntimeDir + "/wallet.dat").c_str()), | 1231 | nFail += Check(!FileExists((strRuntimeDir + "/wallet.dat").c_str()), |
| 1232 | "active SQLite runtime does not create wallet.dat") ? 0 : 1; | 1232 | "active SQLite runtime does not create wallet.dat") ? 0 : 1; |
| 1233 | |||
| 1234 | // Durability: close the backend (checkpoints the WAL), reopen | ||
| 1235 | // the same file, and confirm what CWalletDB wrote is still | ||
| 1236 | // there. This is the write-survives-a-restart property the real | ||
| 1237 | // -walletbackend=sqlite node depends on. | ||
| 1238 | WalletSQLiteRuntimeClose(); | ||
| 1239 | bool fReopened = | ||
| 1240 | WalletSQLiteRuntimeOpen(strRuntimePath, strError); | ||
| 1241 | nFail += Check(fReopened, | ||
| 1242 | "SQLite runtime wallet reopens after close") ? 0 : 1; | ||
| 1243 | if (fReopened) | ||
| 1244 | { | ||
| 1245 | int64 nPersisted = 0; | ||
| 1246 | CPrivKey vchPersistedPrivKey; | ||
| 1247 | vector<unsigned char> vchPersistedDefaultKey; | ||
| 1248 | nFail += Check(CWalletDB("r").ReadSetting("runtime-sqlite-setting", | ||
| 1249 | nPersisted) && | ||
| 1250 | nPersisted == 909090 && | ||
| 1251 | CWalletDB("r").ReadDefaultKey(vchPersistedDefaultKey) && | ||
| 1252 | vchPersistedDefaultKey == vchRuntimePubKey && | ||
| 1253 | CWalletDB("r").ReadKey(vchRuntimePubKey, | ||
| 1254 | vchPersistedPrivKey) && | ||
| 1255 | vchPersistedPrivKey == vchRuntimePrivKey, | ||
| 1256 | "SQLite runtime writes persist across a close and reopen") ? 0 : 1; | ||
| 1257 | } | ||
| 1233 | } | 1258 | } |
| 1234 | 1259 | ||
| 1235 | WalletSQLiteRuntimeClose(); | 1260 | WalletSQLiteRuntimeClose(); |