def create_coinbase(height, pubkey=None):
    coinbase = CTransaction()
    coinbase.vin = [CTxIn(NullOutPoint, cbase_scriptsig(height), 4294967295)]
    coinbaseoutput = CTxOut()
    coinbaseoutput.nValue = cbase_value(height)
    if (pubkey != None):
        coinbaseoutput.scriptPubKey = CScript([pubkey, OP_CHECKSIG])
    else:
        coinbaseoutput.scriptPubKey = CScript([OP_TRUE])
    coinbase.vout = [coinbaseoutput]
    coinbase.calc_sha256()
    return coinbase
def create_coinbase(height, pubkey=None):
    coinbase = CTransaction()
    coinbase.vin = [CTxIn(NullOutPoint, cbase_scriptsig(height), 4294967295)]
    coinbaseoutput = CTxOut()
    coinbaseoutput.nValue = cbase_value(height)
    if (pubkey != None):
        coinbaseoutput.scriptPubKey = CScript([pubkey, OP_CHECKSIG])
    else:
        coinbaseoutput.scriptPubKey = CScript([OP_TRUE])
    coinbase.vout = [coinbaseoutput]
    coinbase.calc_sha256()
    return coinbase