Documentation ¶
Index ¶
- Variables
- func NewTestingPair(dir string, log *zap.Logger) (*Renter, *Host, error)
- type Consensus
- type Host
- func (h *Host) Accounts() *accounts.AccountManager
- 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) RHP2Addr() string
- func (h *Host) RHP2Settings() (crhp2.HostSettings, error)
- func (h *Host) RHP3Addr() string
- func (h *Host) RHP3PriceTable() (crhp3.HostPriceTable, error)
- func (h *Host) RHP3WSAddr() string
- func (h *Host) Settings() *settings.ConfigManager
- func (h *Host) Storage() *storage.VolumeManager
- func (h *Host) Store() *sqlite.Store
- func (h *Host) UpdateSettings(settings settings.Settings) error
- func (h *Host) WalletAddress() types.Address
- type Miner
- type Node
- func (n *Node) ChainManager() *chain.Manager
- func (n *Node) Close() error
- func (n *Node) ConnectPeer(addr string) error
- func (n *Node) GatewayAddr() string
- func (n *Node) MineBlocks(address types.Address, count int) error
- func (n *Node) TPool() *chain.TransactionPool
- func (n *Node) TipState() consensus.State
- type Renter
- func (r *Renter) Close() error
- func (r *Renter) FormContract(ctx context.Context, hostAddr string, hostKey types.PublicKey, ...) (crhp2.ContractRevision, error)
- func (r *Renter) NewRHP2Session(ctx context.Context, hostAddr string, hostKey types.PublicKey, ...) (*rhp2.RHP2Session, error)
- func (r *Renter) NewRHP3Session(ctx context.Context, hostAddr string, hostKey types.PublicKey) (*rhp3.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) (crhp2.HostSettings, error)
- func (r *Renter) Wallet() *wallet.SingleAddressWallet
- func (r *Renter) WalletAddress() types.Address
- 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), CollateralMultiplier: 2.0, StoragePrice: types.Siacoins(100).Div64(1e12).Div64(blocksPerMonth), EgressPrice: types.Siacoins(100).Div64(1e12), IngressPrice: types.Siacoins(100).Div64(1e12), PriceTableValidity: 2 * time.Minute, AccountExpiry: 30 * 24 * time.Hour, MaxAccountBalance: types.Siacoins(10), SectorCacheSize: 64, }
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 NewEmptyHost ¶ added in v1.0.0
NewEmptyHost initializes a new test host
func (*Host) Accounts ¶ added in v0.2.0
func (h *Host) Accounts() *accounts.AccountManager
Accounts returns the host's account manager
func (*Host) Contracts ¶
func (h *Host) Contracts() *contracts.ContractManager
Contracts returns the host's contract manager
func (*Host) RHP2Settings ¶ added in v0.2.0
func (h *Host) RHP2Settings() (crhp2.HostSettings, error)
RHP2Settings returns the host's current rhp2 settings
func (*Host) RHP3PriceTable ¶ added in v0.2.0
func (h *Host) RHP3PriceTable() (crhp3.HostPriceTable, error)
RHP3PriceTable returns the host's current rhp3 price table
func (*Host) RHP3WSAddr ¶ added in v0.2.0
RHP3WSAddr returns the address of the rhp3 WebSocket listener
func (*Host) Settings ¶ added in v1.0.0
func (h *Host) Settings() *settings.ConfigManager
Settings returns the host's settings manager
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
func (*Node) TPool ¶
func (n *Node) TPool() *chain.TransactionPool
TPool returns the transaction pool
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) (crhp2.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) (*rhp2.RHP2Session, 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) (*rhp3.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) (crhp2.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 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.