diff --git a/blockchain/chainio.go b/blockchain/chainio.go index 5d2c033c..9ce58b12 100644 --- a/blockchain/chainio.go +++ b/blockchain/chainio.go @@ -1277,8 +1277,7 @@ func (b *BlockChain) initChainState() error { if err != nil { return err } - var block wire.MsgBlock - err = block.Deserialize(bytes.NewReader(blockBytes)) + block, err := btcutil.NewBlockFromBytes(blockBytes) if err != nil { return err } @@ -1304,8 +1303,8 @@ func (b *BlockChain) initChainState() error { // Initialize the state related to the best block. blockSize := uint64(len(blockBytes)) - blockWeight := uint64(GetBlockWeight(btcutil.NewBlock(&block))) - numTxns := uint64(len(block.Transactions)) + blockWeight := uint64(GetBlockWeight(block)) + numTxns := uint64(len(block.MsgBlock().Transactions)) b.stateSnapshot = newBestState(tip, blockSize, blockWeight, numTxns, state.totalTxns, CalcPastMedianTime(tip))