Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mempool_updatefromblock.py
Show All 19 Lines | def set_test_params(self): | ||||
self.extra_args = [ | self.extra_args = [ | ||||
['-limitdescendantsize=5000', '-limitancestorsize=5000']] | ['-limitdescendantsize=5000', '-limitancestorsize=5000']] | ||||
def skip_test_if_missing_module(self): | def skip_test_if_missing_module(self): | ||||
self.skip_if_no_wallet() | self.skip_if_no_wallet() | ||||
def transaction_graph_test(self, size, n_tx_to_mine=None, | def transaction_graph_test(self, size, n_tx_to_mine=None, | ||||
start_input_txid='', end_address='', | start_input_txid='', end_address='', | ||||
fee=Decimal(0.00100000)): | fee=Decimal(1000)): | ||||
"""Create an acyclic tournament (a type of directed graph) of | """Create an acyclic tournament (a type of directed graph) of | ||||
transactions and use it for testing. | transactions and use it for testing. | ||||
Keyword arguments: | Keyword arguments: | ||||
size -- the order N of the tournament which is equal to the number | size -- the order N of the tournament which is equal to the number | ||||
of the created transactions | of the created transactions | ||||
n_tx_to_mine -- the number of transaction that should be mined into a block | n_tx_to_mine -- the number of transaction that should be mined into a block | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | def transaction_graph_test(self, size, n_tx_to_mine=None, | ||||
if tx_count < size: | if tx_count < size: | ||||
# Transaction tx[K] is an ancestor of each of subsequent | # Transaction tx[K] is an ancestor of each of subsequent | ||||
# transactions tx[K+1]..tx[N-1]. | # transactions tx[K+1]..tx[N-1]. | ||||
n_outputs = size - tx_count | n_outputs = size - tx_count | ||||
output_value = ( | output_value = ( | ||||
(inputs_value - | (inputs_value - | ||||
fee) / | fee) / | ||||
Decimal(n_outputs)).quantize( | Decimal(n_outputs)).quantize( | ||||
Decimal('0.00000001')) | Decimal('0.01')) | ||||
outputs = {} | outputs = {} | ||||
for n in range(0, n_outputs): | for n in range(0, n_outputs): | ||||
outputs[self.nodes[0].getnewaddress()] = output_value | outputs[self.nodes[0].getnewaddress()] = output_value | ||||
else: | else: | ||||
output_value = ( | output_value = ( | ||||
inputs_value - | inputs_value - | ||||
fee).quantize( | fee).quantize( | ||||
Decimal('0.00000001')) | Decimal('0.01')) | ||||
outputs = {end_address: output_value} | outputs = {end_address: output_value} | ||||
self.log.debug('output_value={}'.format(output_value)) | self.log.debug('output_value={}'.format(output_value)) | ||||
self.log.debug('outputs={}'.format(outputs)) | self.log.debug('outputs={}'.format(outputs)) | ||||
# Create a new transaction. | # Create a new transaction. | ||||
unsigned_raw_tx = self.nodes[0].createrawtransaction( | unsigned_raw_tx = self.nodes[0].createrawtransaction( | ||||
inputs, outputs) | inputs, outputs) | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |