Files
proto/p/txs/reward_validator_tx.go
zeekay 73a0a922f0 fix: update API to use InitRuntime instead of InitCtx
- Rename InitCtx → InitRuntime throughout
- Update imports for new package versions
- Update utxo/secp256k1fx usage
- Update consensus context references
2026-01-26 09:37:09 -08:00

66 lines
1.8 KiB
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package txs
import (
"context"
"github.com/luxfi/runtime"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
lux "github.com/luxfi/utxo"
)
var _ UnsignedTx = (*RewardValidatorTx)(nil)
// RewardValidatorTx is a transaction that represents a proposal to
// remove a validator that is currently validating from the validator set.
//
// If this transaction is accepted and the next block accepted is a Commit
// block, the validator is removed and the address that the validator specified
// receives the staked LUX as well as a validating reward.
//
// If this transaction is accepted and the next block accepted is an Abort
// block, the validator is removed and the address that the validator specified
// receives the staked LUX but no reward.
type RewardValidatorTx struct {
// ID of the tx that created the delegator/validator being removed/rewarded
TxID ids.ID `serialize:"true" json:"txID"`
unsignedBytes []byte // Unsigned byte representation of this data
}
func (tx *RewardValidatorTx) SetBytes(unsignedBytes []byte) {
tx.unsignedBytes = unsignedBytes
}
func (*RewardValidatorTx) InitRuntime(*runtime.Runtime) {}
func (tx *RewardValidatorTx) Bytes() []byte {
return tx.unsignedBytes
}
func (*RewardValidatorTx) InputIDs() set.Set[ids.ID] {
return nil
}
func (*RewardValidatorTx) Outputs() []*lux.TransferableOutput {
return nil
}
func (*RewardValidatorTx) SyntacticVerify(*runtime.Runtime) error {
return nil
}
func (tx *RewardValidatorTx) Visit(visitor Visitor) error {
return visitor.RewardValidatorTx(tx)
}
// InitializeWithContext initializes the transaction with consensus context
func (tx *RewardValidatorTx) InitializeWithContext(ctx context.Context) error {
// Initialize any context-dependent fields here
return nil
}