MCPcopy Create free account
hub / github.com/DNAProject/DNA / addBlock

Method addBlock

p2pserver/block_sync.go:266–279  ·  view source on GitHub ↗
(nodeID uint64, block *types.Block,
	merkleRoot common.Uint256)

Source from the content-addressed store, hash-verified

264}
265
266func (this *BlockCache) addBlock(nodeID uint64, block *types.Block,
267 merkleRoot common.Uint256) bool {
268 this.delBlockLocked(block.Header.Height)
269 blockInfo := &BlockInfo{
270 nodeID: nodeID,
271 block: block,
272 merkleRoot: merkleRoot,
273 }
274 this.blocksCache[block.Header.Height] = blockInfo
275 if block.Header.TransactionsRoot == common.UINT256_EMPTY {
276 this.emptyBlockAmount += 1
277 }
278 return true
279}
280
281func (this *BlockSyncMgr) clearBlocks(curBlockHeight uint32) {
282 this.lock.Lock()

Callers 1

addBlockCacheMethod · 0.80

Calls 1

delBlockLockedMethod · 0.95

Tested by

no test coverage detected