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

Function testBlock

protocol/bc/block_test.go:28–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26)
27
28func testBlock() *Block {
29 prog, err := asm.Assemble(txvmtest.SimplePayment)
30 if err != nil {
31 panic(err)
32 }
33 tx, err := NewTx(prog, 3, 100000)
34 if err != nil {
35 panic(err)
36 }
37
38 return &Block{
39 UnsignedBlock: &UnsignedBlock{
40 BlockHeader: &BlockHeader{
41 Version: 3,
42 Height: 1,
43 PreviousBlockId: hashPtr(NewHash([32]byte{1})),
44 TimestampMs: 1000,
45 RefsCount: 1,
46 Runlimit: 50000,
47 TransactionsRoot: hashPtr(NewHash([32]byte{2})),
48 ContractsRoot: hashPtr(NewHash([32]byte{3})),
49 NoncesRoot: hashPtr(NewHash([32]byte{4})),
50 NextPredicate: &Predicate{
51 Version: 1,
52 Quorum: 1,
53 Pubkeys: [][]byte{make([]byte, 64)},
54 },
55 },
56 Transactions: []*Tx{tx},
57 },
58 Arguments: []interface{}{[]byte("a"), int64(5), []*DataItem{{Type: DataType_BYTES, Bytes: []byte("b")}}},
59 }
60}
61
62func TestBlockBytes(t *testing.T) {
63 block := testBlock()

Callers 3

TestBlockBytesFunction · 0.85
TestBlockMarshalFunction · 0.85
TestBlockScanFunction · 0.85

Calls 4

AssembleFunction · 0.92
NewTxFunction · 0.85
NewHashFunction · 0.85
hashPtrFunction · 0.70

Tested by

no test coverage detected