Documentation
¶
Index ¶
- Constants
- Variables
- type Alerts
- type ChainManager
- type Contract
- type ContractFilter
- type ContractStatus
- type ContractStore
- type ContractUpdater
- func (cu *ContractUpdater) AppendSector(root types.Hash256)
- func (cu *ContractUpdater) Close() error
- func (cu *ContractUpdater) Commit(revision SignedRevision, usage Usage) error
- func (cu *ContractUpdater) MerkleRoot() types.Hash256
- func (cu *ContractUpdater) SectorCount() uint64
- func (cu *ContractUpdater) SectorRoot(i uint64) (types.Hash256, error)
- func (cu *ContractUpdater) SectorRoots() []types.Hash256
- func (cu *ContractUpdater) SwapSectors(a, b uint64) error
- func (cu *ContractUpdater) TrimSectors(n uint64) error
- func (cu *ContractUpdater) UpdateSector(root types.Hash256, i uint64) error
- type IntegrityResult
- type LifecycleActions
- type Manager
- func (cm *Manager) AccountBalance(account proto4.Account) (types.Currency, error)
- func (cm *Manager) AddContract(revision SignedRevision, formationSet []types.Transaction, ...) error
- func (cm *Manager) AddV2Contract(formation rhp4.TransactionSet, usage proto4.Usage) error
- func (cm *Manager) CheckIntegrity(ctx context.Context, contractID types.FileContractID) (<-chan IntegrityResult, uint64, error)
- func (cm *Manager) Close() error
- func (cm *Manager) Contract(id types.FileContractID) (Contract, error)
- func (cm *Manager) Contracts(filter ContractFilter) ([]Contract, int, error)
- func (cm *Manager) CreditAccountsWithContract(deposits []proto4.AccountDeposit, contractID types.FileContractID, ...) ([]types.Currency, error)
- func (cm *Manager) DebitAccount(account proto4.Account, usage proto4.Usage) error
- func (cm *Manager) Lock(ctx context.Context, id types.FileContractID) (SignedRevision, error)deprecated
- func (cm *Manager) LockV2Contract(id types.FileContractID) (rev rhp4.RevisionState, unlock func(), _ error)
- func (cm *Manager) ProcessActions(index types.ChainIndex) error
- func (cm *Manager) RenewContract(renewal SignedRevision, existing SignedRevision, ...) error
- func (cm *Manager) RenewV2Contract(renewal rhp4.TransactionSet, usage proto4.Usage) error
- func (cm *Manager) ReviseContract(contractID types.FileContractID) (*ContractUpdater, error)
- func (cm *Manager) ReviseV2Contract(contractID types.FileContractID, revision types.V2FileContract, ...) error
- func (cm *Manager) SectorRoots(id types.FileContractID) []types.Hash256
- func (cm *Manager) Unlock(id types.FileContractID)deprecated
- func (cm *Manager) UpdateChainState(tx UpdateStateTx, reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
- func (cm *Manager) V2Contract(id types.FileContractID) (V2Contract, error)
- func (cm *Manager) V2FileContractElement(id types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error)
- type ManagerOption
- type SectorAction
- type SectorChange
- type SignedRevision
- type StateChanges
- type StorageManager
- type Syncer
- type UpdateStateTx
- type Usage
- type V2Contract
- type V2ContractFilter
- type V2ContractStatus
- type Wallet
Constants ¶
const ( ContractSortStatus = "status" ContractSortNegotiationHeight = "negotiationHeight" ContractSortExpirationHeight = "expirationHeight" )
fields that the contracts can be sorted by.
Variables ¶
var ( // ErrNotFound is returned by the contract store when a contract is not // found. ErrNotFound = errors.New("contract not found") // ErrContractExists is returned by the contract store during formation when // the contract already exists. ErrContractExists = errors.New("contract already exists") )
Functions ¶
This section is empty.
Types ¶
type ChainManager ¶
type ChainManager interface { Tip() types.ChainIndex TipState() consensus.State BestIndex(height uint64) (types.ChainIndex, bool) UnconfirmedParents(txn types.Transaction) []types.Transaction AddPoolTransactions([]types.Transaction) (known bool, err error) AddV2PoolTransactions(types.ChainIndex, []types.V2Transaction) (known bool, err error) RecommendedFee() types.Currency }
ChainManager defines the interface required by the contract manager to interact with the consensus set.
type Contract ¶
type Contract struct { SignedRevision Status ContractStatus `json:"status"` LockedCollateral types.Currency `json:"lockedCollateral"` Usage Usage `json:"usage"` // NegotiationHeight is the height the contract was negotiated at. NegotiationHeight uint64 `json:"negotiationHeight"` // FormationConfirmed is true if the contract formation transaction // has been confirmed on the blockchain. FormationConfirmed bool `json:"formationConfirmed"` // RevisionConfirmed is true if the contract revision transaction has // been confirmed on the blockchain. RevisionConfirmed bool `json:"revisionConfirmed"` // ResolutionHeight is the height the storage proof was confirmed // at. If the contract has not been resolved, the field is the zero // value. ResolutionHeight uint64 `json:"resolutionHeight"` // RenewedTo is the ID of the contract that renewed this contract. If // this contract was not renewed, this field is the zero value. RenewedTo types.FileContractID `json:"renewedTo"` // RenewedFrom is the ID of the contract that this contract renewed. If // this contract is not a renewal, the field is the zero value. RenewedFrom types.FileContractID `json:"renewedFrom"` }
A Contract contains metadata on the current state of a file contract.
type ContractFilter ¶
type ContractFilter struct { // filters Statuses []ContractStatus `json:"statuses"` ContractIDs []types.FileContractID `json:"contractIDs"` RenewedFrom []types.FileContractID `json:"renewedFrom"` RenewedTo []types.FileContractID `json:"renewedTo"` RenterKey []types.PublicKey `json:"renterKey"` MinNegotiationHeight uint64 `json:"minNegotiationHeight"` MaxNegotiationHeight uint64 `json:"maxNegotiationHeight"` MinExpirationHeight uint64 `json:"minExpirationHeight"` MaxExpirationHeight uint64 `json:"maxExpirationHeight"` // pagination Limit int `json:"limit"` Offset int `json:"offset"` // sorting SortField string `json:"sortField"` SortDesc bool `json:"sortDesc"` }
ContractFilter defines the filter criteria for a contract query.
type ContractStatus ¶
type ContractStatus uint8
ContractStatus is an enum that indicates the current status of a contract.
const ( // ContractStatusPending indicates that the contract has been formed but // has not yet been confirmed on the blockchain. The contract is still // usable, but there is a risk that the contract will never be confirmed. ContractStatusPending ContractStatus = iota // ContractStatusRejected indicates that the contract formation transaction // was never confirmed on the blockchain ContractStatusRejected // ContractStatusActive indicates that the contract has been confirmed on // the blockchain and is currently active. ContractStatusActive // ContractStatusSuccessful indicates that a storage proof has been // confirmed or the contract expired without requiring the host to burn // Siacoin (e.g. renewal, unused contracts). ContractStatusSuccessful // ContractStatusFailed indicates that the contract ended without a storage proof // and the host was required to burn Siacoin. ContractStatusFailed )
ContractStatus is an enum that indicates the current status of a contract.
func (ContractStatus) MarshalJSON ¶
func (c ContractStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (ContractStatus) String ¶
func (c ContractStatus) String() string
String returns the string representation of a ContractStatus.
func (*ContractStatus) UnmarshalJSON ¶
func (c *ContractStatus) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type ContractStore ¶
type ContractStore interface { // ContractActions returns the lifecycle actions for the contract at the // given index. ContractActions(index types.ChainIndex, revisionBroadcastHeight uint64) (LifecycleActions, error) // ContractChainIndexElement returns the chain index element for the given height. ContractChainIndexElement(types.ChainIndex) (types.ChainIndexElement, error) // SectorRoots returns the sector roots for a contract. If limit is 0, all roots // are returned. SectorRoots() (map[types.FileContractID][]types.Hash256, error) // Contracts returns a paginated list of contracts sorted by expiration // asc. Contracts(ContractFilter) ([]Contract, int, error) // Contract returns the contract with the given ID. Contract(types.FileContractID) (Contract, error) // AddContract stores the provided contract, should error if the contract // already exists in the store. AddContract(revision SignedRevision, formationSet []types.Transaction, lockedCollateral types.Currency, initialUsage Usage, negotationHeight uint64) error // RenewContract renews a contract. It is expected that the existing // contract will be cleared. RenewContract(renewal SignedRevision, existing SignedRevision, formationSet []types.Transaction, lockedCollateral types.Currency, clearingUsage, initialUsage Usage, negotationHeight uint64) error // ReviseContract atomically updates a contract and its associated // sector roots. ReviseContract(revision SignedRevision, oldRoots []types.Hash256, usage Usage, sectorChanges []SectorChange) error // ExpireContractSectors removes sector roots for any contracts that are // rejected or past their proof window. ExpireContractSectors(height uint64) error // V2ContractElement returns the latest v2 state element with the given ID. V2ContractElement(types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error) // V2Contract returns the v2 contract with the given ID. V2Contract(types.FileContractID) (V2Contract, error) // AddV2Contract stores the provided contract, should error if the contract // already exists in the store. AddV2Contract(V2Contract, rhp4.TransactionSet) error // RenewV2Contract renews a contract. It is expected that the existing // contract will be cleared. RenewV2Contract(renewal V2Contract, renewalSet rhp4.TransactionSet, renewedID types.FileContractID, roots []types.Hash256) error // ReviseV2Contract atomically updates a contract and its associated // sector roots. ReviseV2Contract(id types.FileContractID, revision types.V2FileContract, oldRoots, newRoots []types.Hash256, usage proto4.Usage) error // ExpireV2ContractSectors removes sector roots for any v2 contracts that are // rejected or past their proof window. ExpireV2ContractSectors(height uint64) error // RHP4AccountBalance returns the balance of an account. RHP4AccountBalance(proto4.Account) (types.Currency, error) // RHP4CreditAccounts atomically revises a contract and credits the accounts RHP4CreditAccounts([]proto4.AccountDeposit, types.FileContractID, types.V2FileContract) (balances []types.Currency, err error) // RHP4DebitAccount debits an account. RHP4DebitAccount(proto4.Account, proto4.Usage) error }
A ContractStore stores contracts for the host. It also updates stored contracts and determines which contracts need lifecycle actions.
type ContractUpdater ¶
type ContractUpdater struct {
// contains filtered or unexported fields
}
A ContractUpdater is used to atomically update a contract's sectors and metadata.
func (*ContractUpdater) AppendSector ¶
func (cu *ContractUpdater) AppendSector(root types.Hash256)
AppendSector appends a sector to the contract.
func (*ContractUpdater) Close ¶
func (cu *ContractUpdater) Close() error
Close must be called when the contract updater is no longer needed.
func (*ContractUpdater) Commit ¶
func (cu *ContractUpdater) Commit(revision SignedRevision, usage Usage) error
Commit atomically applies all changes to the contract store.
func (*ContractUpdater) MerkleRoot ¶
func (cu *ContractUpdater) MerkleRoot() types.Hash256
MerkleRoot returns the merkle root of the contract's sector roots.
func (*ContractUpdater) SectorCount ¶
func (cu *ContractUpdater) SectorCount() uint64
SectorCount returns the number of sectors in the contract.
func (*ContractUpdater) SectorRoot ¶
func (cu *ContractUpdater) SectorRoot(i uint64) (types.Hash256, error)
SectorRoot returns the Merkle root of the sector at the given index.
func (*ContractUpdater) SectorRoots ¶
func (cu *ContractUpdater) SectorRoots() []types.Hash256
SectorRoots returns a copy of the current state of the contract's sector roots.
func (*ContractUpdater) SwapSectors ¶
func (cu *ContractUpdater) SwapSectors(a, b uint64) error
SwapSectors swaps the sectors at the given indices.
func (*ContractUpdater) TrimSectors ¶
func (cu *ContractUpdater) TrimSectors(n uint64) error
TrimSectors removes the last n sectors from the contract.
func (*ContractUpdater) UpdateSector ¶
func (cu *ContractUpdater) UpdateSector(root types.Hash256, i uint64) error
UpdateSector updates the Merkle root of the sector at the given index.
type IntegrityResult ¶
type IntegrityResult struct { ExpectedRoot types.Hash256 `json:"expectedRoot"` ActualRoot types.Hash256 `json:"actualRoot"` Error error `json:"error"` }
An IntegrityResult contains the result of an integrity check for a contract sector.
func (IntegrityResult) MarshalJSON ¶
func (i IntegrityResult) MarshalJSON() ([]byte, error)
MarshalJSON implements a custom json.Marshaler to handle the error interface.
func (*IntegrityResult) UnmarshalJSON ¶
func (i *IntegrityResult) UnmarshalJSON(b []byte) error
UnmarshalJSON implements a custom json.Unmarshaler to handle the error interface.
type LifecycleActions ¶
type LifecycleActions struct { RebroadcastFormation [][]types.Transaction BroadcastRevision []SignedRevision BroadcastProof []SignedRevision // V2 actions RebroadcastV2Formation []rhp4.TransactionSet BroadcastV2Revision []types.V2FileContractRevision BroadcastV2Proof []types.V2FileContractElement BroadcastV2Expiration []types.V2FileContractElement }
LifecycleActions contains the actions that need to be taken to maintain the lifecycle of active contracts.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager manages contracts' lifecycle
func NewManager ¶
func NewManager(store ContractStore, storage StorageManager, chain ChainManager, syncer Syncer, wallet Wallet, opts ...ManagerOption) (*Manager, error)
NewManager creates a new contract manager.
func (*Manager) AccountBalance ¶
AccountBalance returns the balance of an account.
func (*Manager) AddContract ¶
func (cm *Manager) AddContract(revision SignedRevision, formationSet []types.Transaction, lockedCollateral types.Currency, initialUsage Usage) error
AddContract stores the provided contract, should error if the contract already exists.
func (*Manager) AddV2Contract ¶
AddV2Contract stores the provided contract, should error if the contract already exists.
func (*Manager) CheckIntegrity ¶
func (cm *Manager) CheckIntegrity(ctx context.Context, contractID types.FileContractID) (<-chan IntegrityResult, uint64, error)
CheckIntegrity checks the integrity of a contract's sector roots on disk. The result of every checked sector is sent on the returned channel. The channel is closed when all checks are complete.
func (*Manager) Contract ¶
func (cm *Manager) Contract(id types.FileContractID) (Contract, error)
Contract returns the contract with the given id.
func (*Manager) Contracts ¶
func (cm *Manager) Contracts(filter ContractFilter) ([]Contract, int, error)
Contracts returns a paginated list of contracts matching the filter and the total number of contracts matching the filter.
func (*Manager) CreditAccountsWithContract ¶
func (cm *Manager) CreditAccountsWithContract(deposits []proto4.AccountDeposit, contractID types.FileContractID, revision types.V2FileContract) ([]types.Currency, error)
CreditAccountsWithContract atomically revises a contract and credits the accounts returning the new balance of each account.
func (*Manager) DebitAccount ¶
DebitAccount debits an account.
func (*Manager) Lock
deprecated
func (cm *Manager) Lock(ctx context.Context, id types.FileContractID) (SignedRevision, error)
Lock locks a contract for modification.
Deprecated: Use LockV2Contract instead.
func (*Manager) LockV2Contract ¶
func (cm *Manager) LockV2Contract(id types.FileContractID) (rev rhp4.RevisionState, unlock func(), _ error)
LockV2Contract locks a contract for modification. The returned unlock function must be called to release the lock.
func (*Manager) ProcessActions ¶
func (cm *Manager) ProcessActions(index types.ChainIndex) error
ProcessActions processes additional lifecycle actions after a new block is added to the index.
func (*Manager) RenewContract ¶
func (cm *Manager) RenewContract(renewal SignedRevision, existing SignedRevision, formationSet []types.Transaction, lockedCollateral types.Currency, clearingUsage, initialUsage Usage) error
RenewContract renews a contract. It is expected that the existing contract will be cleared.
func (*Manager) RenewV2Contract ¶
RenewV2Contract renews a contract. It is expected that the existing contract will be cleared.
func (*Manager) ReviseContract ¶
func (cm *Manager) ReviseContract(contractID types.FileContractID) (*ContractUpdater, error)
ReviseContract initializes a new contract updater for the given contract.
func (*Manager) ReviseV2Contract ¶
func (cm *Manager) ReviseV2Contract(contractID types.FileContractID, revision types.V2FileContract, newRoots []types.Hash256, usage proto4.Usage) error
ReviseV2Contract atomically updates a contract and its associated sector roots.
func (*Manager) SectorRoots ¶
func (cm *Manager) SectorRoots(id types.FileContractID) []types.Hash256
SectorRoots returns the roots of all sectors stored by the contract.
func (*Manager) Unlock
deprecated
func (cm *Manager) Unlock(id types.FileContractID)
Unlock unlocks a locked contract.
Deprecated: Use LockV2Contract instead.
func (*Manager) UpdateChainState ¶
func (cm *Manager) UpdateChainState(tx UpdateStateTx, reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
UpdateChainState updates the state of the contracts on chain
func (*Manager) V2Contract ¶
func (cm *Manager) V2Contract(id types.FileContractID) (V2Contract, error)
V2Contract returns the v2 contract with the given ID.
func (*Manager) V2FileContractElement ¶
func (cm *Manager) V2FileContractElement(id types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error)
V2FileContractElement returns the chain index and file contract element for the given contract ID.
type ManagerOption ¶
type ManagerOption func(*Manager)
A ManagerOption sets options on a Manager.
func WithAlerter ¶
func WithAlerter(a Alerts) ManagerOption
WithAlerter sets the alerts for the Manager.
func WithRejectAfter ¶
func WithRejectAfter(rejectBuffer uint64) ManagerOption
WithRejectAfter sets the number of blocks before a contract will be considered rejected
func WithRevisionSubmissionBuffer ¶
func WithRevisionSubmissionBuffer(revisionSubmissionBuffer uint64) ManagerOption
WithRevisionSubmissionBuffer sets the number of blocks before the proof window to broadcast the final revision and prevent modification of the contract.
type SectorAction ¶
type SectorAction string
A SectorAction denotes the type of action to be performed on a contract sector.
const ( SectorActionAppend SectorAction = "append" SectorActionUpdate SectorAction = "update" SectorActionSwap SectorAction = "swap" SectorActionTrim SectorAction = "trim" )
A SectorAction denotes the type of action to be performed on a contract sector.
type SectorChange ¶
type SectorChange struct { Action SectorAction Root types.Hash256 A, B uint64 }
A SectorChange defines an action to be performed on a contract's sectors.
type SignedRevision ¶
type SignedRevision struct { Revision types.FileContractRevision `json:"revision"` HostSignature types.Signature `json:"hostSignature"` RenterSignature types.Signature `json:"renterSignature"` }
A SignedRevision pairs a contract revision with the signatures of the host and renter needed to broadcast the revision.
func (SignedRevision) RenterKey ¶
func (sr SignedRevision) RenterKey() types.PublicKey
RenterKey returns the renter's public key.
func (SignedRevision) Signatures ¶
func (sr SignedRevision) Signatures() []types.TransactionSignature
Signatures returns the host and renter transaction signatures for the contract revision.
type StateChanges ¶
type StateChanges struct { Confirmed []types.FileContractElement Revised []types.FileContractElement Successful []types.FileContractID Failed []types.FileContractID // V2 changes ConfirmedV2 []types.V2FileContractElement RevisedV2 []types.V2FileContractElement SuccessfulV2 []types.FileContractID RenewedV2 []types.FileContractID FailedV2 []types.FileContractID }
StateChanges contains the changes to the state of contracts on the blockchain
type StorageManager ¶
type StorageManager interface { // Read reads a sector from the store Read(root types.Hash256) (*[rhp2.SectorSize]byte, error) }
A StorageManager stores and retrieves sectors.
type Syncer ¶
type Syncer interface { BroadcastTransactionSet([]types.Transaction) BroadcastV2TransactionSet(types.ChainIndex, []types.V2Transaction) }
A Syncer broadcasts transactions to its peers
type UpdateStateTx ¶
type UpdateStateTx interface { // UpdateContractElementProofs updates the state elements in the host // contract store UpdateContractElementProofs(wallet.ProofUpdater) error // ContractRelevant returns whether the contract with the provided id is // relevant to the host ContractRelevant(id types.FileContractID) (bool, error) // V2ContractRelevant returns whether the v2 contract with the // provided id is relevant to the host V2ContractRelevant(id types.FileContractID) (bool, error) // ApplyContracts applies relevant contract changes to the contract // store ApplyContracts(types.ChainIndex, StateChanges) error // RevertContracts reverts relevant contract changes from the contract // store RevertContracts(types.ChainIndex, StateChanges) error // RejectContracts sets the status of any v1 and v2 contracts with a // negotiation height before the provided height and that have not // been confirmed to rejected RejectContracts(height uint64) (v1, v2 []types.FileContractID, err error) // AddContractChainIndexElement adds or updates the merkle proof of // chain index state elements AddContractChainIndexElement(elements types.ChainIndexElement) error // RevertContractChainIndexElements removes chain index state elements // that were reverted RevertContractChainIndexElement(types.ChainIndex) error // UpdateChainIndexElementProofs returns all chain index elements from the // contract store UpdateChainIndexElementProofs(wallet.ProofUpdater) error // DeleteExpiredContractChainIndexElements deletes chain index state // elements that are no long necessary DeleteExpiredChainIndexElements(height uint64) error }
An UpdateStateTx atomically updates the state of contracts in the contract store.
type Usage ¶
type Usage struct { RPCRevenue types.Currency `json:"rpc"` StorageRevenue types.Currency `json:"storage"` EgressRevenue types.Currency `json:"egress"` IngressRevenue types.Currency `json:"ingress"` RegistryRead types.Currency `json:"registryRead"` RegistryWrite types.Currency `json:"registryWrite"` AccountFunding types.Currency `json:"accountFunding"` RiskedCollateral types.Currency `json:"riskedCollateral"` }
Usage tracks the usage of a contract's funds.
type V2Contract ¶
type V2Contract struct { types.V2FileContract ID types.FileContractID `json:"id"` Status V2ContractStatus `json:"status"` Usage proto4.Usage `json:"usage"` // NegotiationHeight is the height the contract was negotiated at. NegotiationHeight uint64 `json:"negotiationHeight"` // RevisionConfirmed is true if the contract revision transaction has // been confirmed on the blockchain. RevisionConfirmed bool `json:"revisionConfirmed"` // FormationConfirmed is true if the contract formation transaction // has been confirmed on the blockchain. FormationIndex types.ChainIndex `json:"formationIndex"` // ResolutionIndex is the height the resolution was confirmed // at. If the contract has not been resolved, the field is the zero // value. ResolutionIndex types.ChainIndex `json:"resolutionHeight"` // RenewedTo is the ID of the contract that renewed this contract. If // this contract was not renewed, this field is the zero value. RenewedTo types.FileContractID `json:"renewedTo"` // RenewedFrom is the ID of the contract that this contract renewed. If // this contract is not a renewal, the field is the zero value. RenewedFrom types.FileContractID `json:"renewedFrom"` }
A V2Contract contains metadata on the current state of a v2 file contract.
type V2ContractFilter ¶
type V2ContractFilter struct { // filters Statuses []V2ContractStatus `json:"statuses"` ContractIDs []types.FileContractID `json:"contractIDs"` RenewedFrom []types.FileContractID `json:"renewedFrom"` RenewedTo []types.FileContractID `json:"renewedTo"` RenterKey []types.PublicKey `json:"renterKey"` MinNegotiationHeight uint64 `json:"minNegotiationHeight"` MaxNegotiationHeight uint64 `json:"maxNegotiationHeight"` MinExpirationHeight uint64 `json:"minExpirationHeight"` MaxExpirationHeight uint64 `json:"maxExpirationHeight"` // pagination Limit int `json:"limit"` Offset int `json:"offset"` // sorting SortField string `json:"sortField"` SortDesc bool `json:"sortDesc"` }
V2ContractFilter defines the filter criteria for a contract query.
type V2ContractStatus ¶
type V2ContractStatus string
V2ContractStatus is an enum that indicates the current status of a v2 contract.
const ( // V2ContractStatusPending indicates that the contract has been formed but // has not yet been confirmed on the blockchain. The contract is still // usable, but there is a risk that the contract will never be confirmed. V2ContractStatusPending V2ContractStatus = "pending" // V2ContractStatusRejected indicates that the contract formation transaction // was never confirmed on the blockchain V2ContractStatusRejected V2ContractStatus = "rejected" // V2ContractStatusActive indicates that the contract has been confirmed on // the blockchain and is currently active. V2ContractStatusActive V2ContractStatus = "active" // V2ContractStatusRenewed indicates that the contract has been renewed. V2ContractStatusRenewed V2ContractStatus = "renewed" // V2ContractStatusSuccessful indicates that a storage proof has been // confirmed or the contract expired without requiring the host to burn // Siacoin. V2ContractStatusSuccessful V2ContractStatus = "successful" // V2ContractStatusFailed indicates that the contract ended without a storage proof // and the host was required to burn Siacoin. V2ContractStatusFailed V2ContractStatus = "failed" )
V2ContractStatus is an enum that indicates the current status of a v2 contract.
type Wallet ¶
type Wallet interface { Address() types.Address UnlockConditions() types.UnlockConditions ReleaseInputs(txns []types.Transaction, v2txns []types.V2Transaction) FundTransaction(txn *types.Transaction, amount types.Currency, useUnconfirmed bool) ([]types.Hash256, error) SignTransaction(txn *types.Transaction, toSign []types.Hash256, cf types.CoveredFields) FundV2Transaction(txn *types.V2Transaction, amount types.Currency, useUnconfirmed bool) (types.ChainIndex, []int, error) SignV2Inputs(txn *types.V2Transaction, toSign []int) }
A Wallet manages Siacoins and funds transactions