github.com/kisexp/xdchain@v0.0.0-20211206025815-490d6b732aa7/consensus/istanbul/qbft/types/common.go (about)

     1  package qbfttypes
     2  
     3  import (
     4  	"math/big"
     5  
     6  	"github.com/kisexp/xdchain/common"
     7  	"github.com/kisexp/xdchain/consensus/istanbul"
     8  )
     9  
    10  // Data that is common to all QBFT messages. Used for composition.
    11  type CommonPayload struct {
    12  	code      uint64
    13  	source    common.Address
    14  	Sequence  *big.Int
    15  	Round     *big.Int
    16  	signature []byte
    17  }
    18  
    19  func (m *CommonPayload) Code() uint64 {
    20  	return m.code
    21  }
    22  
    23  func (m *CommonPayload) Source() common.Address {
    24  	return m.source
    25  }
    26  
    27  func (m *CommonPayload) SetSource(address common.Address) {
    28  	m.source = address
    29  }
    30  
    31  func (m *CommonPayload) View() istanbul.View {
    32  	return istanbul.View{Sequence: m.Sequence, Round: m.Round}
    33  }
    34  
    35  func (m *CommonPayload) Signature() []byte {
    36  	return m.signature
    37  }
    38  
    39  func (m *CommonPayload) SetSignature(signature []byte) {
    40  	m.signature = signature
    41  }