This PR enables one more of the non-wallet functional tests (feature_csv_activation.py) to be run even with the Bitcoin Core wallet disabled by using the new MiniWallet instead, as proposed in #20078.
Short reviewers guideline:
- Since we exclusively work with anyone-can-spend outputs here (raw scriptPubKey = OP_TRUE), signing is not needed anymore. The function
sign_transaction
and its calls are removed, after changing a tx (e.g. its scriptSig or nVersion) a simple.rehash()
call is sufficient. Also, generating an addressself.nodeaddress
(and with that, passing it to the the various test tx creation/sending helper methods) is not needed anymore and removed. - The test repeatedly uses the same input for creating different txs (e.g. with different txversions 1 and 2). To let
MiniWallet
create a tx with a specific input, we have to call.get_utxo()
before which also marks the UTXO as spent. The method is changed to also support keeping the UTXO in its internal list (mark_as_spent=False
). With the behaviour on master, the second call to.get_utxo()
with the same input would fail. - To keep the diff in the first commit short, the
miniwallet
is set as a global variable, to avoid passing it on every tx creation/spending helper. The global is eliminated in the second (refactoring) commit, where all the helpers are moved to the test class as methods. By that, we can useself.nodes[0]
directly in the helpers and don’t have to pass it again and again. I think there could still be a lot of improvements/refactoring done in the test, but that should hopefully serve as a good basis.