Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-checkdatasig-activation.py
Show All 29 Lines | |||||
class CheckDataSigActivationTest(ComparisonTestFramework): | class CheckDataSigActivationTest(ComparisonTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.extra_args = [['-whitelist=127.0.0.1', | self.extra_args = [['-whitelist=127.0.0.1', | ||||
"-magneticanomalyactivationtime=%d" % MAGNETIC_ANOMALY_START_TIME, | "-magneticanomalyactivationtime=%d" % MAGNETIC_ANOMALY_START_TIME, | ||||
"-replayprotectionactivationtime=%d" % ( | "-replayprotectionactivationtime=%d" % (2 * MAGNETIC_ANOMALY_START_TIME)]] | ||||
2 * MAGNETIC_ANOMALY_START_TIME), | |||||
"-deprecatedrpc=signrawtransaction"]] | |||||
def create_checkdatasig_tx(self, count): | def create_checkdatasig_tx(self, count): | ||||
node = self.nodes[0] | node = self.nodes[0] | ||||
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( | ||||
'30440220256c12175e809381f97637933ed6ab97737d263eaaebca6add21bced67fd12a402205ce29ecc1369d6fc1b51977ed38faaf41119e3be1d7edfafd7cfaf0b6061bd07') | '30440220256c12175e809381f97637933ed6ab97737d263eaaebca6add21bced67fd12a402205ce29ecc1369d6fc1b51977ed38faaf41119e3be1d7edfafd7cfaf0b6061bd07') | ||||
message = bytearray.fromhex('') | message = bytearray.fromhex('') | ||||
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.signrawtransactionwithwallet(ToHex(tx))["hex"] | ||||
return tx_signed | return tx_signed | ||||
def run_test(self): | def run_test(self): | ||||
self.test = TestManager(self, self.options.tmpdir) | self.test = TestManager(self, self.options.tmpdir) | ||||
self.test.add_all_connections(self.nodes) | self.test.add_all_connections(self.nodes) | ||||
# Start up network handling in another thread | # Start up network handling in another thread | ||||
NetworkThread().start() | NetworkThread().start() | ||||
self.test.run() | self.test.run() | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |