Documentation ¶
Index ¶
- Variables
- func NewTestingPair(dir string, log *zap.Logger) (*Renter, *Host, error)
- type Consensus
- type Host
- func (h *Host) AddVolume(path string, size uint64) error
- func (h *Host) Close() error
- func (h *Host) Contracts() *contracts.ContractManager
- func (h *Host) PublicKey() types.PublicKey
- func (h *Host) RHPv2Addr() string
- func (h *Host) RHPv2Settings() (crhpv2.HostSettings, error)
- func (h *Host) RHPv3Addr() string
- func (h *Host) RHPv3PriceTable() (crhpv3.HostPriceTable, error)
- func (h *Host) RHPv3WSAddr() string
- func (h *Host) Storage() *storage.VolumeManager
- func (h *Host) UpdateSettings(settings settings.Settings) error
- func (h *Host) WalletAddress() types.Address
- type Miner
- type Node
- type Renter
- func (r *Renter) Close() error
- func (r *Renter) FormContract(ctx context.Context, hostAddr string, hostKey types.PublicKey, ...) (rhpv2.ContractRevision, error)
- func (r *Renter) NewRHP2Session(ctx context.Context, hostAddr string, hostKey types.PublicKey, ...) (*worker.Session, error)
- func (r *Renter) NewRHP3Session(ctx context.Context, hostAddr string, hostKey types.PublicKey) (*rhpv3.Session, error)
- func (r *Renter) PrivateKey() types.PrivateKey
- func (r *Renter) PublicKey() types.PublicKey
- func (r *Renter) Settings(ctx context.Context, hostAddr string, hostKey types.PublicKey) (rhpv2.HostSettings, error)
- func (r *Renter) Wallet() *wallet.SingleAddressWallet
- func (r *Renter) WalletAddress() types.Address
- type TXPool
- func (tp TXPool) AcceptTransactionSet(txns []types.Transaction) error
- func (tp TXPool) RecommendedFee() (fee types.Currency)
- func (tp TXPool) Subscribe(subscriber modules.TransactionPoolSubscriber)
- func (tp TXPool) Transactions() []types.Transaction
- func (tp TXPool) UnconfirmedParents(txn types.Transaction) ([]types.Transaction, error)
- type Wallet
Constants ¶
This section is empty.
Variables ¶
var DefaultSettings = settings.Settings{ AcceptingContracts: true, MaxContractDuration: blocksPerMonth * 3, WindowSize: 144, MaxCollateral: types.Siacoins(5000), ContractPrice: types.Siacoins(1).Div64(4), BaseRPCPrice: types.NewCurrency64(100), SectorAccessPrice: types.NewCurrency64(100), Collateral: types.Siacoins(200).Div64(1e12).Div64(blocksPerMonth), MinStoragePrice: types.Siacoins(100).Div64(1e12).Div64(blocksPerMonth), MinEgressPrice: types.Siacoins(100).Div64(1e12), MinIngressPrice: types.Siacoins(100).Div64(1e12), PriceTableValidity: 30 * time.Second, AccountExpiry: 30 * 24 * time.Hour, MaxAccountBalance: types.Siacoins(10), }
DefaultSettings returns the default settings for the test host
Functions ¶
Types ¶
type Consensus ¶
Consensus defines a minimal interface needed by the miner to interact with the consensus set
type Host ¶
type Host struct { *Node // contains filtered or unexported fields }
A Host is an ephemeral host that can be used for testing.
func (*Host) Contracts ¶
func (h *Host) Contracts() *contracts.ContractManager
Contracts returns the host's contract manager
func (*Host) RHPv2Settings ¶
func (h *Host) RHPv2Settings() (crhpv2.HostSettings, error)
RHPv2Settings returns the host's current RHPv2 settings
func (*Host) RHPv3PriceTable ¶
func (h *Host) RHPv3PriceTable() (crhpv3.HostPriceTable, error)
RHPv3PriceTable returns the host's current RHPv3 price table
func (*Host) RHPv3WSAddr ¶
RHPv3WSAddr returns the address of the RHPv3 WebSocket listener
func (*Host) Storage ¶
func (h *Host) Storage() *storage.VolumeManager
Storage returns the host's storage manager
func (*Host) UpdateSettings ¶
UpdateSettings updates the host's configuration
func (*Host) WalletAddress ¶
WalletAddress returns the host's wallet address
type Miner ¶
type Miner struct {
// contains filtered or unexported fields
}
A Miner is a CPU miner that can mine blocks, sending the reward to a specified address.
func (*Miner) ProcessConsensusChange ¶
func (m *Miner) ProcessConsensusChange(cc modules.ConsensusChange)
ProcessConsensusChange implements modules.ConsensusSetSubscriber.
func (*Miner) ReceiveUpdatedUnconfirmedTransactions ¶
func (m *Miner) ReceiveUpdatedUnconfirmedTransactions(diff *modules.TransactionPoolDiff)
ReceiveUpdatedUnconfirmedTransactions implements modules.TransactionPoolSubscriber
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
A Node is a base Sia node that can be extended by a Renter or Host
func (*Node) ChainManager ¶
ChainManager returns the chain manager
func (*Node) ConnectPeer ¶
ConnectPeer connects the host's gateway to a peer
func (*Node) GatewayAddr ¶
GatewayAddr returns the address of the gateway
func (*Node) MineBlocks ¶
MineBlocks mines n blocks sending the reward to address
type Renter ¶
type Renter struct { *Node // contains filtered or unexported fields }
A Renter is an ephemeral renter that can be used for testing
func (*Renter) FormContract ¶
func (r *Renter) FormContract(ctx context.Context, hostAddr string, hostKey types.PublicKey, renterPayout, hostCollateral types.Currency, duration uint64) (rhpv2.ContractRevision, error)
FormContract forms a contract with the host
func (*Renter) NewRHP2Session ¶
func (r *Renter) NewRHP2Session(ctx context.Context, hostAddr string, hostKey types.PublicKey, contractID types.FileContractID) (*worker.Session, error)
NewRHP2Session creates a new session, locks a contract, and retrieves the host's settings
func (*Renter) NewRHP3Session ¶
func (r *Renter) NewRHP3Session(ctx context.Context, hostAddr string, hostKey types.PublicKey) (*rhpv3.Session, error)
NewRHP3Session creates a new session
func (*Renter) PrivateKey ¶
func (r *Renter) PrivateKey() types.PrivateKey
PrivateKey returns the renter's private key
func (*Renter) Settings ¶
func (r *Renter) Settings(ctx context.Context, hostAddr string, hostKey types.PublicKey) (rhpv2.HostSettings, error)
Settings returns the host's current settings
func (*Renter) Wallet ¶
func (r *Renter) Wallet() *wallet.SingleAddressWallet
Wallet returns the renter's wallet
func (*Renter) WalletAddress ¶
WalletAddress returns the renter's wallet address
type TXPool ¶
type TXPool struct {
// contains filtered or unexported fields
}
TXPool wraps a siad transaction pool with core types.
func (TXPool) AcceptTransactionSet ¶
func (tp TXPool) AcceptTransactionSet(txns []types.Transaction) error
AcceptTransactionSet adds a transaction set to the pool.
func (TXPool) RecommendedFee ¶
RecommendedFee returns the recommended fee for a transaction.
func (TXPool) Subscribe ¶
func (tp TXPool) Subscribe(subscriber modules.TransactionPoolSubscriber)
Subscribe subscribes to the transaction pool.
func (TXPool) Transactions ¶
func (tp TXPool) Transactions() []types.Transaction
Transactions returns all transactions in the pool.
func (TXPool) UnconfirmedParents ¶
func (tp TXPool) UnconfirmedParents(txn types.Transaction) ([]types.Transaction, error)
UnconfirmedParents returns the parents of a transaction in the pool.
type Wallet ¶
type Wallet struct { *Node *wallet.SingleAddressWallet // contains filtered or unexported fields }
A Wallet is an ephemeral wallet that can be used for testing.
func (*Wallet) SendSiacoins ¶
func (w *Wallet) SendSiacoins(outputs []types.SiacoinOutput) (txn types.Transaction, err error)
SendSiacoins helper func to send siacoins from a wallet.