6 "github.com/bytom/encoding/blockchain"
7 "github.com/bytom/protocol/bc"
10 // BlockCommitment store the TransactionsMerkleRoot && AssetsMerkleRoot
11 type BlockCommitment struct {
12 // TransactionsMerkleRoot is the root hash of the Merkle binary hash
13 // tree formed by the hashes of all transactions included in the
15 TransactionsMerkleRoot bc.Hash
17 // AssetsMerkleRoot is the root hash of the Merkle Patricia Tree of
18 // the set of unspent outputs with asset version 1 after applying
20 AssetsMerkleRoot bc.Hash
23 func (bc *BlockCommitment) readFrom(r *blockchain.Reader) error {
24 if _, err := bc.TransactionsMerkleRoot.ReadFrom(r); err != nil {
27 _, err := bc.AssetsMerkleRoot.ReadFrom(r)
31 func (bc *BlockCommitment) writeTo(w io.Writer) error {
32 _, err := bc.TransactionsMerkleRoot.WriteTo(w)
36 _, err = bc.AssetsMerkleRoot.WriteTo(w)