Instead of asking the coin database and block storage about a transaction, pull it directly from the wallet in wallet related tests.
This refactoring only makes sense in light of #15159.
<sub>This product may contain minor stylistic cleanups
Instead of asking the coin database and block storage about a transaction, pull it directly from the wallet in wallet related tests.
This refactoring only makes sense in light of #15159.
<sub>This product may contain minor stylistic cleanups
I think it's good to improve code style in files that you touch, but could you split this into commits:
doing both in a single commit makes is discouraged: do not mix any formatting fixes or code moves with actual code changes.
57 | 58 | # Identify the 10btc outputs 59 | - nA = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txA, 1)["vout"]) if vout["value"] == Decimal("10")) 60 | - nB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txB, 1)["vout"]) if vout["value"] == Decimal("10")) 61 | - nC = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txC, 1)["vout"]) if vout["value"] == Decimal("10")) 62 | + nA = next(d["vout"] for d in self.nodes[0].gettransaction(txA)["details"] if d["amount"] == Decimal("10"))
what is d for here? Would changing it to tx_out here make it clearer?
d is short for details
What is a detail in Bitcoin?
It is specific to the rpc, see https://github.com/bitcoin/bitcoin/blob/f0c9e1c22b8a043983f3ba90ad910b67cf981e36/src/wallet/rpcwallet.cpp#L1684, so I am sticking to that naming scheme. I don't mind if someone improves the documentation there.
The name details can't be changed in the RPC since it's part of the API. I'm just suggesting you could use a more variable name which is more descriptive for people reading the test.
ACK either way.
+1 descriptiveness within test :)
Tested ACK fa2320a3f0374045414ec5dc2fecae76224a1afe. One nit.
tACK fa5278a4196cf0b560f5eeb1fb5f9c5e98219ec4. Thanks!