testutil

package
v0.0.0-...-9307437 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ContractFilesize = 10

ContractFilesize is the default file size of contracts formed with PrepareContractFormation.

Variables

This section is empty.

Functions

func CheckBalance

func CheckBalance(t *testing.T, db explorer.Store, addr types.Address, expectSC, expectImmatureSC types.Currency, expectSF uint64)

CheckBalance checks that an address has the balances we expect.

func CheckFC

func CheckFC(t *testing.T, revision, resolved, valid bool, expected types.FileContract, got explorer.ExtendedFileContract)

CheckFC checks the retrieved file contract with the source file contract in addition to checking the resolved and valid fields.

func CheckTransaction

func CheckTransaction(t *testing.T, expectTxn types.Transaction, gotTxn explorer.Transaction)

CheckTransaction checks the inputs and outputs of the retrieved transaction with the source transaction.

func CheckV2ChainIndices

func CheckV2ChainIndices(t *testing.T, db explorer.Store, txnID types.TransactionID, expected []types.ChainIndex)

CheckV2ChainIndices checks that the chain indices that a v2 transaction was in from the explorer match the expected chain indices.

func CheckV2FC

func CheckV2FC(t *testing.T, expected types.V2FileContract, got explorer.V2FileContract)

CheckV2FC checks the retrieved file contract with the source file contract in addition to checking the resolved and valid fields.

func CheckV2Transaction

func CheckV2Transaction(t *testing.T, expectTxn types.V2Transaction, gotTxn explorer.V2Transaction)

CheckV2Transaction checks the inputs and outputs of the retrieved transaction with the source transaction.

func CreateAnnouncement

func CreateAnnouncement(priv types.PrivateKey, netAddress string) []byte

CreateAnnouncement creates a host announcement.

func Equal

func Equal[T any](t *testing.T, desc string, expect, got T)

Equal checks if two values of the same type are equal and fails otherwise.

func MineBlock

func MineBlock(state consensus.State, txns []types.Transaction, minerAddr types.Address) types.Block

MineBlock mines sets the metadata fields of the block along with the transactions and then generates a valid nonce for the block.

func MineV2Block

func MineV2Block(state consensus.State, txns []types.V2Transaction, minerAddr types.Address) types.Block

MineV2Block mines sets the metadata fields of the block along with the transactions and then generates a valid nonce for the block.

func PrepareContractFormation

func PrepareContractFormation(renterPubKey types.PublicKey, hostKey types.PublicKey, renterPayout, hostCollateral types.Currency, startHeight uint64, endHeight uint64, refundAddr types.Address) types.FileContract

PrepareContractFormation creates a file contract using the specified renter/host keys, payouts, and start/end window. It is an easier to use version of rhp2.PrepareContractFormation because it doesn't require a host settings struct and sets a default file size.

func SignTransaction

func SignTransaction(cs consensus.State, pk types.PrivateKey, txn *types.Transaction)

SignTransaction signs a transaction that does not have any revisions with the specified private key.

func SignTransactionWithContracts

func SignTransactionWithContracts(cs consensus.State, pk, renterPK, hostPK types.PrivateKey, txn *types.Transaction)

SignTransactionWithContracts signs a transaction using the specified private keys, including contract revisions.

func SignV2Transaction

func SignV2Transaction(cs consensus.State, pk types.PrivateKey, txn *types.V2Transaction)

SignV2Transaction signs a transaction that does not have any contracts with the specified private key.

func SignV2TransactionWithContracts

func SignV2TransactionWithContracts(cs consensus.State, pk, renterPK, hostPK types.PrivateKey, txn *types.V2Transaction)

SignV2TransactionWithContracts signs a transaction using the specified private keys, including contracts and revisions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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