diff --git a/.changeset/add_revisable_to_rpclatestrevision.md b/.changeset/add_revisable_to_rpclatestrevision.md new file mode 100644 index 0000000..7305ae3 --- /dev/null +++ b/.changeset/add_revisable_to_rpclatestrevision.md @@ -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. diff --git a/rhp/v4/encoding.go b/rhp/v4/encoding.go index 8172400..9bcb874 100644 --- a/rhp/v4/encoding.go +++ b/rhp/v4/encoding.go @@ -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 diff --git a/rhp/v4/rhp.go b/rhp/v4/rhp.go index 05d1f16..c7004cc 100644 --- a/rhp/v4/rhp.go +++ b/rhp/v4/rhp.go @@ -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.