test: remove wallet dependency and refactor rpc_signrawtransaction.py#25512
Conversation
rpc_signrawtransaction.py is split into rpc_signrawtransactionwithkey.py and wallet_signrawtransactionwithwallet.py. rpc_signrawtransactionwithkey.py can be run with the wallet disabled.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
aureleoules
left a comment
There was a problem hiding this comment.
tACK 0ee43d1.
I verified that the tests were not altered during the refactor.
My understanding is that self.nodes[0].sendtoaddress was replaced with the function send_to_address to remove the wallet dependency.
| def send_to_address(self, addr, amount): | ||
| input = {"txid": self.nodes[0].getblock(self.block_hash[self.blk_idx])["tx"][0], "vout": 0} | ||
| output = {addr: amount} | ||
| self.blk_idx += 1 | ||
| rawtx = self.nodes[0].createrawtransaction([input], output) | ||
| txid = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransactionwithkey(rawtx, [self.nodes[0].get_deterministic_priv_key().key])["hex"], 0) | ||
| return txid |
There was a problem hiding this comment.
nit: As an idea for the future, this method could be removed and replaced by MiniWallet.send_to to simplify the test logic a bit. Or alternatively, the def make_utxo(self, node, amount, *, confirmed=True, scriptPubKey=None): method from feature_rbf could be moved to the test_framework and reused here?
rpc_signrawtransaction.pycurrently tests thesignrawtransactionwithkeyandsignrawtransactionwithwalletRPCs.This PR splits
rpc_signrawtransaction.pyintorpc_signrawtransactionwithkey.py: the tests forsignrawtransactionwithkeyare moved here and this test can now be run with the wallet disabled.wallet_signrawtransactionwithwallet.py: wallet only tests forsignrawtransactionwithwallet.py