Bitcoin Core  21.99.0
P2P Digital Currency
Functions
walletdb_tests.cpp File Reference
#include <test/util/setup_common.h>
#include <clientversion.h>
#include <streams.h>
#include <uint256.h>
#include <boost/test/unit_test.hpp>
Include dependency graph for walletdb_tests.cpp:

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (walletdb_readkeyvalue)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( walletdb_readkeyvalue  )

When ReadKeyValue() reads from either a "key" or "wkey" it first reads the CDataStream steam into a CPrivKey or CWalletKey respectively and then reads a hash of the pubkey and privkey into a uint256. Wallets from 0.8 or before do not store the pubkey/privkey hash, trying to read the hash from old wallets throws an exception, for backwards compatibility this read is wrapped in a try block to silently fail. The test here makes sure the type of exception thrown from CDataStream::read() matches the type we expect, otherwise we need to update the "key"/"wkey" exception type caught.

Definition at line 14 of file walletdb_tests.cpp.