Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_tests.cpp
Show First 20 Lines • Show All 643 Lines • ▼ Show 20 Lines | BOOST_FIXTURE_TEST_CASE(wallet_disableprivkeys, TestChain100Setup) { | ||||
wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS); | wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS); | ||||
BOOST_CHECK(!wallet->TopUpKeyPool(1000)); | BOOST_CHECK(!wallet->TopUpKeyPool(1000)); | ||||
CTxDestination dest; | CTxDestination dest; | ||||
std::string error; | std::string error; | ||||
BOOST_CHECK( | BOOST_CHECK( | ||||
!wallet->GetNewDestination(OutputType::LEGACY, "", dest, error)); | !wallet->GetNewDestination(OutputType::LEGACY, "", dest, error)); | ||||
} | } | ||||
bool malformed_descriptor(std::ios_base::failure e) { | |||||
std::string s(e.what()); | |||||
return s.find("Missing checksum") != std::string::npos; | |||||
} | |||||
BOOST_FIXTURE_TEST_CASE(wallet_descriptor_test, BasicTestingSetup) { | |||||
std::vector<uint8_t> malformed_record; | |||||
CVectorWriter vw(0, 0, malformed_record, 0); | |||||
vw << std::string("notadescriptor"); | |||||
vw << (uint64_t)0; | |||||
vw << (int32_t)0; | |||||
vw << (int32_t)0; | |||||
vw << (int32_t)1; | |||||
VectorReader vr(0, 0, malformed_record, 0); | |||||
WalletDescriptor w_desc; | |||||
BOOST_CHECK_EXCEPTION(vr >> w_desc, std::ios_base::failure, | |||||
malformed_descriptor); | |||||
} | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |