Documentation ¶
Index ¶
- func ClearingRevision(revision types.FileContractRevision, outputValues []types.Currency) (types.FileContractRevision, error)
- func HashRevision(rev types.FileContractRevision) types.Hash256
- func InitialRevision(formationTxn *types.Transaction, hostPubKey, renterPubKey types.UnlockKey) types.FileContractRevision
- func Revise(revision types.FileContractRevision, revisionNumber uint64, ...) (types.FileContractRevision, error)
- func ValidateClearingRevision(current, final types.FileContractRevision, finalPayment types.Currency) (types.Currency, error)
- func ValidatePaymentRevision(current, revision types.FileContractRevision, payment types.Currency) error
- func ValidateProgramRevision(current, revision types.FileContractRevision, ...) (burn types.Currency, _ error)
- func ValidateRevision(current, revision types.FileContractRevision, ...) (transfer, burn types.Currency, err error)
- type Conn
- type DataMonitor
- type DataRecorder
- type DataRecorderStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearingRevision ¶
func ClearingRevision(revision types.FileContractRevision, outputValues []types.Currency) (types.FileContractRevision, error)
ClearingRevision returns a revision that locks a contract and sets the missed proof outputs to the valid proof outputs.
func HashRevision ¶
func HashRevision(rev types.FileContractRevision) types.Hash256
HashRevision returns the hash of rev.
func InitialRevision ¶
func InitialRevision(formationTxn *types.Transaction, hostPubKey, renterPubKey types.UnlockKey) types.FileContractRevision
InitialRevision returns the first revision of a file contract formation transaction.
func Revise ¶
func Revise(revision types.FileContractRevision, revisionNumber uint64, validOutputs, missedOutputs []types.Currency) (types.FileContractRevision, error)
Revise updates the contract revision with the provided values.
func ValidateClearingRevision ¶
func ValidateClearingRevision(current, final types.FileContractRevision, finalPayment types.Currency) (types.Currency, error)
ValidateClearingRevision verifies that the revision locks the current contract by setting its revision number to the maximum value and the valid and missed proof outputs are the same.
func ValidatePaymentRevision ¶
func ValidatePaymentRevision(current, revision types.FileContractRevision, payment types.Currency) error
ValidatePaymentRevision verifies that a payment revision is valid and the amount is properly deducted from both renter outputs and added to both host outputs. Signatures are not validated.
func ValidateProgramRevision ¶
func ValidateProgramRevision(current, revision types.FileContractRevision, storage, collateral types.Currency) (burn types.Currency, _ error)
ValidateProgramRevision verifies that a contract program revision is valid and only the missed host value and burn value are modified by the expected burn amount. All other usage will have been paid for by the RPC budget.
func ValidateRevision ¶
func ValidateRevision(current, revision types.FileContractRevision, payment, collateral types.Currency) (transfer, burn types.Currency, err error)
ValidateRevision verifies that a new revision is valid given the current revision. Only the revision number and proof output values are allowed to change
Types ¶
type Conn ¶
An Conn wraps a net.Conn to track the amount of data read and written and limit bandwidth usage.
type DataMonitor ¶
A DataMonitor records the amount of data read and written across all connections.
type DataRecorder ¶
type DataRecorder struct {
// contains filtered or unexported fields
}
A DataRecorder records the amount of data read and written across connections.
func NewDataRecorder ¶
func NewDataRecorder(store DataRecorderStore, log *zap.Logger) *DataRecorder
NewDataRecorder initializes a new DataRecorder
func (*DataRecorder) Close ¶
func (dr *DataRecorder) Close() error
Close persists any remaining usage and returns nil
func (*DataRecorder) ReadBytes ¶
func (dr *DataRecorder) ReadBytes(n int)
ReadBytes increments the number of bytes read by n.
func (*DataRecorder) Usage ¶
func (dr *DataRecorder) Usage() (read, written uint64)
Usage returns the number of bytes read and written
func (*DataRecorder) WriteBytes ¶
func (dr *DataRecorder) WriteBytes(n int)
WriteBytes increments the number of bytes written by n.
type DataRecorderStore ¶
A DataRecorderStore persists data usage