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

Function generate

protocol/validation/validation_test.go:305–321  ·  view source on GitHub ↗
(tb testing.TB, prev *bc.UnsignedBlock)

Source from the content-addressed store, hash-verified

303}
304
305func generate(tb testing.TB, prev *bc.UnsignedBlock) *bc.UnsignedBlock {
306 prevID := prev.Hash()
307 b := &bc.UnsignedBlock{
308 BlockHeader: &bc.BlockHeader{
309 Version: 3,
310 Height: prev.Height + 1,
311 PreviousBlockId: &prevID,
312 TimestampMs: prev.TimestampMs + 1,
313 NextPredicate: prev.NextPredicate,
314 },
315 }
316
317 txRoot := bc.TxMerkleRoot(nil)
318 b.TransactionsRoot = &txRoot
319
320 return b
321}
322
323func mustDecodeHex(str string) []byte {
324 decoded, err := hex.DecodeString(str)

Callers 1

TestBlockFunction · 0.85

Calls 2

TxMerkleRootFunction · 0.92
HashMethod · 0.45

Tested by

no test coverage detected