Changeset View
Changeset View
Standalone View
Standalone View
test/functional/bip68-112-113-p2p.py
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | for sf in softforks: | ||||
return sf['reject']['status'] | return sf['reject']['status'] | ||||
raise AssertionError('Cannot find CSV fork activation informations') | raise AssertionError('Cannot find CSV fork activation informations') | ||||
class BIP68_112_113Test(ComparisonTestFramework): | class BIP68_112_113Test(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', '-blockversion=4']] | ||||
'-blockversion=4', "-deprecatedrpc=signrawtransaction"]] | |||||
def run_test(self): | def run_test(self): | ||||
test = TestManager(self, self.options.tmpdir) | test = TestManager(self, self.options.tmpdir) | ||||
test.add_all_connections(self.nodes) | test.add_all_connections(self.nodes) | ||||
# Start up network handling in another thread | # Start up network handling in another thread | ||||
NetworkThread().start() | NetworkThread().start() | ||||
test.run() | test.run() | ||||
def send_generic_input_tx(self, node, coinbases): | def send_generic_input_tx(self, node, coinbases): | ||||
amount = Decimal("49.99") | amount = Decimal("49.99") | ||||
return node.sendrawtransaction(ToHex(self.sign_transaction(node, self.create_transaction(node, node.getblock(coinbases.pop())['tx'][0], self.nodeaddress, amount)))) | return node.sendrawtransaction(ToHex(self.sign_transaction(node, self.create_transaction(node, node.getblock(coinbases.pop())['tx'][0], self.nodeaddress, amount)))) | ||||
def create_transaction(self, node, txid, to_address, amount): | def create_transaction(self, node, txid, to_address, amount): | ||||
inputs = [{"txid": txid, "vout": 0}] | inputs = [{"txid": txid, "vout": 0}] | ||||
outputs = {to_address: amount} | outputs = {to_address: amount} | ||||
rawtx = node.createrawtransaction(inputs, outputs) | rawtx = node.createrawtransaction(inputs, outputs) | ||||
tx = FromHex(CTransaction(), rawtx) | tx = FromHex(CTransaction(), rawtx) | ||||
return tx | return tx | ||||
def sign_transaction(self, node, unsignedtx): | def sign_transaction(self, node, unsignedtx): | ||||
rawtx = ToHex(unsignedtx) | rawtx = ToHex(unsignedtx) | ||||
signresult = node.signrawtransaction(rawtx) | signresult = node.signrawtransactionwithwallet(rawtx) | ||||
tx = FromHex(CTransaction(), signresult['hex']) | tx = FromHex(CTransaction(), signresult['hex']) | ||||
return tx | return tx | ||||
def spend_tx(self, node, prev_tx): | def spend_tx(self, node, prev_tx): | ||||
spendtx = self.create_transaction( | spendtx = self.create_transaction( | ||||
node, prev_tx.hash, self.nodeaddress, (prev_tx.vout[0].nValue - 1000) / COIN) | node, prev_tx.hash, self.nodeaddress, (prev_tx.vout[0].nValue - 1000) / COIN) | ||||
spendtx.nVersion = prev_tx.nVersion | spendtx.nVersion = prev_tx.nVersion | ||||
spendtx.rehash() | spendtx.rehash() | ||||
▲ Show 20 Lines • Show All 559 Lines • Show Last 20 Lines |