Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return V2FileContractRevision in RPCLatsetRevision rather than V2FileContract #122

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rhp/v4/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,11 @@
}

// RPCLatestRevision returns the latest revision of a contract.
func RPCLatestRevision(ctx context.Context, t TransportClient, contractID types.FileContractID) (types.V2FileContract, error) {
func RPCLatestRevision(ctx context.Context, t TransportClient, contractID types.FileContractID) (types.V2FileContractRevision, error) {
req := rhp4.RPCLatestRevisionRequest{ContractID: contractID}
var resp rhp4.RPCLatestRevisionResponse
err := callSingleRoundtripRPC(ctx, t, rhp4.RPCLatestRevisionID, &req, &resp)
return resp.Contract, err
return resp.Revision, err

Check failure on line 481 in rhp/v4/rpc.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

resp.Revision undefined (type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse has no field or method Revision)

Check failure on line 481 in rhp/v4/rpc.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

resp.Revision undefined (type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse has no field or method Revision)

Check failure on line 481 in rhp/v4/rpc.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

resp.Revision undefined (type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse has no field or method Revision)
}

// RPCSectorRoots returns the sector roots for a contract.
Expand Down
11 changes: 10 additions & 1 deletion rhp/v4/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,19 @@
if err != nil {
return fmt.Errorf("failed to lock contract: %w", err)
}
ci, fce, err := s.contractor.V2FileContractElement(req.ContractID)
if err != nil {
unlock()
return fmt.Errorf("failed to get contract's state element: %w", err)
}
unlock()

return rhp4.WriteResponse(stream, &rhp4.RPCLatestRevisionResponse{
Contract: state.Revision,
ChainIndex: ci,

Check failure on line 474 in rhp/v4/server.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

unknown field ChainIndex in struct literal of type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse

Check failure on line 474 in rhp/v4/server.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

unknown field ChainIndex in struct literal of type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse

Check failure on line 474 in rhp/v4/server.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

unknown field ChainIndex in struct literal of type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse
Revision: types.V2FileContractRevision{

Check failure on line 475 in rhp/v4/server.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

unknown field Revision in struct literal of type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse (typecheck)

Check failure on line 475 in rhp/v4/server.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

unknown field Revision in struct literal of type "go.sia.tech/core/rhp/v4".RPCLatestRevisionResponse) (typecheck)
Parent: fce,
Revision: state.Revision,
},
})
}

Expand Down
Loading