523 | @@ -524,6 +524,10 @@ def fill_mempool(test_framework, node, miniwallet):
524 |
525 | test_framework.log.debug("Create a mempool tx that will be evicted")
526 | tx_to_be_evicted_id = miniwallet.send_self_transfer(from_node=node, fee_rate=relayfee)["txid"]
527 | + # remove the newly created coin from MiniWallet's UTXO set, in order to avoid it being spent
528 | + # in one of the mempool filling txs below (which could bump up its descendant fee-rate and
529 | + # hence stop it from being evicted)
530 | + miniwallet.get_utxo(txid=tx_to_be_evicted_id, mark_as_spent=True)
Nice catch! I wonder if a more wholistic way to avoid unintentionally creating tx packages is to gather all the (confirmed only) UTXOs at the beginning? e.g. this, but feel free to ignore
Nice catch! I wonder if a more wholistic way to avoid unintentionally creating tx packages is to gather all the (confirmed only) UTXOs at the beginning? e.g. this, but feel free to ignore
That seems like a good approach to avoid similar problems popping up in the future 👌 I've cherry-picked your commit (with small conflict resolutions to have it introduced before the new test commit).
Btw, other approaches I've tried to fix the problem before:
- avoid that the to-be-evicted tx enters MiniWallet's UTXO set in the first place, by creating the tx with a different output script (but
MiniWallet.send_to only allows to specify an absolute fee, no fee-rate, meh)
- modify
create_lots_of_big_transactions to always pick a confirmed UTXO (also hacky and kind of unrelated, as that function is not only used in fill_mempool)
I'll punt to future work(TM) but I was wondering if we could just generate an "ephemeral" miniwallet inside fill_mempool if the resulting utxos from filling the mempool aren't necessary for the rest of the test?
I'll punt to future work(TM) but I was wondering if we could just generate an "ephemeral" miniwallet inside fill_mempool if the resulting utxos from filling the mempool aren't necessary for the rest of the test?
Hmm for that purpose I think it would be nice if different MiniWallet instances create different output scripts, to avoid confusion. Currently, MiniWallet instances for the same output type (e.g. the default ADDRESS_OP_TRUE) always result in the same UTXO pool (at least, after they call rescan_utxos()). Will look into this as follow-up.