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

Function readblock

src/tests/ptests/Mining_tests.cpp:86–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86bool readblock(const string &filePath)
87{
88 CBlock block;
89 FILE* fp = fopen(filePath.c_str(), "rb");
90 if (!fp) return false;
91
92 fseek(fp, 8, SEEK_SET); // skip msgheader/size
93
94 CAutoFile filein = CAutoFile(fp, SER_DISK, CLIENT_VERSION);
95 if (!filein) return false;
96 while(!feof(fp)) {
97 filein >> block;
98 CDataStream ds(SER_DISK, CLIENT_VERSION);
99 ds << block;
100 vector<string> param;
101 param.push_back(HexStr(ds));
102 SubmitBlock(param);
103 }
104 return true;
105}
106
107class CMiningTest {
108public:

Callers

nothing calls this directly

Calls 5

fopenFunction · 0.85
CAutoFileClass · 0.85
HexStrFunction · 0.85
SubmitBlockFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected