func (p *PartialShardStateAccess) Set(key chainhash.Hash, value chainhash.Hash) error {
	if len(p.updateWitnesses) == 0 {
		return fmt.Errorf("no witnesses left")
	}

	uw := p.updateWitnesses[0]

	if uw.Key != key {
		return fmt.Errorf("incorrect witness; expected key: %s, got key: %s", uw.Key, key)
	}

	if uw.NewValue != value {
		return fmt.Errorf("incorrect witness; expected key: %s, got key: %s", uw.NewValue, value)
	}

	newStateRoot, err := csmt.ApplyWitness(uw, p.stateRoot)
	if err != nil {
		return err
	}

	p.stateRoot = *newStateRoot
	p.updateWitnesses = p.updateWitnesses[1:]

	return nil
}
// Set sets a key from the partial state.
Set sets a key from the partial state.
// Set sets a key from the partial state .
func (p *PartialShardStateAccess) Set(key chainhash.Hash, value chainhash.Hash) error {
	if len(p.updateWitnesses) == 0 {
		return fmt.Errorf("no witnesses left")
	}
	uw := p.updateWitnesses[0]
	if uw.Key != key {
		return fmt.Errorf("incorrect witness; expected key: %s, got key: %s", uw.Key, key)
	}
	if uw.NewValue != value {
		return fmt.Errorf("incorrect witness; expected key: %s, got key: %s", uw.NewValue, value)
	}
	newStateRoot, err := csmt.ApplyWitness(uw, p.stateRoot)
	if err != nil {
		return err
	}
	p.stateRoot = *newStateRoot
	p.updateWitnesses = p.updateWitnesses[1:]
	return nil
}
func ( p * PartialShardStateAccess ) Set ( key chainhash . Hash , value chainhash . Hash ) error { if len ( p . updateWitnesses ) == 0 { return fmt . Errorf ( " " ) } uw := p . updateWitnesses [ 0 ] if uw . Key != key { return fmt . Errorf ( " " , uw . Key , key ) } if uw . NewValue != value { return fmt . Errorf ( " " , uw . NewValue , value ) } newStateRoot , err := csmt . ApplyWitness ( uw , p . stateRoot ) if err != nil { return err } p . stateRoot = * newStateRoot p . updateWitnesses = p . updateWitnesses [ 1 : ] return nil }
Set sets a key from the partial state.
Set sets a key from the partial state .