test

package
v0.0.0-...-369a1d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package tbtctest contains scenarios meant to be used for Bitcoin-related tests in the pkg/tbtc package. Here are the details of specific scenarios:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deposit

type Deposit struct {
	Utxo                *bitcoin.UnspentTransactionOutput
	Depositor           chain.Address
	BlindingFactor      [8]byte
	WalletPublicKeyHash [20]byte
	RefundPublicKeyHash [20]byte
	RefundLocktime      [4]byte
	Vault               *chain.Address
	ExtraData           *[32]byte
}

Deposit holds the deposit data in the given test scenario.

type DepositSweepTestScenario

type DepositSweepTestScenario struct {
	Title             string
	WalletPublicKey   *ecdsa.PublicKey
	WalletPrivateKey  *big.Int
	WalletMainUtxo    *bitcoin.UnspentTransactionOutput
	Deposits          []*Deposit
	InputTransactions []*bitcoin.Transaction
	Fee               int64
	Signatures        []*bitcoin.SignatureContainer

	ExpectedSigHashes                   []*big.Int
	ExpectedSweepTransaction            *bitcoin.Transaction
	ExpectedSweepTransactionHash        bitcoin.Hash
	ExpectedSweepTransactionWitnessHash bitcoin.Hash
}

DepositSweepTestScenario represents a deposit sweep test scenario.

func LoadDepositSweepTestScenarios

func LoadDepositSweepTestScenarios() ([]*DepositSweepTestScenario, error)

LoadDepositSweepTestScenarios loads all scenarios related with deposit sweep.

func (*DepositSweepTestScenario) UnmarshalJSON

func (dsts *DepositSweepTestScenario) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaling logic to produce a proper DepositSweepTestScenario.

type MovedFundsSweepTestScenario

type MovedFundsSweepTestScenario struct {
	Title             string
	WalletPublicKey   *ecdsa.PublicKey
	MovedFundsUtxo    *bitcoin.UnspentTransactionOutput
	WalletMainUtxo    *bitcoin.UnspentTransactionOutput
	InputTransactions []*bitcoin.Transaction
	Fee               int64
	Signatures        []*bitcoin.SignatureContainer

	ExpectedSigHashes                             []*big.Int
	ExpectedMovedFundsSweepTransaction            *bitcoin.Transaction
	ExpectedMovedFundsSweepTransactionHash        bitcoin.Hash
	ExpectedMovedFundsSweepTransactionWitnessHash bitcoin.Hash
}

MovedFundsSweepTestScenario represents a moved funds sweep test scenario.

func LoadMovedFundsSweepTestScenarios

func LoadMovedFundsSweepTestScenarios() ([]*MovedFundsSweepTestScenario, error)

LoadMovedFundsSweepTestScenarios loads all scenarios related with moved funds sweep.

func (*MovedFundsSweepTestScenario) UnmarshalJSON

func (mfts *MovedFundsSweepTestScenario) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaling logic to produce a proper MovedFundsSweepTestScenario.

type MovingFundsTestScenario

type MovingFundsTestScenario struct {
	Title            string
	WalletPublicKey  *ecdsa.PublicKey
	WalletMainUtxo   *bitcoin.UnspentTransactionOutput
	TargetWallets    [][20]byte
	InputTransaction *bitcoin.Transaction
	Fee              int64
	Signature        *bitcoin.SignatureContainer

	ExpectedSigHash                           *big.Int
	ExpectedMovingFundsTransaction            *bitcoin.Transaction
	ExpectedMovingFundsTransactionHash        bitcoin.Hash
	ExpectedMovingFundsTransactionWitnessHash bitcoin.Hash
}

MovingFundsTestScenario represents a moving funds test scenario.

func LoadMovingFundsTestScenarios

func LoadMovingFundsTestScenarios() ([]*MovingFundsTestScenario, error)

LoadMovingFundsTestScenarios loads all scenarios related with moving funds.

func (*MovingFundsTestScenario) UnmarshalJSON

func (mfts *MovingFundsTestScenario) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaling logic to produce a proper MovingFundsTestScenario.

type RedemptionRequest

type RedemptionRequest struct {
	Redeemer             chain.Address
	RedeemerOutputScript []byte
	RequestedAmount      uint64
	TreasuryFee          uint64
	TxMaxFee             uint64
	RequestedAt          time.Time
}

RedemptionRequest holds the redemption request data in the given test scenario.

type RedemptionTestScenario

type RedemptionTestScenario struct {
	Title              string
	WalletPublicKey    *ecdsa.PublicKey
	WalletPrivateKey   *big.Int
	WalletMainUtxo     *bitcoin.UnspentTransactionOutput
	RedemptionRequests []*RedemptionRequest
	InputTransaction   *bitcoin.Transaction
	FeeShares          []int64
	Signature          *bitcoin.SignatureContainer

	ExpectedSigHash                          *big.Int
	ExpectedRedemptionTransaction            *bitcoin.Transaction
	ExpectedRedemptionTransactionHash        bitcoin.Hash
	ExpectedRedemptionTransactionWitnessHash bitcoin.Hash
}

RedemptionTestScenario represents a redemption test scenario.

func LoadRedemptionTestScenarios

func LoadRedemptionTestScenarios() ([]*RedemptionTestScenario, error)

LoadRedemptionTestScenarios loads all scenarios related with redemption.

func (*RedemptionTestScenario) UnmarshalJSON

func (rts *RedemptionTestScenario) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaling logic to produce a proper RedemptionTestScenario.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL