|
March 13, 2018, 06:25:35 PM Last edit: March 13, 2018, 08:14:29 PM by startlord |
|
I already generated genesis hash and merkle root using this repository but after compiling and running the core it gave "assertion failed".
Then I used printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());
and hash generated from it was correct but it genrated a debug.log file which had error :-
2018-03-13 16:48:44 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8) 2018-03-13 16:48:44 *** Failed to read block 2018-03-13 16:48:44 Error: Error: A fatal internal error occurred, see debug.log for details
Tracing back to ReadBlockFromDisk I reached to file validation.h and found this function :-
bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos, const Consensus::Params& consensusParams) { block.SetNull();
// Open history file to read CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) return error("ReadBlockFromDisk: OpenBlockFile failed for %s", pos.ToString());
// Read block try { filein >> block; } catch (const std::exception& e) { return error("%s: Deserialize or I/O error - %s at %s", __func__, e.what(), pos.ToString()); }
// Check the header if (!CheckProofOfWork(block.GetPoWHash(), block.nBits, consensusParams)) return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
return true; }
while tracing back to CBlockDiskPos I reached this funtion in chain.h file :-
struct CDiskBlockPos { int nFile; unsigned int nPos;
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(VARINT(nFile)); READWRITE(VARINT(nPos)); }
CDiskBlockPos() { SetNull(); }
CDiskBlockPos(int nFileIn, unsigned int nPosIn) { nFile = nFileIn; nPos = nPosIn; }
friend bool operator==(const CDiskBlockPos &a, const CDiskBlockPos &b) { return ([Suspicious link removed]ile == b.nFile && a.nPos == b.nPos); }
friend bool operator!=(const CDiskBlockPos &a, const CDiskBlockPos &b) { return !(a == b); }
void SetNull() { nFile = -1; nPos = 0; } bool IsNull() const { return (nFile == -1); }
std::string ToString() const { return strprintf("CBlockDiskPos(nFile=%i, nPos=%i)", nFile, nPos); }
};
Now I am trying to figure out what to do next?
|