github.com/MetalBlockchain/metalgo@v1.11.9/vms/platformvm/txs/reward_validator_tx.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package txs
     5  
     6  import (
     7  	"github.com/MetalBlockchain/metalgo/ids"
     8  	"github.com/MetalBlockchain/metalgo/snow"
     9  	"github.com/MetalBlockchain/metalgo/utils/set"
    10  	"github.com/MetalBlockchain/metalgo/vms/components/avax"
    11  )
    12  
    13  var _ UnsignedTx = (*RewardValidatorTx)(nil)
    14  
    15  // RewardValidatorTx is a transaction that represents a proposal to
    16  // remove a validator that is currently validating from the validator set.
    17  //
    18  // If this transaction is accepted and the next block accepted is a Commit
    19  // block, the validator is removed and the address that the validator specified
    20  // receives the staked AVAX as well as a validating reward.
    21  //
    22  // If this transaction is accepted and the next block accepted is an Abort
    23  // block, the validator is removed and the address that the validator specified
    24  // receives the staked AVAX but no reward.
    25  type RewardValidatorTx struct {
    26  	// ID of the tx that created the delegator/validator being removed/rewarded
    27  	TxID ids.ID `serialize:"true" json:"txID"`
    28  
    29  	unsignedBytes []byte // Unsigned byte representation of this data
    30  }
    31  
    32  func (tx *RewardValidatorTx) SetBytes(unsignedBytes []byte) {
    33  	tx.unsignedBytes = unsignedBytes
    34  }
    35  
    36  func (*RewardValidatorTx) InitCtx(*snow.Context) {}
    37  
    38  func (tx *RewardValidatorTx) Bytes() []byte {
    39  	return tx.unsignedBytes
    40  }
    41  
    42  func (*RewardValidatorTx) InputIDs() set.Set[ids.ID] {
    43  	return nil
    44  }
    45  
    46  func (*RewardValidatorTx) Outputs() []*avax.TransferableOutput {
    47  	return nil
    48  }
    49  
    50  func (*RewardValidatorTx) SyntacticVerify(*snow.Context) error {
    51  	return nil
    52  }
    53  
    54  func (tx *RewardValidatorTx) Visit(visitor Visitor) error {
    55  	return visitor.RewardValidatorTx(tx)
    56  }