upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/selftest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/selftest.cpp')
-rw-r--r--src/selftest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp
index bc9fa5a..88e9863 100644
--- a/src/selftest.cpp
+++ b/src/selftest.cpp
@@ -334,6 +334,10 @@ static int RunWalletHDSelfTest()
334 nFail += Check(nRandomPoolSize == KEYPOOL_SIZE, 334 nFail += Check(nRandomPoolSize == KEYPOOL_SIZE,
335 "a wallet can start with a random key pool") ? 0 : 1; 335 "a wallet can start with a random key pool") ? 0 : 1;
336 336
337 // The address the wallet was showing before any of this. It has to
338 // survive under a name that says it is not covered by the phrase.
339 std::string strPreSeedAddr = PubKeyToAddress(keyUser.GetPubKey());
340
337 nFail += Check(SetHDSeedFromMnemonic(strPhraseA, strError), 341 nFail += Check(SetHDSeedFromMnemonic(strPhraseA, strError),
338 "a valid phrase installs a seed") ? 0 : 1; 342 "a valid phrase installs a seed") ? 0 : 1;
339 nFail += Check(HaveHDSeed(), "the wallet reports having a seed") ? 0 : 1; 343 nFail += Check(HaveHDSeed(), "the wallet reports having a seed") ? 0 : 1;
@@ -356,6 +360,14 @@ static int RunWalletHDSelfTest()
356 nFail += Check(WalletHasPrivateKey(vchDefaultKey), 360 nFail += Check(WalletHasPrivateKey(vchDefaultKey),
357 "the derived default key is stored in wallet.dat") ? 0 : 1; 361 "the derived default key is stored in wallet.dat") ? 0 : 1;
358 362
363 std::string strNewAddr = PubKeyToAddress(vchDefaultKey);
364 nFail += Check(strPreSeedAddr != strNewAddr,
365 "the visible address stops being the pre-seed one") ? 0 : 1;
366 nFail += Check(mapAddressBook.count(strPreSeedAddr) > 0 &&
367 mapAddressBook[strPreSeedAddr] !=
368 mapAddressBook[strNewAddr],
369 "the pre-seed address is kept, named apart from the new one") ? 0 : 1;
370
359 std::vector<unsigned char> vchBefore = vchHDMaster; 371 std::vector<unsigned char> vchBefore = vchHDMaster;
360 nFail += Check(!SetHDSeedFromMnemonic("not a mnemonic at all", strError), 372 nFail += Check(!SetHDSeedFromMnemonic("not a mnemonic at all", strError),
361 "an invalid phrase is refused") ? 0 : 1; 373 "an invalid phrase is refused") ? 0 : 1;