Documentation
¶
Index ¶
- func MineBlocks(tb testing.TB, cm *chain.Manager, addr types.Address, n int)
- func Network() (*consensus.Network, types.Block)
- func ServeSiaMux(tb testing.TB, s *rhp4.Server, log *zap.Logger) string
- func V2Network() (*consensus.Network, types.Block)
- type EphemeralContractor
- func (ec *EphemeralContractor) AccountBalance(account proto4.Account) (types.Currency, error)
- func (ec *EphemeralContractor) AddV2Contract(formationSet rhp4.TransactionSet, _ proto4.Usage) error
- func (ec *EphemeralContractor) CreditAccountsWithContract(deposits []proto4.AccountDeposit, contractID types.FileContractID, ...) ([]types.Currency, error)
- func (ec *EphemeralContractor) DebitAccount(account proto4.Account, usage proto4.Usage) error
- func (ec *EphemeralContractor) LockV2Contract(contractID types.FileContractID) (rhp4.RevisionState, func(), error)
- func (ec *EphemeralContractor) RenewV2Contract(renewalSet rhp4.TransactionSet, _ proto4.Usage) error
- func (ec *EphemeralContractor) ReviseV2Contract(contractID types.FileContractID, revision types.V2FileContract, ...) error
- func (ec *EphemeralContractor) Tip() types.ChainIndex
- func (ec *EphemeralContractor) UpdateChainState(reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
- func (ec *EphemeralContractor) V2FileContractElement(contractID types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error)
- type EphemeralPeerStore
- func (ps *EphemeralPeerStore) AddPeer(addr string) error
- func (ps *EphemeralPeerStore) Ban(addr string, duration time.Duration, reason string) error
- func (ps *EphemeralPeerStore) Banned(addr string) (bool, error)
- func (ps *EphemeralPeerStore) PeerInfo(addr string) (syncer.PeerInfo, error)
- func (ps *EphemeralPeerStore) Peers() ([]syncer.PeerInfo, error)
- func (ps *EphemeralPeerStore) UpdatePeerInfo(addr string, fn func(*syncer.PeerInfo)) error
- type EphemeralSectorStore
- type EphemeralSettingsReporter
- type EphemeralWalletStore
- func (es *EphemeralWalletStore) Tip() (types.ChainIndex, error)
- func (es *EphemeralWalletStore) UnspentSiacoinElements() (utxos []types.SiacoinElement, _ error)
- func (es *EphemeralWalletStore) UpdateChainState(fn func(ux wallet.UpdateTx) error) error
- func (es *EphemeralWalletStore) WalletEventCount() (uint64, error)
- func (es *EphemeralWalletStore) WalletEvents(offset, limit int) ([]wallet.Event, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MineBlocks ¶ added in v0.2.2
MineBlocks mines n blocks with the reward going to the given address.
func ServeSiaMux ¶ added in v0.4.0
ServeSiaMux starts a RHP4 host listening on a random port and returns the address.
Types ¶
type EphemeralContractor ¶ added in v0.4.0
type EphemeralContractor struct {
// contains filtered or unexported fields
}
An EphemeralContractor is an in-memory minimal rhp4.Contractor for testing.
func NewEphemeralContractor ¶ added in v0.4.0
func NewEphemeralContractor(cm *chain.Manager) *EphemeralContractor
NewEphemeralContractor creates an EphemeralContractor for testing.
func (*EphemeralContractor) AccountBalance ¶ added in v0.4.0
AccountBalance returns the balance of an account.
func (*EphemeralContractor) AddV2Contract ¶ added in v0.4.0
func (ec *EphemeralContractor) AddV2Contract(formationSet rhp4.TransactionSet, _ proto4.Usage) error
AddV2Contract adds a new contract to the host.
func (*EphemeralContractor) CreditAccountsWithContract ¶ added in v0.4.0
func (ec *EphemeralContractor) CreditAccountsWithContract(deposits []proto4.AccountDeposit, contractID types.FileContractID, revision types.V2FileContract, _ proto4.Usage) ([]types.Currency, error)
CreditAccountsWithContract credits accounts with the given deposits and revises the contract revision. The contract must be locked before calling this method.
func (*EphemeralContractor) DebitAccount ¶ added in v0.4.0
DebitAccount debits an account by the given amount.
func (*EphemeralContractor) LockV2Contract ¶ added in v0.4.0
func (ec *EphemeralContractor) LockV2Contract(contractID types.FileContractID) (rhp4.RevisionState, func(), error)
LockV2Contract locks a contract and returns its current state.
func (*EphemeralContractor) RenewV2Contract ¶ added in v0.4.0
func (ec *EphemeralContractor) RenewV2Contract(renewalSet rhp4.TransactionSet, _ proto4.Usage) error
RenewV2Contract finalizes an existing contract and adds the renewed contract to the host. The existing contract must be locked before calling this method.
func (*EphemeralContractor) ReviseV2Contract ¶ added in v0.4.0
func (ec *EphemeralContractor) ReviseV2Contract(contractID types.FileContractID, revision types.V2FileContract, roots []types.Hash256, _ proto4.Usage) error
ReviseV2Contract atomically revises a contract and updates its sector roots and usage.
func (*EphemeralContractor) Tip ¶ added in v0.4.0
func (ec *EphemeralContractor) Tip() types.ChainIndex
Tip returns the current chain tip.
func (*EphemeralContractor) UpdateChainState ¶ added in v0.4.0
func (ec *EphemeralContractor) UpdateChainState(reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
UpdateChainState updates the EphemeralContractor's state based on the reverted and applied chain updates.
func (*EphemeralContractor) V2FileContractElement ¶ added in v0.6.0
func (ec *EphemeralContractor) V2FileContractElement(contractID types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error)
V2FileContractElement returns the contract state element for the given contract ID.
type EphemeralPeerStore ¶ added in v0.8.0
type EphemeralPeerStore struct {
// contains filtered or unexported fields
}
A EphemeralPeerStore is an in-memory implementation of a PeerStore.
func NewEphemeralPeerStore ¶ added in v0.8.0
func NewEphemeralPeerStore() *EphemeralPeerStore
NewEphemeralPeerStore returns a new EphemeralPeerStore.
func (*EphemeralPeerStore) AddPeer ¶ added in v0.8.0
func (ps *EphemeralPeerStore) AddPeer(addr string) error
AddPeer adds a peer to the store. If the peer already exists, nil should be returned.
func (*EphemeralPeerStore) Ban ¶ added in v0.8.0
Ban temporarily bans one or more IPs. The addr should either be a single IP with port (e.g. 1.2.3.4:5678) or a CIDR subnet (e.g. 1.2.3.4/16).
func (*EphemeralPeerStore) Banned ¶ added in v0.8.0
func (ps *EphemeralPeerStore) Banned(addr string) (bool, error)
Banned returns false
func (*EphemeralPeerStore) PeerInfo ¶ added in v0.8.0
func (ps *EphemeralPeerStore) PeerInfo(addr string) (syncer.PeerInfo, error)
PeerInfo returns the metadata for the specified peer or ErrPeerNotFound if the peer wasn't found in the store.
func (*EphemeralPeerStore) Peers ¶ added in v0.8.0
func (ps *EphemeralPeerStore) Peers() ([]syncer.PeerInfo, error)
Peers returns the set of known peers.
func (*EphemeralPeerStore) UpdatePeerInfo ¶ added in v0.8.0
func (ps *EphemeralPeerStore) UpdatePeerInfo(addr string, fn func(*syncer.PeerInfo)) error
UpdatePeerInfo updates the metadata for the specified peer. If the peer is not found, the error should be ErrPeerNotFound.
type EphemeralSectorStore ¶ added in v0.4.0
type EphemeralSectorStore struct {
// contains filtered or unexported fields
}
An EphemeralSectorStore is an in-memory minimal rhp4.SectorStore for testing.
func NewEphemeralSectorStore ¶ added in v0.4.0
func NewEphemeralSectorStore() *EphemeralSectorStore
NewEphemeralSectorStore creates an EphemeralSectorStore for testing.
func (*EphemeralSectorStore) HasSector ¶ added in v0.6.0
func (es *EphemeralSectorStore) HasSector(root types.Hash256) (bool, error)
HasSector checks if a sector is stored in the store.
func (*EphemeralSectorStore) ReadSector ¶ added in v0.4.0
func (es *EphemeralSectorStore) ReadSector(root types.Hash256) (*[proto4.SectorSize]byte, error)
ReadSector reads a sector from the EphemeralSectorStore.
func (*EphemeralSectorStore) StoreSector ¶ added in v0.6.0
func (es *EphemeralSectorStore) StoreSector(root types.Hash256, sector *[proto4.SectorSize]byte, expiration uint64) error
StoreSector stores a sector in the EphemeralSectorStore.
type EphemeralSettingsReporter ¶ added in v0.4.0
type EphemeralSettingsReporter struct {
// contains filtered or unexported fields
}
An EphemeralSettingsReporter is an in-memory minimal rhp4.SettingsReporter for testing.
func NewEphemeralSettingsReporter ¶ added in v0.4.0
func NewEphemeralSettingsReporter() *EphemeralSettingsReporter
NewEphemeralSettingsReporter creates an EphemeralSettingsReporter for testing.
func (*EphemeralSettingsReporter) RHP4Settings ¶ added in v0.4.0
func (esr *EphemeralSettingsReporter) RHP4Settings() proto4.HostSettings
RHP4Settings implements the rhp4.SettingsReporter interface.
func (*EphemeralSettingsReporter) Update ¶ added in v0.4.0
func (esr *EphemeralSettingsReporter) Update(settings proto4.HostSettings)
Update updates the settings reported by the EphemeralSettingsReporter.
type EphemeralWalletStore ¶
type EphemeralWalletStore struct {
// contains filtered or unexported fields
}
An EphemeralWalletStore is a Store that does not persist its state to disk. It is primarily useful for testing or as a reference implementation.
func NewEphemeralWalletStore ¶
func NewEphemeralWalletStore() *EphemeralWalletStore
NewEphemeralWalletStore returns a new EphemeralWalletStore.
func (*EphemeralWalletStore) Tip ¶
func (es *EphemeralWalletStore) Tip() (types.ChainIndex, error)
Tip returns the last indexed tip of the wallet.
func (*EphemeralWalletStore) UnspentSiacoinElements ¶
func (es *EphemeralWalletStore) UnspentSiacoinElements() (utxos []types.SiacoinElement, _ error)
UnspentSiacoinElements returns the wallet's unspent siacoin outputs.
func (*EphemeralWalletStore) UpdateChainState ¶ added in v0.0.4
func (es *EphemeralWalletStore) UpdateChainState(fn func(ux wallet.UpdateTx) error) error
UpdateChainState applies and reverts chain updates to the wallet.
func (*EphemeralWalletStore) WalletEventCount ¶ added in v0.0.2
func (es *EphemeralWalletStore) WalletEventCount() (uint64, error)
WalletEventCount returns the number of events relevant to the wallet.
func (*EphemeralWalletStore) WalletEvents ¶ added in v0.0.2
func (es *EphemeralWalletStore) WalletEvents(offset, limit int) ([]wallet.Event, error)
WalletEvents returns the wallet's events.