github.com/MetalBlockchain/metalgo@v1.11.9/vms/proposervm/summary/state_summary.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package summary
     5  
     6  import "github.com/MetalBlockchain/metalgo/ids"
     7  
     8  var _ StateSummary = (*stateSummary)(nil)
     9  
    10  type StateSummary interface {
    11  	ID() ids.ID
    12  	ForkHeight() uint64
    13  	BlockBytes() []byte
    14  	InnerSummaryBytes() []byte
    15  	Bytes() []byte
    16  }
    17  
    18  type stateSummary struct {
    19  	Height uint64 `serialize:"true"`
    20  	// TODO: Rather than storing the full block here - we should only store
    21  	//       proposervm information. We would then modify the StateSummary
    22  	//       interface to expose the required information to generate the full
    23  	//       block.
    24  	Block        []byte `serialize:"true"`
    25  	InnerSummary []byte `serialize:"true"`
    26  
    27  	id    ids.ID
    28  	bytes []byte
    29  }
    30  
    31  func (s *stateSummary) ID() ids.ID {
    32  	return s.id
    33  }
    34  
    35  func (s *stateSummary) ForkHeight() uint64 {
    36  	return s.Height
    37  }
    38  
    39  func (s *stateSummary) BlockBytes() []byte {
    40  	return s.Block
    41  }
    42  
    43  func (s *stateSummary) InnerSummaryBytes() []byte {
    44  	return s.InnerSummary
    45  }
    46  
    47  func (s *stateSummary) Bytes() []byte {
    48  	return s.bytes
    49  }