2016-03-19 20:58:06 +01:00
|
|
|
#!/usr/bin/env python3
|
2022-12-25 00:49:50 +01:00
|
|
|
# Copyright (c) 2014-2022 The Bitcoin Core developers
|
2015-07-15 20:47:45 +02:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2017-01-18 00:34:40 +01:00
|
|
|
"""Test descendant package tracking code."""
|
2015-07-15 20:47:45 +02:00
|
|
|
|
2018-07-07 00:10:35 +02:00
|
|
|
from decimal import Decimal
|
|
|
|
|
2022-08-09 15:04:59 +02:00
|
|
|
from test_framework.messages import (
|
|
|
|
DEFAULT_ANCESTOR_LIMIT,
|
|
|
|
DEFAULT_DESCENDANT_LIMIT,
|
|
|
|
)
|
2020-07-19 09:47:05 +02:00
|
|
|
from test_framework.p2p import P2PTxInvStore
|
2015-07-15 20:47:45 +02:00
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
2019-04-07 00:38:51 +02:00
|
|
|
from test_framework.util import (
|
|
|
|
assert_equal,
|
|
|
|
assert_raises_rpc_error,
|
|
|
|
)
|
2023-01-03 13:01:49 +01:00
|
|
|
from test_framework.wallet import MiniWallet
|
2022-08-09 15:04:59 +02:00
|
|
|
|
2019-11-10 19:55:28 +01:00
|
|
|
# custom limits for node1
|
2022-08-09 14:44:26 +02:00
|
|
|
CUSTOM_ANCESTOR_LIMIT = 5
|
|
|
|
CUSTOM_DESCENDANT_LIMIT = 10
|
|
|
|
assert CUSTOM_DESCENDANT_LIMIT >= CUSTOM_ANCESTOR_LIMIT
|
2015-10-06 04:16:15 +02:00
|
|
|
|
2022-08-09 15:04:59 +02:00
|
|
|
|
2015-07-15 20:47:45 +02:00
|
|
|
class MempoolPackagesTest(BitcoinTestFramework):
|
2017-06-10 00:21:21 +02:00
|
|
|
def set_test_params(self):
|
2016-05-14 13:01:31 +02:00
|
|
|
self.num_nodes = 2
|
2019-11-10 19:55:28 +01:00
|
|
|
self.extra_args = [
|
2019-11-13 03:55:48 +01:00
|
|
|
[
|
|
|
|
"-maxorphantx=1000",
|
|
|
|
"-whitelist=noban@127.0.0.1", # immediate tx relay
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"-maxorphantx=1000",
|
2022-08-09 14:44:26 +02:00
|
|
|
"-limitancestorcount={}".format(CUSTOM_ANCESTOR_LIMIT),
|
|
|
|
"-limitdescendantcount={}".format(CUSTOM_DESCENDANT_LIMIT),
|
2019-11-13 03:55:48 +01:00
|
|
|
],
|
2019-11-10 19:55:28 +01:00
|
|
|
]
|
2015-07-15 20:47:45 +02:00
|
|
|
|
|
|
|
def run_test(self):
|
2023-01-03 13:01:49 +01:00
|
|
|
self.wallet = MiniWallet(self.nodes[0])
|
|
|
|
self.wallet.rescan_utxos()
|
|
|
|
|
2020-09-04 03:05:26 +02:00
|
|
|
peer_inv_store = self.nodes[0].add_p2p_connection(P2PTxInvStore()) # keep track of invs
|
2023-01-03 13:01:49 +01:00
|
|
|
|
2022-08-09 14:44:26 +02:00
|
|
|
# DEFAULT_ANCESTOR_LIMIT transactions off a confirmed tx should be fine
|
2023-01-03 13:01:49 +01:00
|
|
|
chain = self.wallet.create_self_transfer_chain(chain_length=DEFAULT_ANCESTOR_LIMIT)
|
|
|
|
witness_chain = [t["wtxid"] for t in chain]
|
2020-06-18 20:25:04 +02:00
|
|
|
ancestor_vsize = 0
|
|
|
|
ancestor_fees = Decimal(0)
|
2015-07-15 20:47:45 +02:00
|
|
|
|
2023-01-03 13:01:49 +01:00
|
|
|
for i, t in enumerate(chain):
|
|
|
|
ancestor_vsize += t["tx"].get_vsize()
|
|
|
|
ancestor_fees += t["fee"]
|
|
|
|
self.wallet.sendrawtransaction(from_node=self.nodes[0], tx_hex=t["hex"])
|
2020-06-18 20:25:04 +02:00
|
|
|
|
2020-05-09 22:42:15 +02:00
|
|
|
# Wait until mempool transactions have passed initial broadcast (sent inv and received getdata)
|
|
|
|
# Otherwise, getrawmempool may be inconsistent with getmempoolentry if unbroadcast changes in between
|
2020-09-04 03:05:26 +02:00
|
|
|
peer_inv_store.wait_for_broadcast(witness_chain)
|
2020-05-09 22:42:15 +02:00
|
|
|
|
2022-08-09 14:44:26 +02:00
|
|
|
# Check mempool has DEFAULT_ANCESTOR_LIMIT transactions in it, and descendant and ancestor
|
2015-07-15 20:47:45 +02:00
|
|
|
# count and fees should look correct
|
|
|
|
mempool = self.nodes[0].getrawmempool(True)
|
2022-08-09 14:44:26 +02:00
|
|
|
assert_equal(len(mempool), DEFAULT_ANCESTOR_LIMIT)
|
2015-07-15 20:47:45 +02:00
|
|
|
descendant_count = 1
|
|
|
|
descendant_fees = 0
|
2018-04-17 20:17:13 +02:00
|
|
|
descendant_vsize = 0
|
2015-07-15 20:47:45 +02:00
|
|
|
|
2020-06-18 20:25:04 +02:00
|
|
|
assert_equal(ancestor_vsize, sum([mempool[tx]['vsize'] for tx in mempool]))
|
2022-08-09 14:44:26 +02:00
|
|
|
ancestor_count = DEFAULT_ANCESTOR_LIMIT
|
2021-08-12 15:37:06 +02:00
|
|
|
assert_equal(ancestor_fees, sum([mempool[tx]['fees']['base'] for tx in mempool]))
|
2018-02-18 16:54:20 +01:00
|
|
|
|
2023-01-03 13:01:49 +01:00
|
|
|
# Adding one more transaction on to the chain should fail.
|
|
|
|
next_hop = self.wallet.create_self_transfer(utxo_to_spend=chain[-1]["new_utxo"])["hex"]
|
|
|
|
assert_raises_rpc_error(-26, "too-long-mempool-chain", lambda: self.nodes[0].sendrawtransaction(next_hop))
|
|
|
|
|
2016-01-04 21:15:15 +01:00
|
|
|
descendants = []
|
2023-01-03 13:01:49 +01:00
|
|
|
ancestors = [t["txid"] for t in chain]
|
|
|
|
chain = [t["txid"] for t in chain]
|
2015-07-15 20:47:45 +02:00
|
|
|
for x in reversed(chain):
|
2016-01-04 21:15:15 +01:00
|
|
|
# Check that getmempoolentry is consistent with getrawmempool
|
|
|
|
entry = self.nodes[0].getmempoolentry(x)
|
|
|
|
assert_equal(entry, mempool[x])
|
|
|
|
|
2022-04-25 10:29:25 +02:00
|
|
|
# Check that gettxspendingprevout is consistent with getrawmempool
|
2023-01-03 13:01:49 +01:00
|
|
|
witnesstx = self.nodes[0].getrawtransaction(txid=x, verbose=True)
|
2022-04-25 10:29:25 +02:00
|
|
|
for tx_in in witnesstx["vin"]:
|
|
|
|
spending_result = self.nodes[0].gettxspendingprevout([ {'txid' : tx_in["txid"], 'vout' : tx_in["vout"]} ])
|
|
|
|
assert_equal(spending_result, [ {'txid' : tx_in["txid"], 'vout' : tx_in["vout"], 'spendingtxid' : x} ])
|
|
|
|
|
2016-01-04 21:15:15 +01:00
|
|
|
# Check that the descendant calculations are correct
|
2021-08-16 15:29:07 +02:00
|
|
|
assert_equal(entry['descendantcount'], descendant_count)
|
2021-08-12 15:37:06 +02:00
|
|
|
descendant_fees += entry['fees']['base']
|
|
|
|
assert_equal(entry['fees']['modified'], entry['fees']['base'])
|
2021-08-16 15:29:07 +02:00
|
|
|
assert_equal(entry['fees']['descendant'], descendant_fees)
|
|
|
|
descendant_vsize += entry['vsize']
|
|
|
|
assert_equal(entry['descendantsize'], descendant_vsize)
|
2015-07-15 20:47:45 +02:00
|
|
|
descendant_count += 1
|
|
|
|
|
2018-02-18 16:54:20 +01:00
|
|
|
# Check that ancestor calculations are correct
|
2021-08-16 15:29:07 +02:00
|
|
|
assert_equal(entry['ancestorcount'], ancestor_count)
|
2021-08-12 15:37:06 +02:00
|
|
|
assert_equal(entry['fees']['ancestor'], ancestor_fees)
|
2021-08-16 15:29:07 +02:00
|
|
|
assert_equal(entry['ancestorsize'], ancestor_vsize)
|
|
|
|
ancestor_vsize -= entry['vsize']
|
2021-08-12 15:37:06 +02:00
|
|
|
ancestor_fees -= entry['fees']['base']
|
2018-02-18 16:54:20 +01:00
|
|
|
ancestor_count -= 1
|
|
|
|
|
|
|
|
# Check that parent/child list is correct
|
2021-08-16 15:29:07 +02:00
|
|
|
assert_equal(entry['spentby'], descendants[-1:])
|
|
|
|
assert_equal(entry['depends'], ancestors[-2:-1])
|
2018-02-18 16:54:20 +01:00
|
|
|
|
2016-01-04 21:15:15 +01:00
|
|
|
# Check that getmempooldescendants is correct
|
|
|
|
assert_equal(sorted(descendants), sorted(self.nodes[0].getmempooldescendants(x)))
|
2018-02-18 16:54:20 +01:00
|
|
|
|
|
|
|
# Check getmempooldescendants verbose output is correct
|
|
|
|
for descendant, dinfo in self.nodes[0].getmempooldescendants(x, True).items():
|
|
|
|
assert_equal(dinfo['depends'], [chain[chain.index(descendant)-1]])
|
|
|
|
if dinfo['descendantcount'] > 1:
|
|
|
|
assert_equal(dinfo['spentby'], [chain[chain.index(descendant)+1]])
|
|
|
|
else:
|
|
|
|
assert_equal(dinfo['spentby'], [])
|
2016-01-04 21:15:15 +01:00
|
|
|
descendants.append(x)
|
|
|
|
|
|
|
|
# Check that getmempoolancestors is correct
|
|
|
|
ancestors.remove(x)
|
|
|
|
assert_equal(sorted(ancestors), sorted(self.nodes[0].getmempoolancestors(x)))
|
|
|
|
|
2018-02-18 16:54:20 +01:00
|
|
|
# Check that getmempoolancestors verbose output is correct
|
|
|
|
for ancestor, ainfo in self.nodes[0].getmempoolancestors(x, True).items():
|
|
|
|
assert_equal(ainfo['spentby'], [chain[chain.index(ancestor)+1]])
|
|
|
|
if ainfo['ancestorcount'] > 1:
|
|
|
|
assert_equal(ainfo['depends'], [chain[chain.index(ancestor)-1]])
|
|
|
|
else:
|
|
|
|
assert_equal(ainfo['depends'], [])
|
|
|
|
|
|
|
|
|
2016-01-04 21:15:15 +01:00
|
|
|
# Check that getmempoolancestors/getmempooldescendants correctly handle verbose=true
|
|
|
|
v_ancestors = self.nodes[0].getmempoolancestors(chain[-1], True)
|
|
|
|
assert_equal(len(v_ancestors), len(chain)-1)
|
|
|
|
for x in v_ancestors.keys():
|
|
|
|
assert_equal(mempool[x], v_ancestors[x])
|
2019-02-19 23:43:44 +01:00
|
|
|
assert chain[-1] not in v_ancestors.keys()
|
2016-01-04 21:15:15 +01:00
|
|
|
|
|
|
|
v_descendants = self.nodes[0].getmempooldescendants(chain[0], True)
|
|
|
|
assert_equal(len(v_descendants), len(chain)-1)
|
|
|
|
for x in v_descendants.keys():
|
|
|
|
assert_equal(mempool[x], v_descendants[x])
|
2019-02-19 23:43:44 +01:00
|
|
|
assert chain[0] not in v_descendants.keys()
|
2016-01-04 21:15:15 +01:00
|
|
|
|
2017-04-03 21:48:55 +02:00
|
|
|
# Check that ancestor modified fees includes fee deltas from
|
|
|
|
# prioritisetransaction
|
2017-04-21 18:41:01 +02:00
|
|
|
self.nodes[0].prioritisetransaction(txid=chain[0], fee_delta=1000)
|
2017-04-03 21:48:55 +02:00
|
|
|
ancestor_fees = 0
|
|
|
|
for x in chain:
|
2021-08-16 15:29:07 +02:00
|
|
|
entry = self.nodes[0].getmempoolentry(x)
|
2021-08-12 15:37:06 +02:00
|
|
|
ancestor_fees += entry['fees']['base']
|
2021-08-16 15:29:07 +02:00
|
|
|
assert_equal(entry['fees']['ancestor'], ancestor_fees + Decimal('0.00001'))
|
2018-02-18 16:54:20 +01:00
|
|
|
|
2017-04-03 21:48:55 +02:00
|
|
|
# Undo the prioritisetransaction for later tests
|
2017-04-21 18:41:01 +02:00
|
|
|
self.nodes[0].prioritisetransaction(txid=chain[0], fee_delta=-1000)
|
2017-04-03 21:48:55 +02:00
|
|
|
|
2015-11-19 17:18:28 +01:00
|
|
|
# Check that descendant modified fees includes fee deltas from
|
|
|
|
# prioritisetransaction
|
2017-04-21 18:41:01 +02:00
|
|
|
self.nodes[0].prioritisetransaction(txid=chain[-1], fee_delta=1000)
|
2015-11-19 17:18:28 +01:00
|
|
|
|
|
|
|
descendant_fees = 0
|
|
|
|
for x in reversed(chain):
|
2021-08-16 15:29:07 +02:00
|
|
|
entry = self.nodes[0].getmempoolentry(x)
|
2021-08-12 15:37:06 +02:00
|
|
|
descendant_fees += entry['fees']['base']
|
2021-08-16 15:29:07 +02:00
|
|
|
assert_equal(entry['fees']['descendant'], descendant_fees + Decimal('0.00001'))
|
2015-11-19 17:18:28 +01:00
|
|
|
|
|
|
|
# Check that prioritising a tx before it's added to the mempool works
|
2016-01-15 02:35:21 +01:00
|
|
|
# First clear the mempool by mining a block.
|
2021-08-19 17:10:24 +02:00
|
|
|
self.generate(self.nodes[0], 1)
|
2016-01-15 02:35:21 +01:00
|
|
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
|
|
|
# Prioritise a transaction that has been mined, then add it back to the
|
|
|
|
# mempool by using invalidateblock.
|
2017-04-21 18:41:01 +02:00
|
|
|
self.nodes[0].prioritisetransaction(txid=chain[-1], fee_delta=2000)
|
2015-11-19 17:18:28 +01:00
|
|
|
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
|
2016-01-15 02:35:21 +01:00
|
|
|
# Keep node1's tip synced with node0
|
|
|
|
self.nodes[1].invalidateblock(self.nodes[1].getbestblockhash())
|
|
|
|
|
|
|
|
# Now check that the transaction is in the mempool, with the right modified fee
|
2015-11-19 17:18:28 +01:00
|
|
|
descendant_fees = 0
|
|
|
|
for x in reversed(chain):
|
2021-08-16 15:29:07 +02:00
|
|
|
entry = self.nodes[0].getmempoolentry(x)
|
2021-08-12 15:37:06 +02:00
|
|
|
descendant_fees += entry['fees']['base']
|
2015-11-19 17:18:28 +01:00
|
|
|
if (x == chain[-1]):
|
2021-08-12 15:37:06 +02:00
|
|
|
assert_equal(entry['fees']['modified'], entry['fees']['base'] + Decimal("0.00002"))
|
2021-10-06 15:19:34 +02:00
|
|
|
assert_equal(entry['fees']['descendant'], descendant_fees + Decimal("0.00002"))
|
2015-11-19 17:18:28 +01:00
|
|
|
|
2019-11-10 19:55:28 +01:00
|
|
|
# Check that node1's mempool is as expected (-> custom ancestor limit)
|
|
|
|
mempool0 = self.nodes[0].getrawmempool(False)
|
|
|
|
mempool1 = self.nodes[1].getrawmempool(False)
|
2022-08-09 14:44:26 +02:00
|
|
|
assert_equal(len(mempool1), CUSTOM_ANCESTOR_LIMIT)
|
2019-11-10 19:55:28 +01:00
|
|
|
assert set(mempool1).issubset(set(mempool0))
|
2022-08-09 14:44:26 +02:00
|
|
|
for tx in chain[:CUSTOM_ANCESTOR_LIMIT]:
|
2019-11-10 19:55:28 +01:00
|
|
|
assert tx in mempool1
|
|
|
|
# TODO: more detailed check of node1's mempool (fees etc.)
|
2020-04-29 23:19:37 +02:00
|
|
|
# check transaction unbroadcast info (should be false if in both mempools)
|
|
|
|
mempool = self.nodes[0].getrawmempool(True)
|
|
|
|
for tx in mempool:
|
|
|
|
assert_equal(mempool[tx]['unbroadcast'], False)
|
2015-09-23 17:46:36 +02:00
|
|
|
|
2015-07-15 20:47:45 +02:00
|
|
|
# TODO: test ancestor size limits
|
|
|
|
|
|
|
|
# Now test descendant chain limits
|
|
|
|
|
2018-02-18 16:54:20 +01:00
|
|
|
tx_children = []
|
2015-07-15 20:47:45 +02:00
|
|
|
# First create one parent tx with 10 children
|
2023-01-03 13:01:49 +01:00
|
|
|
tx_with_children = self.wallet.send_self_transfer_multi(from_node=self.nodes[0], num_outputs=10)
|
|
|
|
parent_transaction = tx_with_children["txid"]
|
|
|
|
transaction_package = tx_with_children["new_utxos"]
|
2015-07-15 20:47:45 +02:00
|
|
|
|
2017-03-07 20:08:59 +01:00
|
|
|
# Sign and send up to MAX_DESCENDANT transactions chained off the parent tx
|
2019-11-13 03:55:48 +01:00
|
|
|
chain = [] # save sent txs for the purpose of checking node1's mempool later (see below)
|
2022-08-09 14:44:26 +02:00
|
|
|
for _ in range(DEFAULT_DESCENDANT_LIMIT - 1):
|
2015-07-15 20:47:45 +02:00
|
|
|
utxo = transaction_package.pop(0)
|
2023-01-03 13:01:49 +01:00
|
|
|
new_tx = self.wallet.send_self_transfer_multi(from_node=self.nodes[0], num_outputs=10, utxos_to_spend=[utxo])
|
|
|
|
txid = new_tx["txid"]
|
2019-11-13 03:55:48 +01:00
|
|
|
chain.append(txid)
|
2018-02-18 16:54:20 +01:00
|
|
|
if utxo['txid'] is parent_transaction:
|
|
|
|
tx_children.append(txid)
|
2023-01-03 13:01:49 +01:00
|
|
|
transaction_package.extend(new_tx["new_utxos"])
|
2017-03-07 20:08:59 +01:00
|
|
|
|
|
|
|
mempool = self.nodes[0].getrawmempool(True)
|
2022-08-09 14:44:26 +02:00
|
|
|
assert_equal(mempool[parent_transaction]['descendantcount'], DEFAULT_DESCENDANT_LIMIT)
|
2018-02-18 16:54:20 +01:00
|
|
|
assert_equal(sorted(mempool[parent_transaction]['spentby']), sorted(tx_children))
|
|
|
|
|
|
|
|
for child in tx_children:
|
|
|
|
assert_equal(mempool[child]['depends'], [parent_transaction])
|
2017-03-07 20:08:59 +01:00
|
|
|
|
|
|
|
# Sending one more chained transaction will fail
|
2023-01-03 13:01:49 +01:00
|
|
|
next_hop = self.wallet.create_self_transfer(utxo_to_spend=transaction_package.pop(0))["hex"]
|
|
|
|
assert_raises_rpc_error(-26, "too-long-mempool-chain", lambda: self.nodes[0].sendrawtransaction(next_hop))
|
2015-07-15 20:47:45 +02:00
|
|
|
|
2019-11-13 03:55:48 +01:00
|
|
|
# Check that node1's mempool is as expected, containing:
|
|
|
|
# - txs from previous ancestor test (-> custom ancestor limit)
|
|
|
|
# - parent tx for descendant test
|
|
|
|
# - txs chained off parent tx (-> custom descendant limit)
|
2021-08-16 15:29:07 +02:00
|
|
|
self.wait_until(lambda: len(self.nodes[1].getrawmempool()) ==
|
2022-08-09 14:44:26 +02:00
|
|
|
CUSTOM_ANCESTOR_LIMIT + 1 + CUSTOM_DESCENDANT_LIMIT, timeout=10)
|
2019-11-13 03:55:48 +01:00
|
|
|
mempool0 = self.nodes[0].getrawmempool(False)
|
|
|
|
mempool1 = self.nodes[1].getrawmempool(False)
|
|
|
|
assert set(mempool1).issubset(set(mempool0))
|
|
|
|
assert parent_transaction in mempool1
|
2022-08-09 14:44:26 +02:00
|
|
|
for tx in chain[:CUSTOM_DESCENDANT_LIMIT]:
|
2019-11-13 03:55:48 +01:00
|
|
|
assert tx in mempool1
|
2022-08-09 14:44:26 +02:00
|
|
|
for tx in chain[CUSTOM_DESCENDANT_LIMIT:]:
|
2019-11-13 03:55:48 +01:00
|
|
|
assert tx not in mempool1
|
|
|
|
# TODO: more detailed check of node1's mempool (fees etc.)
|
2015-09-23 17:46:36 +02:00
|
|
|
|
2015-07-15 20:47:45 +02:00
|
|
|
# TODO: test descendant size limits
|
|
|
|
|
2015-09-23 17:46:36 +02:00
|
|
|
# Test reorg handling
|
|
|
|
# First, the basics:
|
2021-08-19 17:10:24 +02:00
|
|
|
self.generate(self.nodes[0], 1)
|
2015-09-23 17:46:36 +02:00
|
|
|
self.nodes[1].invalidateblock(self.nodes[0].getbestblockhash())
|
|
|
|
self.nodes[1].reconsiderblock(self.nodes[0].getbestblockhash())
|
|
|
|
|
|
|
|
# Now test the case where node1 has a transaction T in its mempool that
|
|
|
|
# depends on transactions A and B which are in a mined block, and the
|
|
|
|
# block containing A and B is disconnected, AND B is not accepted back
|
|
|
|
# into node1's mempool because its ancestor count is too high.
|
|
|
|
|
|
|
|
# Create 8 transactions, like so:
|
|
|
|
# Tx0 -> Tx1 (vout0)
|
|
|
|
# \--> Tx2 (vout1) -> Tx3 -> Tx4 -> Tx5 -> Tx6 -> Tx7
|
|
|
|
#
|
|
|
|
# Mine them in the next block, then generate a new tx8 that spends
|
|
|
|
# Tx1 and Tx7, and add to node1's mempool, then disconnect the
|
|
|
|
# last block.
|
|
|
|
|
|
|
|
# Create tx0 with 2 outputs
|
2023-01-03 13:01:49 +01:00
|
|
|
tx0 = self.wallet.send_self_transfer_multi(from_node=self.nodes[0], num_outputs=2)
|
2015-09-23 17:46:36 +02:00
|
|
|
|
|
|
|
# Create tx1
|
2023-01-03 13:01:49 +01:00
|
|
|
tx1 = self.wallet.send_self_transfer(from_node=self.nodes[0], utxo_to_spend=tx0["new_utxos"][0])
|
2015-09-23 17:46:36 +02:00
|
|
|
|
|
|
|
# Create tx2-7
|
2023-01-03 13:01:49 +01:00
|
|
|
tx7 = self.wallet.send_self_transfer_chain(from_node=self.nodes[0], utxo_to_spend=tx0["new_utxos"][1], chain_length=6)[-1]
|
2015-09-23 17:46:36 +02:00
|
|
|
|
|
|
|
# Mine these in a block
|
2021-08-19 17:10:24 +02:00
|
|
|
self.generate(self.nodes[0], 1)
|
2015-09-23 17:46:36 +02:00
|
|
|
|
|
|
|
# Now generate tx8, with a big fee
|
2023-01-03 13:01:49 +01:00
|
|
|
self.wallet.send_self_transfer_multi(from_node=self.nodes[0], utxos_to_spend=[tx1["new_utxo"], tx7["new_utxo"]], fee_per_output=40000)
|
2019-04-07 00:19:45 +02:00
|
|
|
self.sync_mempools()
|
2018-02-18 16:54:20 +01:00
|
|
|
|
2015-09-23 17:46:36 +02:00
|
|
|
# Now try to disconnect the tip on each node...
|
|
|
|
self.nodes[1].invalidateblock(self.nodes[1].getbestblockhash())
|
|
|
|
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
|
2019-04-07 00:19:45 +02:00
|
|
|
self.sync_blocks()
|
2015-09-23 17:46:36 +02:00
|
|
|
|
2015-07-15 20:47:45 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
MempoolPackagesTest().main()
|