func (mSig *Multisignature) AddSignature(sig []byte, index int) {
	newSigIndex := mSig.BitArray.NumTrueBitsBefore(index)
	// Signature already exists, just replace the value there
	if mSig.BitArray.GetIndex(index) {
		mSig.Sigs[newSigIndex] = sig
		return
	}
	mSig.BitArray.SetIndex(index, true)
	// Optimization if the index is the greatest index
	if newSigIndex == len(mSig.Sigs) {
		mSig.Sigs = append(mSig.Sigs, sig)
		return
	}
	// Expand slice by one with a dummy element, move all elements after i
	// over by one, then place the new signature in that gap.
	mSig.Sigs = append(mSig.Sigs, make([]byte, 0))
	copy(mSig.Sigs[newSigIndex+1:], mSig.Sigs[newSigIndex:])
	mSig.Sigs[newSigIndex] = sig
}
// AddSignature adds a signature to the multisig, at the corresponding index.
// If the signature already exists, replace it.
AddSignature adds a signature to the multisig, at the corresponding index.
If the signature already exists, replace it.
// AddSignature adds a signature to the multisig at the corresponding index . // If the signature already exists replace it .
func (mSig *Multisignature) AddSignature(sig []byte, index int) {
	newSigIndex := mSig.BitArray.NumTrueBitsBefore(index)
	if mSig.BitArray.GetIndex(index) {
		mSig.Sigs[newSigIndex] = sig
		return
	}
	mSig.BitArray.SetIndex(index, true)
	if newSigIndex == len(mSig.Sigs) {
		mSig.Sigs = append(mSig.Sigs, sig)
		return
	}
	mSig.Sigs = append(mSig.Sigs, make([]byte, 0))
	copy(mSig.Sigs[newSigIndex+1:], mSig.Sigs[newSigIndex:])
	mSig.Sigs[newSigIndex] = sig
}
func ( mSig * Multisignature ) AddSignature ( sig [ ] byte , index int ) { newSigIndex := mSig . BitArray . NumTrueBitsBefore ( index ) if mSig . BitArray . GetIndex ( index ) { mSig . Sigs [ newSigIndex ] = sig return } mSig . BitArray . SetIndex ( index , true ) if newSigIndex == len ( mSig . Sigs ) { mSig . Sigs = append ( mSig . Sigs , sig ) return } mSig . Sigs = append ( mSig . Sigs , make ( [ ] byte , 0 ) ) copy ( mSig . Sigs [ newSigIndex + 1 : ] , mSig . Sigs [ newSigIndex : ] ) mSig . Sigs [ newSigIndex ] = sig }
AddSignature adds a signature to the multisig, at the corresponding index.
AddSignature adds a signature to the multisig at the corresponding index .
// Signature already exists, just replace the value there // Optimization if the index is the greatest index // Expand slice by one with a dummy element, move all elements after i // over by one, then place the new signature in that gap.