Motivated by #28970 (review)
Adds the following fixups in txorphan fuzz tests:
- Don’t bond the output count of the created orphans to the number of available coins
- Allow duplicate inputs but don’t store duplicate outpoints
Most significantly, this gets rid of the duplicate_input
flag altogether, making the test easier to reason about. Notice how, under normal conditions, duplicate inputs would be caught by MemPoolAccept::PreChecks
, however, no validations checks are run on the test before adding data to the orphanage (neither were they before this patch)
Rationale
The way the test is currently written, duplicate inputs are allowed based on a random flag (duplicate_input
). If the flag is unset, upon selecting an outpoint as input for a new transaction, the input is popped to prevent re-selection and later re-added to the collection (once all inputs have been picked). However, the re-addition to the collection is performed independently of whether the flag was set or not. This means that, if the flag is set, the selected inputs are duplicated which in turn makes these inputs more likely to be re-picked in the following iteration of the loop.
Additionally, both the input and output count of the transaction are bonded to the number of available outpoints. This makes sense for the former, but the latter shouldn’t be.