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

Function reloadtxcache

src/rpc/rpctx.cpp:830–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828}
829
830Value reloadtxcache(const Array& params, bool fHelp) {
831 if (fHelp || params.size() != 0) {
832 throw runtime_error("reloadtxcache \n"
833 "\nreload transactions catch\n"
834 "\nArguments:\n"
835 "\nResult:\n"
836 "\nExamples:\n"
837 + HelpExampleCli("reloadtxcache", "")
838 + HelpExampleRpc("reloadtxcache", ""));
839 }
840 pCdMan->pTxCache->Clear();
841 CBlockIndex *pIndex = chainActive.Tip();
842 if (chainActive.Height() - SysCfg().GetTxCacheHeight() >= 0) {
843 pIndex = chainActive[(chainActive.Height() - SysCfg().GetTxCacheHeight())];
844 } else {
845 pIndex = chainActive.Genesis();
846 }
847
848 CBlock block;
849 do {
850 if (!ReadBlockFromDisk(pIndex, block))
851 return ERRORMSG("reloadtxcache() : *** ReadBlockFromDisk failed at %d, hash=%s",
852 pIndex->height, pIndex->GetBlockHash().ToString());
853
854 pCdMan->pTxCache->AddBlockTx(block);
855 pIndex = chainActive.Next(pIndex);
856 } while (nullptr != pIndex);
857
858 Object obj;
859 obj.push_back(Pair("info", "reload tx cache succeed"));
860 return obj;
861}
862
863Value getcontractdata(const Array& params, bool fHelp) {
864 if (fHelp || (params.size() != 2 && params.size() != 3)) {

Callers

nothing calls this directly

Calls 15

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
ReadBlockFromDiskFunction · 0.85
PairClass · 0.85
TipMethod · 0.80
HeightMethod · 0.80
GetTxCacheHeightMethod · 0.80
GenesisMethod · 0.80
AddBlockTxMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected