MCPcopy Create free account
hub / github.com/chain/Core / newInitialBlock

Function newInitialBlock

protocol/validation/block_test.go:74–97  ·  view source on GitHub ↗
(tb testing.TB)

Source from the content-addressed store, hash-verified

72}
73
74func newInitialBlock(tb testing.TB) *bc.Block {
75 script, err := vmutil.BlockMultiSigProgram(nil, 0)
76 if err != nil {
77 tb.Fatal(err)
78 }
79
80 root, err := bc.MerkleRoot(nil) // calculate the zero value of the tx merkle root
81 if err != nil {
82 tb.Fatal(err)
83 }
84
85 b := &legacy.Block{
86 BlockHeader: legacy.BlockHeader{
87 Version: 1,
88 Height: 1,
89 TimestampMS: bc.Millis(time.Now()),
90 BlockCommitment: legacy.BlockCommitment{
91 TransactionsMerkleRoot: root,
92 ConsensusProgram: script,
93 },
94 },
95 }
96 return legacy.MapBlock(b)
97}
98
99func generate(tb testing.TB, prev *bc.Block) *bc.Block {
100 b := &legacy.Block{

Callers 6

TestValidateBlock1Function · 0.85
TestValidateBlock1ErrFunction · 0.85
TestValidateBlock2Function · 0.85
TestValidateBlock2ErrFunction · 0.85
TestValidateBlockSig2Function · 0.85
TestValidateBlockSig2ErrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected