72 | @@ -72,6 +73,7 @@ static void add_coin(const CAmount& nValue, int nAge = 6*24, bool fIsFromMe = fa
73 | }
74 | COutput output(wtx.get(), nInput, nAge, true /* spendable */, true /* solvable */, true /* safe */);
75 | vCoins.push_back(output);
76 | + testWallet.AddToWallet(*wtx.get());
I guess the code was like this when you started, but it seems kind of dangerous to be mutating global variables in the test suite like this, because it can cause errors to propagate from one test to another. It looks like it would be pretty straightforward to change the code in the test to not use globals. Consider making these variables local to each method (maybe in a future PR?).
testWallet isn't actually used for anything in the tests except for a way to call SelectCoins and SelectCoinsMinConf. Furthermore the coins in the wallet are never actually used by either of those two functions, the only reason it is needed here so that we can pre-select some coins for the test that was just added. And that test is also temporary, so I think it is fine as is as this change does not have any effect on the other tests.
Agree that it's fine as is, but boy scout mentality ("leave you camp site cleaner than it was before") is helpful, especially in code bases that have a lot of existing style violations (like Bitcoin).
I'd also like to see a little cleanup here, if it's not much trouble.
It's a lot of trouble to clean this up. The diff would be quite large and out of scope for this PR IMO. I think this is partially why SelectCoins itself is never actually tested; instead all of the tests focus on SelectCoinsMinConf.