MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / CleanAll

Method CleanAll

src/wallet/wallet.cpp:486–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484}
485
486bool CWallet::CleanAll() {
487 for_each(unconfirmedTx.begin(), unconfirmedTx.end(),
488 [&](std::map<uint256, std::shared_ptr<CBaseTx> >::reference a) {
489 CWalletDB(strWalletFile).EraseUnconfirmedTx(a.first);
490 });
491 unconfirmedTx.clear();
492
493 for_each(mapInBlockTx.begin(), mapInBlockTx.end(), [&](std::map<uint256, CWalletAccountTxDb>::reference a) {
494 CWalletDB(strWalletFile).EraseUnconfirmedTx(a.first); } );
495
496 mapInBlockTx.clear();
497
498 bestBlock.SetNull();
499
500 if (!IsEncrypted()) {
501 for_each(mapKeys.begin(), mapKeys.end(), [&](std::map<CKeyID, CKeyCombi>::reference item) {
502 CWalletDB(strWalletFile).EraseKeyStoreValue(item.first);
503 });
504 mapKeys.clear();
505 } else {
506 return ERRORMSG("wallet is encrypted hence clear data forbidden!");
507 }
508 return true;
509}
510
511bool CWallet::Sign(const CKeyID &keyId, const uint256 &hash, vector<uint8_t> &signature, bool isMiner) const {
512 CKey key;

Callers

nothing calls this directly

Calls 7

CWalletDBClass · 0.85
EraseUnconfirmedTxMethod · 0.80
EraseKeyStoreValueMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected