1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
func TestCreateMerkleTreeRoot(){ block := &Block{ 2, []byte{}, []byte{}, []byte{}, 1418755780, 404454260, 0, []*Transation{}, }
txin := TXInput{[]byte{},-1,nil} txout := NewTXOutput(subsidy,"first") tx := Transation{nil,[]TXInput{txin},[]TXOutput{*txout}}
txin2 := TXInput{[]byte{},-1,nil} txout2 := NewTXOutput(subsidy,"second") tx2 := Transation{nil,[]TXInput{txin2},[]TXOutput{*txout2}}
var Transations []*Transation
Transations = append(Transations,&tx,&tx2)
block.createMerkelTreeRoot(Transations)
fmt.Printf("%x\n",block.Merkleroot) }
|