// SetProposalState sets the ProposalState field's value.
778569
func (s *GatewayAssociationProposal) SetProposalState(v string) *GatewayAssociationProposal {
	s.ProposalState = &v
	return s
}
100904
func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *types.Block, parts *types.PartSet, peerID p2p.ID) error {
	if err := cs.SetProposal(proposal, peerID); err != nil {
		return err
	}
	for i := 0; i < parts.Total(); i++ {
		part := parts.GetPart(i)
		if err := cs.AddProposalBlockPart(proposal.Height, proposal.Round, part, peerID); err != nil {
			return err
		}
	}
	return nil
}
714296
func (s *Disk) SetAttachmentState(v string) *Disk {
	s.AttachmentState = &v
	return s
}
996765
func (s *PostTextOutput) SetDialogState(v string) *PostTextOutput {
	s.DialogState = &v
	return s
}
1314037
func (s *ProposalSummary) SetProposalId(v string) *ProposalSummary {
	s.ProposalId = &v
	return s
}
457503
func (api *SSHKeyAPI) setStateValue(setFunc func(*sacloud.Request)) *SSHKeyAPI {
	api.baseAPI.setStateValue(setFunc)
	return api
}
1140241
func (s *MetricAlarm) SetStateValue(v string) *MetricAlarm {
	s.StateValue = &v
	return s
}
1018286
func (s *GatewayInfo) SetGatewayOperationalState(v string) *GatewayInfo {
	s.GatewayOperationalState = &v
	return s
}
500270
func (api *IconAPI) setStateValue(setFunc func(*sacloud.Request)) *IconAPI {
	api.baseAPI.setStateValue(setFunc)
	return api
}
1274058
func (cs *ConsensusState) addProposalBlockPart(msg *BlockPartMessage, peerID p2p.ID) (added bool, err error) {
	height, round, part := msg.Height, msg.Round, msg.Part

	// Blocks might be reused, so round mismatch is OK
	if cs.Height != height {
		cs.Logger.Debug("Received block part from wrong height", "height", height, "round", round)
		return false, nil
	}

	// We're not expecting a block part.
	if cs.ProposalBlockParts == nil {
		// NOTE: this can happen when we've gone to a higher round and
		// then receive parts from the previous round - not necessarily a bad peer.
		cs.Logger.Info("Received a block part when we're not expecting any",
			"height", height, "round", round, "index", part.Index, "peer", peerID)
		return false, nil
	}

	added, err = cs.ProposalBlockParts.AddPart(part)
	if err != nil {
		return added, err
	}
	if added && cs.ProposalBlockParts.IsComplete() {
		// Added and completed!
		_, err = cdc.UnmarshalBinaryLengthPrefixedReader(
			cs.ProposalBlockParts.GetReader(),
			&cs.ProposalBlock,
			int64(cs.state.ConsensusParams.Block.MaxBytes),
		)
		if err != nil {
			return added, err
		}
		// NOTE: it's possible to receive complete proposal blocks for future rounds without having the proposal
		cs.Logger.Info("Received complete proposal block", "height", cs.ProposalBlock.Height, "hash", cs.ProposalBlock.Hash())
		cs.eventBus.PublishEventCompleteProposal(cs.CompleteProposalEvent())

		// Update Valid* if we can.
		prevotes := cs.Votes.Prevotes(cs.Round)
		blockID, hasTwoThirds := prevotes.TwoThirdsMajority()
		if hasTwoThirds && !blockID.IsZero() && (cs.ValidRound < cs.Round) {
			if cs.ProposalBlock.HashesTo(blockID.Hash) {
				cs.Logger.Info("Updating valid block to new proposal block",
					"valid-round", cs.Round, "valid-block-hash", cs.ProposalBlock.Hash())
				cs.ValidRound = cs.Round
				cs.ValidBlock = cs.ProposalBlock
				cs.ValidBlockParts = cs.ProposalBlockParts
			}
			// TODO: In case there is +2/3 majority in Prevotes set for some
			// block and cs.ProposalBlock contains different block, either
			// proposer is faulty or voting power of faulty processes is more
			// than 1/3. We should trigger in the future accountability
			// procedure at this point.
		}

		if cs.Step <= cstypes.RoundStepPropose && cs.isProposalComplete() {
			// Move onto the next step
			cs.enterPrevote(height, cs.Round)
			if hasTwoThirds { // this is optimisation as this will be triggered when prevote is added
				cs.enterPrecommit(height, cs.Round)
			}
		} else if cs.Step == cstypes.RoundStepCommit {
			// If we're waiting on the proposal block...
			cs.tryFinalizeCommit(height)
		}
		return added, nil
	}
	return added, nil
}
85124
func (s *UpdateQualificationTypeInput) SetQualificationTypeStatus(v string) *UpdateQualificationTypeInput {
	s.QualificationTypeStatus = &v
	return s
}
479539
func NewProposal(height int64, round int, polRound int, blockID BlockID) *Proposal {
	return &Proposal{
		Type:      ProposalType,
		Height:    height,
		Round:     round,
		BlockID:   blockID,
		POLRound:  polRound,
		Timestamp: tmtime.Now(),
	}
}
910391
func (n *NIC) setPromiscuousMode(enable bool) {
	n.mu.Lock()
	n.promiscuous = enable
	n.mu.Unlock()
}
832680
func (s *ApprovalThresholdPolicy) SetProposalDurationInHours(v int64) *ApprovalThresholdPolicy {
	s.ProposalDurationInHours = &v
	return s
}
375514
func (s *CloudwatchAlarmAction) SetStateValue(v string) *CloudwatchAlarmAction {
	s.StateValue = &v
	return s
}
1185559
func (s *GetProposalInput) SetProposalId(v string) *GetProposalInput {
	s.ProposalId = &v
	return s
}
663050
func (b *Backend) SetStateSuccess(signature *tasks.Signature, results []*tasks.TaskResult) error {
	decodedResults := b.decodeResults(results)
	update := bson.M{
		"state":   tasks.StateSuccess,
		"results": decodedResults,
	}
	return b.updateState(signature, update)
}