mirror of https://github.com/poanetwork/gecko.git
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package snowstorm
|
|
|
|
import (
|
|
"github.com/ava-labs/gecko/ids"
|
|
"github.com/ava-labs/gecko/snow/choices"
|
|
)
|
|
|
|
// TestTx is a useful test transaction
|
|
type TestTx struct {
|
|
Identifier ids.ID
|
|
Deps []Tx
|
|
Ins ids.Set
|
|
Stat choices.Status
|
|
Bits []byte
|
|
}
|
|
|
|
// ID implements the Consumer interface
|
|
func (tx *TestTx) ID() ids.ID { return tx.Identifier }
|
|
|
|
// Dependencies implements the Consumer interface
|
|
func (tx *TestTx) Dependencies() []Tx { return tx.Deps }
|
|
|
|
// InputIDs implements the Consumer interface
|
|
func (tx *TestTx) InputIDs() ids.Set { return tx.Ins }
|
|
|
|
// Status implements the Consumer interface
|
|
func (tx *TestTx) Status() choices.Status { return tx.Stat }
|
|
|
|
// Accept implements the Consumer interface
|
|
func (tx *TestTx) Accept() { tx.Stat = choices.Accepted }
|
|
|
|
// Reject implements the Consumer interface
|
|
func (tx *TestTx) Reject() { tx.Stat = choices.Rejected }
|
|
|
|
// Reset sets the status to pending
|
|
func (tx *TestTx) Reset() { tx.Stat = choices.Processing }
|
|
|
|
// Verify returns nil
|
|
func (tx *TestTx) Verify() error { return nil }
|
|
|
|
// Bytes returns the bits
|
|
func (tx *TestTx) Bytes() []byte { return tx.Bits }
|