MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / newBlockNode

Function newBlockNode

blockproducer/blocknode.go:37–54  ·  view source on GitHub ↗
(h uint32, b *types.BPBlock, p *blockNode)

Source from the content-addressed store, hash-verified

35}
36
37func newBlockNode(h uint32, b *types.BPBlock, p *blockNode) (node *blockNode) {
38 node = &blockNode{
39 parent: p,
40
41 count: func() uint32 {
42 if p != nil {
43 return p.count + 1
44 }
45 return 0
46 }(),
47 height: h,
48
49 hash: b.SignedHeader.DataHash,
50 txCount: len(b.Transactions),
51 }
52 node.block.Store(b)
53 return
54}
55
56// newNonCacheBlockNode returns a block node without the *types.BPBlock cached.
57func newNonCacheBlockNode(h uint32, b *types.BPBlock, p *blockNode) (node *blockNode) {

Callers 4

TestBlockNodeFunction · 0.70
produceBlockMethod · 0.70
newNonCacheBlockNodeFunction · 0.70
applyBlockMethod · 0.70

Calls

no outgoing calls

Tested by 1

TestBlockNodeFunction · 0.56