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

Method Verify

xenomint/types/block.go:84–102  ·  view source on GitHub ↗

Verify verifies the block.

()

Source from the content-addressed store, hash-verified

82
83// Verify verifies the block.
84func (b *Block) Verify() error {
85 // Verify header fields: compare merkle root from queries
86 var hashes []*hash.Hash
87 for _, v := range b.ReadQueries {
88 h := v.Header.Hash()
89 hashes = append(hashes, &h)
90 }
91 for _, v := range b.WriteQueries {
92 h := v.Header.Hash()
93 hashes = append(hashes, &h)
94 }
95 if mroot := merkle.NewMerkle(hashes).GetRoot(); !mroot.IsEqual(
96 &b.SignedBlockHeader.MerkleRoot,
97 ) {
98 return ErrMerkleRootNotMatch
99 }
100 // Verify block header signature
101 return b.SignedBlockHeader.Verify()
102}

Callers

nothing calls this directly

Calls 5

NewMerkleFunction · 0.92
GetRootMethod · 0.80
HashMethod · 0.65
VerifyMethod · 0.65
IsEqualMethod · 0.45

Tested by

no test coverage detected