Skip to content

Commit

Permalink
rhp4: rename interface
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Oct 20, 2024
1 parent 322d7a3 commit da3e94e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions rhp/v4/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ type (
// ReviseV2Contract atomically revises a contract and updates its sector
// roots and usage.
ReviseV2Contract(contractID types.FileContractID, revision types.V2FileContract, roots []types.Hash256, usage Usage) error
// ContractElement returns the contract state element for the given
// V2FileContractElement returns the contract state element for the given
// contract ID.
ContractElement(types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error)
V2FileContractElement(types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error)

// AccountBalance returns the balance of an account.
AccountBalance(rhp4.Account) (types.Currency, error)
Expand Down Expand Up @@ -165,6 +165,7 @@ func (s *Server) lockContractForRevision(contractID types.FileContractID) (rev R
func (s *Server) handleRPCSettings(stream net.Conn) error {
settings := s.settings.RHP4Settings()
settings.ProtocolVersion = protocolVersion
settings.Prices.TipHeight = s.chain.Tip().Height
settings.Prices.ValidUntil = time.Now().Add(s.priceTableValidity)
sigHash := settings.Prices.SigHash()
settings.Prices.Signature = s.hostKey.SignHash(sigHash)
Expand Down Expand Up @@ -731,7 +732,7 @@ func (s *Server) handleRPCRefreshContract(stream net.Conn) error {
})
}

elementBasis, fce, err := s.contractor.ContractElement(req.Refresh.ContractID)
elementBasis, fce, err := s.contractor.V2FileContractElement(req.Refresh.ContractID)
if err != nil {
return fmt.Errorf("failed to get contract element: %w", err)
}
Expand Down Expand Up @@ -897,7 +898,7 @@ func (s *Server) handleRPCRenewContract(stream net.Conn) error {
})
}

elementBasis, fce, err := s.contractor.ContractElement(req.Renewal.ContractID)
elementBasis, fce, err := s.contractor.V2FileContractElement(req.Renewal.ContractID)
if err != nil {
return fmt.Errorf("failed to get contract element: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions testutil/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ type EphemeralContractor struct {

var _ rhp4.Contractor = (*EphemeralContractor)(nil)

// ContractElement returns the contract state element for the given contract ID.
func (ec *EphemeralContractor) ContractElement(contractID types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error) {
// V2FileContractElement returns the contract state element for the given contract ID.
func (ec *EphemeralContractor) V2FileContractElement(contractID types.FileContractID) (types.ChainIndex, types.V2FileContractElement, error) {
ec.mu.Lock()
defer ec.mu.Unlock()

Expand Down

0 comments on commit da3e94e

Please sign in to comment.