<commit_before>package contractor

import (
	"github.com/NebulousLabs/Sia/modules"
	"github.com/NebulousLabs/Sia/types"
)

// ProcessConsensusChange will be called by the consensus set every time there
// is a change in the blockchain. Updates will always be called in order.
func (c *Contractor) ProcessConsensusChange(cc modules.ConsensusChange) {
	c.mu.Lock()
	defer c.mu.Unlock()

	for _, block := range cc.RevertedBlocks {
		if block.ID() != types.GenesisBlock.ID() {
			c.blockHeight--
		}
	}
	for _, block := range cc.AppliedBlocks {
		if block.ID() != types.GenesisBlock.ID() {
			c.blockHeight++
		}
	}

	// renew contracts
	if c.blockHeight+c.allowance.RenewWindow >= c.renewHeight {
		c.renewHeight += c.allowance.Period
		go c.threadedRenewContracts(c.allowance, c.renewHeight)
		// reset the spentPeriod metric
		c.spentPeriod = types.ZeroCurrency
	}

	c.lastChange = cc.ID
}<commit_msg>disable renewing<commit_after>package contractor

import (
	"github.com/NebulousLabs/Sia/modules"
	"github.com/NebulousLabs/Sia/types"
)

// ProcessConsensusChange will be called by the consensus set every time there
// is a change in the blockchain. Updates will always be called in order.
func (c *Contractor) ProcessConsensusChange(cc modules.ConsensusChange) {
	c.mu.Lock()
	defer c.mu.Unlock()

	for _, block := range cc.RevertedBlocks {
		if block.ID() != types.GenesisBlock.ID() {
			c.blockHeight--
		}
	}
	for _, block := range cc.AppliedBlocks {
		if block.ID() != types.GenesisBlock.ID() {
			c.blockHeight++
		}
	}

	// renew contracts
	// TODO: re-enable this functionality
	// if c.blockHeight+c.allowance.RenewWindow >= c.renewHeight {
	// 	c.renewHeight += c.allowance.Period
	// 	go c.threadedRenewContracts(c.allowance, c.renewHeight)
	// 	// reset the spentPeriod metric
	// 	c.spentPeriod = types.ZeroCurrency
	// }

	c.lastChange = cc.ID
}
{'fraction_non_alphanumeric': 0.12580645161290321, 'fraction_numerical': 0.0, 'mean_word_length': 3.6408977556109727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1991078', 'n_tokens_mistral': 685, 'n_tokens_neox': 643, 'n_words': 147}