Skip to content

Commit

Permalink
Merge pull request #255 from SiaFoundation/nate/rhp4-revision-revisable
Browse files Browse the repository at this point in the history
RPCLatestRevision add revisable and renewed fields
  • Loading branch information
n8maninger authored Dec 13, 2024
2 parents c36fa2a + 8383d65 commit f81268e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/add_revisable_to_rpclatestrevision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
default: major
---

# Add revisable to RPCLatestRevision

Adds two additional flags to the RPCLatestRevision response. The `Revisable` field indicates whether the host will accept further revisions to the contract. A host will not accept revisions too close to the proof window or revisions on contracts that have already been resolved. The `Renewed` field indicates whether the contract was renewed. If the contract was renewed, the renter can use `FileContractID.V2RenewalID` to get the ID of the new contract.
4 changes: 4 additions & 0 deletions rhp/v4/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,13 @@ func (r *RPCLatestRevisionRequest) maxLen() int {

func (r *RPCLatestRevisionResponse) encodeTo(e *types.Encoder) {
r.Contract.EncodeTo(e)
e.WriteBool(r.Revisable)
e.WriteBool(r.Renewed)
}
func (r *RPCLatestRevisionResponse) decodeFrom(d *types.Decoder) {
r.Contract.DecodeFrom(d)
r.Revisable = d.ReadBool()
r.Renewed = d.ReadBool()
}
func (r *RPCLatestRevisionResponse) maxLen() int {
return sizeofContract
Expand Down
10 changes: 9 additions & 1 deletion rhp/v4/rhp.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,16 @@ type (
ContractID types.FileContractID `json:"contractID"`
}
// RPCLatestRevisionResponse implements Object.
//
// The `Revisable` field indicates whether the
// host will accept further revisions to the contract. A host will not accept revisions too
// close to the proof window or revisions on contracts that have already been resolved.
// The `Renewed` field indicates whether the contract was renewed. If the contract was
// renewed, the renter can use `FileContractID.V2RenewalID` to get the ID of the new contract.
RPCLatestRevisionResponse struct {
Contract types.V2FileContract `json:"contract"`
Contract types.V2FileContract `json:"contract"`
Revisable bool `json:"revisable"`
Renewed bool `json:"renewed"`
}

// RPCReadSectorRequest implements Object.
Expand Down

0 comments on commit f81268e

Please sign in to comment.