github.com/mavryk-network/mvgo@v1.19.9/rpc/endorsement.go (about)

     1  // Copyright (c) 2020-2024 Blockwatch Data Inc.
     2  // Author: alex@blockwatch.cc
     3  
     4  package rpc
     5  
     6  import "github.com/mavryk-network/mvgo/mavryk"
     7  
     8  // Ensure Endorsement implements the TypedOperation interface.
     9  var _ TypedOperation = (*Endorsement)(nil)
    10  
    11  // Endorsement represents an endorsement operation
    12  type Endorsement struct {
    13  	Generic
    14  	Level          int64               `json:"level"`                 // <= v008, v012+
    15  	Endorsement    *InlinedEndorsement `json:"endorsement,omitempty"` // v009+
    16  	Slot           int                 `json:"slot"`                  // v009+
    17  	Round          int                 `json:"round"`                 // v012+
    18  	PayloadHash    mavryk.PayloadHash  `json:"block_payload_hash"`    // v012+
    19  	DalAttestation mavryk.Z            `json:"dal_attestation"`       // v019+
    20  }
    21  
    22  func (e Endorsement) GetLevel() int64 {
    23  	if e.Endorsement != nil {
    24  		return e.Endorsement.Operations.Level
    25  	}
    26  	return e.Level
    27  }
    28  
    29  // InlinedEndorsement represents and embedded endorsement
    30  type InlinedEndorsement struct {
    31  	Branch     mavryk.BlockHash `json:"branch"`     // the double block
    32  	Operations Endorsement      `json:"operations"` // only level and kind are set
    33  	Signature  mavryk.Signature `json:"signature"`
    34  }