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

Function getblockfailures

src/rpc/rpcblockchain.cpp:852–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850}
851
852Value getblockfailures(const Array& params, bool fHelp) {
853 if (fHelp || params.size() != 1) {
854 throw runtime_error(
855 "getblockfailures \"block height\"\n"
856 "\nGet log failures by block height.\n"
857 "\nArguments:\n"
858 "1.\"block height\" (numberic, required)\n"
859 "\nResult:\n"
860 "\nExamples:\n" +
861 HelpExampleCli("getblockfailures", "100") +
862 "\nAs json rpc call\n" +
863 HelpExampleRpc("getblockfailures", "100"));
864 }
865
866 int height = params[0].get_int();
867 if (height < 0 || height > chainActive.Height())
868 throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range.");
869
870 auto dbIt = MakeDbIterator(pCdMan->pLogCache->executeFailCache);
871
872 Object obj;
873 Array failures;
874 Object failure;
875
876 for (dbIt->First(); dbIt->IsValid(); dbIt->Next()) {
877
878 //CCompositeKVCache<dbk::TX_EXECUTE_FAIL, string, std::pair<uint8_t, string> > executeFailCache;
879 failure.push_back(Pair("txid", dbIt->GetKey().second.GetHex()));
880 failure.push_back(Pair("error_code", dbIt->GetValue().first));
881 failure.push_back(Pair("error_message", dbIt->GetValue().second));
882
883 failures.push_back(failure);
884 }
885
886 obj.push_back(Pair("block_height", height));
887 obj.push_back(Pair("failures", failures));
888
889 return obj;
890}

Callers

nothing calls this directly

Calls 15

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
JSONRPCErrorFunction · 0.85
MakeDbIteratorFunction · 0.85
PairClass · 0.85
get_intMethod · 0.80
HeightMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
FirstMethod · 0.45
IsValidMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected