Litecoin 硬分叉,Preminet Genesis Block,在发布 Tx 后链被破坏

问题描述 投票:0回答:0

我正在玩弄最新的莱特币代码 (0.21.2.1) 并修改了 Genesis 交易以便我可以使用它,但是当我使用交易并重新启动核心软件时我收到一条错误消息。

2023-02-05T18:23:20Z init message: Rewinding blocks...
2023-02-05T18:23:20Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2023-02-05T18:23:20Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2023-02-05T18:23:20Z init message: Verifying blocks...
2023-02-05T18:23:20Z Verifying last 2 blocks at level 3
2023-02-05T18:23:20Z [0%]...ERROR: VerifyDB(): *** irrecoverable inconsistency in block data at 2, hash=3b3699b72f5f7591c5790d6936ea4328ac2b657bb1e91b19ab4b0c32aa43d884
2023-02-05T18:23:20Z : Corrupted block database detected.
Please restart with -reindex or -reindex-chainstate to recover.
: Corrupted block database detected.
Please restart with -reindex or -reindex-chainstate to recover.
2023-02-05T18:23:20Z Aborted block database rebuild. Exiting.
2023-02-05T18:23:20Z Shutdown: In progress...

第 1 步 - 禁用跳过创世块(validation.cpp)

// Special case for the genesis block, skipping connection of its transactions
    // (its coinbase is unspendable)
    if (block.GetHash() == chainparams.GetConsensus().hashGenesisBlock) {
        if (!fJustCheck)
            view.SetBestBlock(pindex->GetBlockHash());
        // return true; <- comment this line out
}

第 2 步 - 跳过对创世块的前一个块的断言(validation.cpp)

if (block.GetHash() != chainparams.GetConsensus().hashGenesisBlock) {
    assert(pindex->pprev);
        CBlockIndex *pindexBIP34height = pindex->pprev->GetAncestor(chainparams.GetConsensus().BIP34Height);
        //Only continue to enforce if we're below BIP34 activation height or the block hash at that height doesn't correspond.
        fEnforceBIP30 = fEnforceBIP30 && (!pindexBIP34height || !(pindexBIP34height->GetBlockHash() == chainparams.GetConsensus().BIP34Hash));
}

第 3 步 - 跳过为创世块写入撤消数据(validation.cpp)

if (block.GetHash() != chainparams.GetConsensus().hashGenesisBlock)
{
    if (!WriteUndoDataForBlock(blockundo, state, pindex, chainparams))
        return false;
} 

我是否忘记或忽略了什么?使用Genesis TX后链条失效的原因肯定有。 我想让创世块完全可用。很久以前我已经这样做了,但我的印象是有些东西发生了变化。

如果有人能给我一个提示,我必须改变什么,这样创世块就可以像其他块一样使用,那就太好了。

bitcoin cryptocurrency litecoin
© www.soinside.com 2019 - 2024. All rights reserved.