MCPcopy Create free account
hub / github.com/chain/txvm / Block

Function Block

protocol/validation/validation.go:83–95  ·  view source on GitHub ↗

Block validates a block and the transactions within. It does not check the predicate; for that, see ValidateBlockSig.

(b *bc.UnsignedBlock, prev *bc.BlockHeader)

Source from the content-addressed store, hash-verified

81// Block validates a block and the transactions within.
82// It does not check the predicate; for that, see ValidateBlockSig.
83func Block(b *bc.UnsignedBlock, prev *bc.BlockHeader) error {
84 if b.Height > 1 {
85 if prev == nil {
86 return errors.WithDetailf(errNoPrevBlock, "height %d", b.Height)
87 }
88 err := BlockPrev(b, prev)
89 if err != nil {
90 return err
91 }
92 }
93
94 return BlockOnly(b)
95}
96
97// BlockOnly performs those parts of block validation that depend only
98// on the block and not on the previous block header.

Callers 2

validateFunction · 0.92
TestBlockFunction · 0.70

Calls 3

WithDetailfFunction · 0.92
BlockPrevFunction · 0.85
BlockOnlyFunction · 0.85

Tested by 1

TestBlockFunction · 0.56