Make sure we use nTxConfirmTarget during Qt fee bumps
[bitcoinplatinum.git] / test / functional / mempool_limit.py
blob2777291dd0effec0044c37e642c62ee2bb8a7913
1 #!/usr/bin/env python3
2 # Copyright (c) 2014-2016 The Bitcoin Core developers
3 # Distributed under the MIT software license, see the accompanying
4 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 """Test mempool limiting together/eviction with the wallet."""
7 from test_framework.test_framework import BitcoinTestFramework
8 from test_framework.util import *
10 class MempoolLimitTest(BitcoinTestFramework):
12 def __init__(self):
13 super().__init__()
14 self.setup_clean_chain = True
15 self.num_nodes = 1
16 self.extra_args = [["-maxmempool=5", "-spendzeroconfchange=0"]]
18 def run_test(self):
19 txouts = gen_return_txouts()
20 relayfee = self.nodes[0].getnetworkinfo()['relayfee']
22 txids = []
23 utxos = create_confirmed_utxos(relayfee, self.nodes[0], 91)
25 #create a mempool tx that will be evicted
26 us0 = utxos.pop()
27 inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
28 outputs = {self.nodes[0].getnewaddress() : 0.0001}
29 tx = self.nodes[0].createrawtransaction(inputs, outputs)
30 self.nodes[0].settxfee(relayfee) # specifically fund this tx with low fee
31 txF = self.nodes[0].fundrawtransaction(tx)
32 self.nodes[0].settxfee(0) # return to automatic fee selection
33 txFS = self.nodes[0].signrawtransaction(txF['hex'])
34 txid = self.nodes[0].sendrawtransaction(txFS['hex'])
36 relayfee = self.nodes[0].getnetworkinfo()['relayfee']
37 base_fee = relayfee*100
38 for i in range (3):
39 txids.append([])
40 txids[i] = create_lots_of_big_transactions(self.nodes[0], txouts, utxos[30*i:30*i+30], 30, (i+1)*base_fee)
42 # by now, the tx should be evicted, check confirmation state
43 assert(txid not in self.nodes[0].getrawmempool())
44 txdata = self.nodes[0].gettransaction(txid)
45 assert(txdata['confirmations'] == 0) #confirmation should still be 0
47 if __name__ == '__main__':
48 MempoolLimitTest().main()