diff --git a/consensus/validation.go b/consensus/validation.go index ba42f8df..140280b9 100644 --- a/consensus/validation.go +++ b/consensus/validation.go @@ -275,7 +275,7 @@ func validateFileContracts(ms *MidState, txn types.Transaction, ts V1Transaction return fmt.Errorf("file contract revision %v revises contract after its proof window has opened", i) } else if fcr.FileContract.RevisionNumber <= parent.FileContract.RevisionNumber { return fmt.Errorf("file contract revision %v does not have a higher revision number than its parent", i) - } else if types.Hash256(fcr.UnlockConditions.UnlockHash()) != parent.FileContract.UnlockHash { + } else if fcr.UnlockConditions.UnlockHash() != parent.FileContract.UnlockHash { return fmt.Errorf("file contract revision %v claims incorrect unlock conditions", i) } outputSum := func(outputs []types.SiacoinOutput) (sum types.Currency) { diff --git a/consensus/validation_test.go b/consensus/validation_test.go index 7a462896..0b72a8e3 100644 --- a/consensus/validation_test.go +++ b/consensus/validation_test.go @@ -248,7 +248,7 @@ func prepareContractFormation(renterPubKey types.PublicKey, hostKey types.Public WindowStart: endHeight, WindowEnd: endHeight + windowSize, Payout: payout, - UnlockHash: types.Hash256(uc.UnlockHash()), + UnlockHash: uc.UnlockHash(), RevisionNumber: 0, ValidProofOutputs: []types.SiacoinOutput{ {Value: renterPayout, Address: refundAddr}, @@ -1658,7 +1658,7 @@ func TestWindowRevision(t *testing.T) { fc := types.FileContract{ WindowStart: 0, WindowEnd: 3, - UnlockHash: types.Hash256(uc.UnlockHash()), + UnlockHash: uc.UnlockHash(), } genesisBlock.Transactions = []types.Transaction{{ FileContracts: []types.FileContract{fc}, diff --git a/rhp/v2/contracts.go b/rhp/v2/contracts.go index ece92056..23753a80 100644 --- a/rhp/v2/contracts.go +++ b/rhp/v2/contracts.go @@ -46,7 +46,7 @@ func PrepareContractFormation(renterPubKey types.PublicKey, hostKey types.Public WindowStart: uint64(endHeight), WindowEnd: uint64(endHeight + host.WindowSize), Payout: payout, - UnlockHash: types.Hash256(uc.UnlockHash()), + UnlockHash: uc.UnlockHash(), RevisionNumber: 0, ValidProofOutputs: []types.SiacoinOutput{ // outputs need to account for tax diff --git a/types/types.go b/types/types.go index 5fcd4bdc..19e5280f 100644 --- a/types/types.go +++ b/types/types.go @@ -257,7 +257,7 @@ type FileContract struct { Payout Currency `json:"payout"` ValidProofOutputs []SiacoinOutput `json:"validProofOutputs"` MissedProofOutputs []SiacoinOutput `json:"missedProofOutputs"` - UnlockHash Hash256 `json:"unlockHash"` + UnlockHash Address `json:"unlockHash"` RevisionNumber uint64 `json:"revisionNumber"` } @@ -629,9 +629,9 @@ type StateElement struct { // A ChainIndexElement is a record of a ChainIndex within the state accumulator. type ChainIndexElement struct { - ID BlockID `json:"id"` - StateElement StateElement - ChainIndex ChainIndex `json:"chainIndex"` + ID BlockID `json:"id"` + StateElement StateElement `json:"stateElement"` + ChainIndex ChainIndex `json:"chainIndex"` } // A SiacoinElement is a record of a SiacoinOutput within the state accumulator. @@ -1096,7 +1096,7 @@ func (fcr FileContractRevision) MarshalJSON() ([]byte, error) { // Payout omitted; see FileContractRevision docstring ValidProofOutputs []SiacoinOutput `json:"validProofOutputs"` MissedProofOutputs []SiacoinOutput `json:"missedProofOutputs"` - UnlockHash Hash256 `json:"unlockHash"` + UnlockHash Address `json:"unlockHash"` RevisionNumber uint64 `json:"revisionNumber"` }{ fcr.ParentID,