Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-block-sigchecks-activation.py
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | def create_transaction(spendfrom, custom_script, amount=None): | ||||
# custom output will go on position 1, after position 0 which will be | # custom output will go on position 1, after position 0 which will be | ||||
# OP_TRUE (so it can be reused). | # OP_TRUE (so it can be reused). | ||||
customout = CTxOut(0, bytes(custom_script)) | customout = CTxOut(0, bytes(custom_script)) | ||||
# set output amount to required dust if not given | # set output amount to required dust if not given | ||||
customout.nValue = amount or (len(customout.serialize()) + 148) * 3 | customout.nValue = amount or (len(customout.serialize()) + 148) * 3 | ||||
ctx = CTransaction() | ctx = CTransaction() | ||||
ctx.vin.append(CTxIn(COutPoint(spendfrom.sha256, 0), b'')) | ctx.vin.append(CTxIn(COutPoint(spendfrom.sha256, 0), b'')) | ||||
ctx.vout.append( | ctx.vout.append(CTxOut(0, bytes([OP_TRUE]))) | ||||
CTxOut(0, bytes([OP_TRUE]))) | |||||
ctx.vout.append(customout) | ctx.vout.append(customout) | ||||
pad_tx(ctx) | pad_tx(ctx) | ||||
fee = len(ctx.serialize()) | fee = len(ctx.serialize()) | ||||
ctx.vout[0].nValue = spendfrom.vout[0].nValue - customout.nValue - fee | ctx.vout[0].nValue = spendfrom.vout[0].nValue - customout.nValue - fee | ||||
ctx.rehash() | ctx.rehash() | ||||
return ctx | return ctx | ||||
▲ Show 20 Lines • Show All 357 Lines • Show Last 20 Lines |