Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-checkdatasig-activation.py
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | def create_checkdatasig_tx(self, count): | ||||
utxos = node.listunspent() | utxos = node.listunspent() | ||||
assert(len(utxos) > 0) | assert(len(utxos) > 0) | ||||
utxo = utxos[0] | utxo = utxos[0] | ||||
tx = CTransaction() | tx = CTransaction() | ||||
value = int(satoshi_round(utxo["amount"]) * COIN) // count | value = int(satoshi_round(utxo["amount"]) * COIN) // count | ||||
tx.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]))] | tx.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]))] | ||||
tx.vout = [] | tx.vout = [] | ||||
signature = bytearray.fromhex( | signature = bytearray.fromhex( | ||||
'30440220052a549456efe256a8c190650648e7ebdd46161f330830733fc7c674aeb7d3da0220519999b4f25b37de557a9c909cb5b155d1f0b11293b0890236696bfa0bd310e1') | '304402203fcefd3a307407b8580565aa41fa57ef8fbfc9470cccab19ed111b3d009b01b8022057e5e2f73a3e6d5e1036bce94a2ea40ecdc7e81a0c1c8bfd6b3dc191f511e312') | ||||
message = bytearray.fromhex( | message = bytearray.fromhex('') | ||||
'0100000000000000000000000000000000000000000000000000000000000000') | |||||
pubkey = bytearray.fromhex( | pubkey = bytearray.fromhex( | ||||
'038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508') | '038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508') | ||||
for _ in range(count): | for _ in range(count): | ||||
tx.vout.append(CTxOut(value, CScript( | tx.vout.append(CTxOut(value, CScript( | ||||
[signature, message, pubkey, OP_CHECKDATASIG]))) | [signature, message, pubkey, OP_CHECKDATASIG]))) | ||||
tx.vout[0].nValue -= node.calculate_fee(tx) | tx.vout[0].nValue -= node.calculate_fee(tx) | ||||
tx_signed = node.signrawtransaction(ToHex(tx))["hex"] | tx_signed = node.signrawtransaction(ToHex(tx))["hex"] | ||||
return tx_signed | return tx_signed | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |