mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
Fix dead stores. Values were stored but never read. Limit scope.
This commit is contained in:
parent
39439e5ab4
commit
fd447a6efe
2 changed files with 5 additions and 11 deletions
|
@ -950,6 +950,7 @@ static void TestOtherProcess(fs::path dirname, std::string lockname, int fd)
|
||||||
ReleaseDirectoryLocks();
|
ReleaseDirectoryLocks();
|
||||||
ch = true; // Always succeeds
|
ch = true; // Always succeeds
|
||||||
rv = write(fd, &ch, 1);
|
rv = write(fd, &ch, 1);
|
||||||
|
assert(rv == 1);
|
||||||
break;
|
break;
|
||||||
case ExitCommand:
|
case ExitCommand:
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
|
@ -536,19 +536,9 @@ BOOST_AUTO_TEST_CASE(SelectCoins_test)
|
||||||
std::exponential_distribution<double> distribution (100);
|
std::exponential_distribution<double> distribution (100);
|
||||||
FastRandomContext rand;
|
FastRandomContext rand;
|
||||||
|
|
||||||
// Output stuff
|
|
||||||
CAmount out_value = 0;
|
|
||||||
CoinSet out_set;
|
|
||||||
CAmount target = 0;
|
|
||||||
bool bnb_used;
|
|
||||||
|
|
||||||
// Run this test 100 times
|
// Run this test 100 times
|
||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
{
|
{
|
||||||
// Reset
|
|
||||||
out_value = 0;
|
|
||||||
target = 0;
|
|
||||||
out_set.clear();
|
|
||||||
empty_wallet();
|
empty_wallet();
|
||||||
|
|
||||||
// Make a wallet with 1000 exponentially distributed random inputs
|
// Make a wallet with 1000 exponentially distributed random inputs
|
||||||
|
@ -561,11 +551,14 @@ BOOST_AUTO_TEST_CASE(SelectCoins_test)
|
||||||
CFeeRate rate(rand.randrange(300) + 100);
|
CFeeRate rate(rand.randrange(300) + 100);
|
||||||
|
|
||||||
// Generate a random target value between 1000 and wallet balance
|
// Generate a random target value between 1000 and wallet balance
|
||||||
target = rand.randrange(balance - 1000) + 1000;
|
CAmount target = rand.randrange(balance - 1000) + 1000;
|
||||||
|
|
||||||
// Perform selection
|
// Perform selection
|
||||||
CoinSelectionParams coin_selection_params_knapsack(false, 34, 148, CFeeRate(0), 0);
|
CoinSelectionParams coin_selection_params_knapsack(false, 34, 148, CFeeRate(0), 0);
|
||||||
CoinSelectionParams coin_selection_params_bnb(true, 34, 148, CFeeRate(0), 0);
|
CoinSelectionParams coin_selection_params_bnb(true, 34, 148, CFeeRate(0), 0);
|
||||||
|
CoinSet out_set;
|
||||||
|
CAmount out_value = 0;
|
||||||
|
bool bnb_used = false;
|
||||||
BOOST_CHECK(testWallet.SelectCoinsMinConf(target, filter_standard, vCoins, out_set, out_value, coin_selection_params_bnb, bnb_used) ||
|
BOOST_CHECK(testWallet.SelectCoinsMinConf(target, filter_standard, vCoins, out_set, out_value, coin_selection_params_bnb, bnb_used) ||
|
||||||
testWallet.SelectCoinsMinConf(target, filter_standard, vCoins, out_set, out_value, coin_selection_params_knapsack, bnb_used));
|
testWallet.SelectCoinsMinConf(target, filter_standard, vCoins, out_set, out_value, coin_selection_params_knapsack, bnb_used));
|
||||||
BOOST_CHECK_GE(out_value, target);
|
BOOST_CHECK_GE(out_value, target);
|
||||||
|
|
Loading…
Add table
Reference in a new issue