Skip to content

Commit 6c2e25c

Browse files
committed
[qa] Test prioritise_transaction / getblocktemplate interaction
1 parent acc2e4b commit 6c2e25c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/functional/prioritise_transaction.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
1313
def __init__(self):
1414
super().__init__()
1515
self.setup_clean_chain = True
16-
self.num_nodes = 1
17-
self.extra_args = [["-printpriority=1"]]
16+
self.num_nodes = 2
17+
self.extra_args = [["-printpriority=1"], ["-printpriority=1"]]
1818

1919
def run_test(self):
2020
self.txouts = gen_return_txouts()
@@ -115,5 +115,16 @@ def run_test(self):
115115
assert_equal(self.nodes[0].sendrawtransaction(tx_hex), tx_id)
116116
assert(tx_id in self.nodes[0].getrawmempool())
117117

118+
# Test that calling prioritisetransaction is sufficient to trigger
119+
# getblocktemplate to (eventually) return a new block.
120+
mock_time = int(time.time())
121+
self.nodes[0].setmocktime(mock_time)
122+
template = self.nodes[0].getblocktemplate()
123+
self.nodes[0].prioritisetransaction(tx_id, -int(self.relayfee*COIN))
124+
self.nodes[0].setmocktime(mock_time+10)
125+
new_template = self.nodes[0].getblocktemplate()
126+
127+
assert(template != new_template)
128+
118129
if __name__ == '__main__':
119130
PrioritiseTransactionTest().main()

0 commit comments

Comments
 (0)