diff --git a/rhp/v2/rpc.go b/rhp/v2/rpc.go index 7d9bff26..6dff6809 100644 --- a/rhp/v2/rpc.go +++ b/rhp/v2/rpc.go @@ -124,11 +124,6 @@ func (sh *SessionHandler) rpcUnlock(s *session, log *zap.Logger) (contracts.Usag // host. func (sh *SessionHandler) rpcFormContract(s *session, log *zap.Logger) (contracts.Usage, error) { cs := sh.chain.TipState() - // prevent forming v1 contracts after the allow height - if cs.Index.Height >= cs.Network.HardforkV2.AllowHeight { - s.t.WriteResponseErr(ErrV2Hardfork) - return contracts.Usage{}, ErrV2Hardfork - } settings, err := sh.settings.RHP2Settings() if err != nil { @@ -263,11 +258,6 @@ func (sh *SessionHandler) rpcFormContract(s *session, log *zap.Logger) (contract // existing contract func (sh *SessionHandler) rpcRenewAndClearContract(s *session, log *zap.Logger) (contracts.Usage, error) { cs := sh.chain.TipState() - // prevent renewing v1 contracts after the allow height - if cs.Index.Height >= cs.Network.HardforkV2.AllowHeight { - s.t.WriteResponseErr(ErrV2Hardfork) - return contracts.Usage{}, ErrV2Hardfork - } settings, err := sh.settings.RHP2Settings() if err != nil { diff --git a/rhp/v2/rpc_test.go b/rhp/v2/rpc_test.go index a319db1a..9f8c2688 100644 --- a/rhp/v2/rpc_test.go +++ b/rhp/v2/rpc_test.go @@ -451,39 +451,6 @@ func TestRPCV2(t *testing.T) { } }) - t.Run("form after allow height", func(t *testing.T) { - // mine until the allow height - testutil.MineAndSync(t, node, node.Wallet.Address(), int(network.HardforkV2.AllowHeight-node.Chain.Tip().Height)) - - transport := dialHost(t, hostKey.PublicKey(), l.Addr().String()) - defer transport.Close() - - settings, err := rpc2.RPCSettings(transport) - if err != nil { - t.Fatal(err) - } - - // try to form a v1 contract after the allow height - fc := crhp2.PrepareContractFormation(renterKey.PublicKey(), hostKey.PublicKey(), types.Siacoins(10), types.Siacoins(20), node.Chain.Tip().Height+10, settings, node.Wallet.Address()) - formationCost := crhp2.ContractFormationCost(node.Chain.TipState(), fc, settings.ContractPrice) - txn := types.Transaction{ - FileContracts: []types.FileContract{fc}, - } - toSign, err := node.Wallet.FundTransaction(&txn, formationCost, true) - if err != nil { - t.Fatal(err) - } - node.Wallet.SignTransaction(&txn, toSign, wallet.ExplicitCoveredFields(txn)) - formationSet := append(node.Chain.UnconfirmedParents(txn), txn) - - _, _, err = rpc2.RPCFormContract(transport, renterKey, formationSet) - if runtime.GOOS != "windows" && !errors.Is(err, rhp2.ErrV2Hardfork) { // windows responds with wsarecv rather than the error - t.Fatalf("expected ErrV2Hardfork, got %v", err) - } else if runtime.GOOS == "windows" && err == nil { - t.Fatal("expected windows error, got nil") - } - }) - t.Run("rpc after require height", func(t *testing.T) { // mine until the require height testutil.MineAndSync(t, node, node.Wallet.Address(), int(network.HardforkV2.RequireHeight-node.Chain.Tip().Height)) diff --git a/rhp/v3/rpc.go b/rhp/v3/rpc.go index ed200b5b..5c7c5218 100644 --- a/rhp/v3/rpc.go +++ b/rhp/v3/rpc.go @@ -248,11 +248,6 @@ func (sh *SessionHandler) handleRPCLatestRevision(s *rhp3.Stream, log *zap.Logge func (sh *SessionHandler) handleRPCRenew(s *rhp3.Stream, log *zap.Logger) (contracts.Usage, error) { cs := sh.chain.TipState() - // prevent renewing v1 contracts after the allow height - if cs.Index.Height >= cs.Network.HardforkV2.AllowHeight { - s.WriteResponseErr(ErrV2Hardfork) - return contracts.Usage{}, ErrV2Hardfork - } s.SetDeadline(time.Now().Add(2 * time.Minute)) if !sh.settings.AcceptingContracts() { diff --git a/rhp/v3/rpc_test.go b/rhp/v3/rpc_test.go index 393019de..f2cc6c36 100644 --- a/rhp/v3/rpc_test.go +++ b/rhp/v3/rpc_test.go @@ -630,16 +630,4 @@ func TestRPCV2(t *testing.T) { if !errors.Is(err, rhp3.ErrAfterV2Hardfork) { t.Fatalf("expected after v2 hardfork error, got %v", err) } - - // mine to activate the v2 hardfork - testutil.MineAndSync(t, node, node.Wallet.Address(), int(network.HardforkV2.AllowHeight-node.Chain.Tip().Height)) - - // try to renew the contract with an end height before the require height, but after the hardfork activation - renewHeight = origin.Revision.WindowEnd + 10 - renterFunds = types.Siacoins(10) - additionalCollateral = types.Siacoins(20) - _, _, err = session.RenewContract(&origin, node.Wallet.Address(), renterKey, renterFunds, additionalCollateral, renewHeight) - if !errors.Is(err, rhp3.ErrV2Hardfork) { - t.Fatalf("expected v2 hardfork error, got %v", err) - } }