Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-high_priority_transaction.py
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.relayfee = self.nodes[0].getnetworkinfo()['relayfee'] | self.relayfee = self.nodes[0].getnetworkinfo()['relayfee'] | ||||
# first test step: 0 reserved prio space in block | # first test step: 0 reserved prio space in block | ||||
txids = self.generate_high_priotransactions(self.nodes[0], 150) | txids = self.generate_high_priotransactions(self.nodes[0], 150) | ||||
mempool_size_pre = self.nodes[0].getmempoolinfo()['bytes'] | mempool_size_pre = self.nodes[0].getmempoolinfo()['bytes'] | ||||
mempool = self.nodes[0].getrawmempool(True) | mempool = self.nodes[0].getrawmempool(True) | ||||
# assert that all the txns are in the mempool and that all of them are hi prio | # assert that all the txns are in the mempool and that all of them are hi prio | ||||
for i in txids: | for i in txids: | ||||
assert(i in mempool) | assert i in mempool | ||||
assert(mempool[i]['currentpriority'] > hiprio_threshold) | assert mempool[i]['currentpriority'] > hiprio_threshold | ||||
# mine one block | # mine one block | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
self.log.info( | self.log.info( | ||||
"Assert that all high prio transactions haven't been mined") | "Assert that all high prio transactions haven't been mined") | ||||
assert_equal(self.nodes[0].getmempoolinfo()['bytes'], mempool_size_pre) | assert_equal(self.nodes[0].getmempoolinfo()['bytes'], mempool_size_pre) | ||||
# restart with default blockprioritypercentage | # restart with default blockprioritypercentage | ||||
self.restart_node(0, ["-limitfreerelay=2"]) | self.restart_node(0, ["-limitfreerelay=2"]) | ||||
# second test step: default reserved prio space in block (100K). | # second test step: default reserved prio space in block (100K). | ||||
# the mempool size is about 25K this means that all txns will be | # the mempool size is about 25K this means that all txns will be | ||||
# included in the soon to be mined block | # included in the soon to be mined block | ||||
txids = self.generate_high_priotransactions(self.nodes[0], 150) | txids = self.generate_high_priotransactions(self.nodes[0], 150) | ||||
mempool_size_pre = self.nodes[0].getmempoolinfo()['bytes'] | mempool_size_pre = self.nodes[0].getmempoolinfo()['bytes'] | ||||
mempool = self.nodes[0].getrawmempool(True) | mempool = self.nodes[0].getrawmempool(True) | ||||
# assert that all the txns are in the mempool and that all of them are hiprio | # assert that all the txns are in the mempool and that all of them are hiprio | ||||
for i in txids: | for i in txids: | ||||
assert(i in mempool) | assert i in mempool | ||||
assert(mempool[i]['currentpriority'] > hiprio_threshold) | assert mempool[i]['currentpriority'] > hiprio_threshold | ||||
# mine one block | # mine one block | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
self.log.info("Assert that all high prio transactions have been mined") | self.log.info("Assert that all high prio transactions have been mined") | ||||
assert(self.nodes[0].getmempoolinfo()['bytes'] == 0) | assert self.nodes[0].getmempoolinfo()['bytes'] == 0 | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
HighPriorityTransactionTest().main() | HighPriorityTransactionTest().main() |