parameters: (self, stripExtraSigs=True)
return_statement: return outScript
docstring: Here, we don't care what the orig script was in the TxOut being spent,
        unless it was P2SH.  It's because this method assumes that all the sigs
        are already created, valid and in the right place -- which requires the
        previous TxOut script to do (before we get to this method).
  
        The exception is if this is P2SH, in which case we have to append the
        script to the end of the sigScript.
  
        However we *do* care about the original TxOut script's TYPE, so that we
        know what data to include in the sig script.  For instance, Pay2PubKey
        scripts only require a signature, whereas Pay2PubKeyHash requires both
        a pub key and a sig.  P2SH always needs the serialized script appended
        to the end of it.
docstring_summary: Here, we don't care what the orig script was in the TxOut being spent,
        unless it was P2SH.  It's because this method assumes that all the sigs
        are already created, valid and in the right place -- which requires the
        previous TxOut script to do (before we get to this method).
docstring_tokens: Here we don t care what the orig script was in the TxOut being spent unless it was P2SH . It s because this method assumes that all the sigs are already created valid and in the right place -- which requires the previous TxOut script to do ( before we get to this method ) .
function: def createSigScript(self, stripExtraSigs=True):
        """
        Here, we don't care what the orig script was in the TxOut being spent,
        unless it was P2SH.  It's because this method assumes that all the sigs
        are already created, valid and in the right place -- which requires the
        previous TxOut script to do (before we get to this method).
  
        The exception is if this is P2SH, in which case we have to append the
        script to the end of the sigScript.
  
        However we *do* care about the original TxOut script's TYPE, so that we
        know what data to include in the sig script.  For instance, Pay2PubKey
        scripts only require a signature, whereas Pay2PubKeyHash requires both
        a pub key and a sig.  P2SH always needs the serialized script appended
        to the end of it.
        """
  
        outScript = ''
  
        if self.scriptType in CPP_TXOUT_STDSINGLESIG and not self.signatures[0]:
           return ''
  
        # Remove Padding and guarantee LowS is used
        for i in range(len(self.signatures)):
           sig = self.signatures[i]
           if sig:
              rBin, sBin = getRSFromDERSig(sig)
              hashCode = sig[-1]
              # Don't forget to tack on the one-byte hashcode
              newSig = createDERSigFromRS(rBin, sBin) + hashCode
              if newSig != sig:
                 self.signatures[i] = newSig
  
        # All signatures are already DER-encoded. 
        if self.scriptType == CPP_TXOUT_P2SH:
           raise InvalidScriptError('Nested P2SH not allowed')
        if self.scriptType in [CPP_TXOUT_STDPUBKEY33, CPP_TXOUT_STDPUBKEY65]:
           # Only need the signature to complete coinbase TxOut
           outScript = scriptPushData(self.signatures[0])
        elif self.scriptType==CPP_TXOUT_STDHASH160:
           # Gotta include the public key, too, for standard TxOuts
           serSig    = scriptPushData(self.signatures[0])
           serPubKey = scriptPushData(self.pubKeys[0])
           outScript = serSig + serPubKey
        elif self.scriptType==CPP_TXOUT_MULTISIG:
           # Serialize non-empty sigs, replace empty ones with OP_0
           sigList = self.signatures[:]
           countSigs = lambda slist: sum([ (1 if s else 0)  for s in slist ])
           if stripExtraSigs:
              # Mainnet appears to treat extra sigs as non-std.  Remove if req
              while countSigs(sigList) > self.sigsNeeded:
                 sigList.pop()
  
           OP_0 = getOpCode('OP_0')
           pushSig = lambda sig: (scriptPushData(sig) if sig else '')
           outScript = OP_0 + ''.join([pushSig(s) for s in sigList])
        else:
           raise InvalidScriptError('Non-std script, cannot create sig script')
  
  
        # If P2SH, the script type already identifies the subscript.  But we
        # can tell because the p2shScript var will be non-empty.  All we do
        # for these types of script is append the raw p2sh script to the end
        if len(self.p2shScript) > 0:
           outScript += scriptPushData(self.p2shScript)
  
        return outScript
function_tokens: def createSigScript ( self , stripExtraSigs = True ) : outScript = '' if self . scriptType in CPP_TXOUT_STDSINGLESIG and not self . signatures [ 0 ] : return '' # Remove Padding and guarantee LowS is used for i in range ( len ( self . signatures ) ) : sig = self . signatures [ i ] if sig : rBin , sBin = getRSFromDERSig ( sig ) hashCode = sig [ - 1 ] # Don't forget to tack on the one-byte hashcode newSig = createDERSigFromRS ( rBin , sBin ) + hashCode if newSig != sig : self . signatures [ i ] = newSig # All signatures are already DER-encoded.  if self . scriptType == CPP_TXOUT_P2SH : raise InvalidScriptError ( 'Nested P2SH not allowed' ) if self . scriptType in [ CPP_TXOUT_STDPUBKEY33 , CPP_TXOUT_STDPUBKEY65 ] : # Only need the signature to complete coinbase TxOut outScript = scriptPushData ( self . signatures [ 0 ] ) elif self . scriptType == CPP_TXOUT_STDHASH160 : # Gotta include the public key, too, for standard TxOuts serSig = scriptPushData ( self . signatures [ 0 ] ) serPubKey = scriptPushData ( self . pubKeys [ 0 ] ) outScript = serSig + serPubKey elif self . scriptType == CPP_TXOUT_MULTISIG : # Serialize non-empty sigs, replace empty ones with OP_0 sigList = self . signatures [ : ] countSigs = lambda slist : sum ( [ ( 1 if s else 0 ) for s in slist ] ) if stripExtraSigs : # Mainnet appears to treat extra sigs as non-std.  Remove if req while countSigs ( sigList ) > self . sigsNeeded : sigList . pop ( ) OP_0 = getOpCode ( 'OP_0' ) pushSig = lambda sig : ( scriptPushData ( sig ) if sig else '' ) outScript = OP_0 + '' . join ( [ pushSig ( s ) for s in sigList ] ) else : raise InvalidScriptError ( 'Non-std script, cannot create sig script' ) # If P2SH, the script type already identifies the subscript.  But we # can tell because the p2shScript var will be non-empty.  All we do # for these types of script is append the raw p2sh script to the end if len ( self . p2shScript ) > 0 : outScript += scriptPushData ( self . p2shScript ) return outScript