Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-magnetic-anomaly-mining.py
Show All 23 Lines | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.block_heights = {} | self.block_heights = {} | ||||
self.tip = None | self.tip = None | ||||
self.blocks = {} | self.blocks = {} | ||||
self.mocktime = int(time.time()) - 600 * 100 | self.mocktime = int(time.time()) - 600 * 100 | ||||
extra_arg = ['-spendzeroconfchange=0', '-whitelist=127.0.0.1', | extra_arg = ['-spendzeroconfchange=0', '-whitelist=127.0.0.1', | ||||
"-magneticanomalyactivationtime=%d" % self.mocktime, | "-magneticanomalyactivationtime=%d" % self.mocktime, | ||||
"-replayprotectionactivationtime=%d" % ( | "-replayprotectionactivationtime=%d" % (10 * self.mocktime)] | ||||
10 * self.mocktime), | |||||
"-deprecatedrpc=signrawtransaction"] | |||||
self.extra_args = [extra_arg, extra_arg] | self.extra_args = [extra_arg, extra_arg] | ||||
def run_test(self): | def run_test(self): | ||||
mining_node = self.nodes[0] | mining_node = self.nodes[0] | ||||
# Helper for updating the times | # Helper for updating the times | ||||
def update_time(): | def update_time(): | ||||
mining_node.setmocktime(self.mocktime) | mining_node.setmocktime(self.mocktime) | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
} | } | ||||
outputs.update(output) | outputs.update(output) | ||||
# Take the fee off the last output to avoid rounding errors we | # Take the fee off the last output to avoid rounding errors we | ||||
# need the exact fee later for assertions | # need the exact fee later for assertions | ||||
outputs[addr] -= fee | outputs[addr] -= fee | ||||
rawtx = mining_node.createrawtransaction(inputs, outputs) | rawtx = mining_node.createrawtransaction(inputs, outputs) | ||||
signedtx = mining_node.signrawtransaction(rawtx) | signedtx = mining_node.signrawtransactionwithwallet(rawtx) | ||||
txid = mining_node.sendrawtransaction(signedtx['hex']) | txid = mining_node.sendrawtransaction(signedtx['hex']) | ||||
# number of outputs is the same as the number of sigops in this | # number of outputs is the same as the number of sigops in this | ||||
# case | # case | ||||
transactions.update({txid: {'fee': fee, 'sigops': len(outputs)}}) | transactions.update({txid: {'fee': fee, 'sigops': len(outputs)}}) | ||||
tmpl = mining_node.getblocktemplate() | tmpl = mining_node.getblocktemplate() | ||||
assert 'proposal' in tmpl['capabilities'] | assert 'proposal' in tmpl['capabilities'] | ||||
assert 'coinbasetxn' not in tmpl | assert 'coinbasetxn' not in tmpl | ||||
Show All 21 Lines |