aboutsummaryrefslogtreecommitdiff
path: root/tests/functional_tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-10 17:20:20 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-09-05 11:19:34 +0000
commit2ec455df1f82148733c4ac268d22e9c51a690b14 (patch)
treedd0fe1637a7ba7a060b1a97966585bd9d6b87a8f /tests/functional_tests
parentMerge pull request #5827 (diff)
downloadmonero-2ec455df1f82148733c4ac268d22e9c51a690b14.tar.xz
wallet: fix mismatch between two concepts of "balance"
One considers the blockchain, while the other considers the blockchain and some recent actions, such as a recently created transaction which spend some outputs, but isn't yet mined. Typically, the "balance" command wants the latter, to reflect the recent action, but things like proving ownership wants the former. This fixes a crash in get_reserve_proof, where a preliminary check and the main code used two concepts of "balance".
Diffstat (limited to 'tests/functional_tests')
-rw-r--r--tests/functional_tests/transactions_flow_test.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/functional_tests/transactions_flow_test.cpp b/tests/functional_tests/transactions_flow_test.cpp
index 32b601d7a..2add66b8b 100644
--- a/tests/functional_tests/transactions_flow_test.cpp
+++ b/tests/functional_tests/transactions_flow_test.cpp
@@ -173,7 +173,7 @@ bool transactions_flow_test(std::string& working_folder,
//wait for money, until balance will have enough money
w1.refresh(true, blocks_fetched, received_money, ok);
- while(w1.unlocked_balance(0) < amount_to_transfer)
+ while(w1.unlocked_balance(0, true) < amount_to_transfer)
{
misc_utils::sleep_no_w(1000);
w1.refresh(true, blocks_fetched, received_money, ok);
@@ -186,7 +186,7 @@ bool transactions_flow_test(std::string& working_folder,
{
tools::wallet2::transfer_container incoming_transfers;
w1.get_transfers(incoming_transfers);
- if(incoming_transfers.size() > FIRST_N_TRANSFERS && get_money_in_first_transfers(incoming_transfers, FIRST_N_TRANSFERS) < w1.unlocked_balance(0) )
+ if(incoming_transfers.size() > FIRST_N_TRANSFERS && get_money_in_first_transfers(incoming_transfers, FIRST_N_TRANSFERS) < w1.unlocked_balance(0, true) )
{
//lets go!
size_t count = 0;
@@ -221,7 +221,7 @@ bool transactions_flow_test(std::string& working_folder,
for(i = 0; i != transactions_count; i++)
{
uint64_t amount_to_tx = (amount_to_transfer - transfered_money) > transfer_size ? transfer_size: (amount_to_transfer - transfered_money);
- while(w1.unlocked_balance(0) < amount_to_tx + TEST_FEE)
+ while(w1.unlocked_balance(0, true) < amount_to_tx + TEST_FEE)
{
misc_utils::sleep_no_w(1000);
LOG_PRINT_L0("not enough money, waiting for cashback or mining");
@@ -270,7 +270,7 @@ bool transactions_flow_test(std::string& working_folder,
misc_utils::sleep_no_w(DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN*1000);//wait two blocks before sync on another wallet on another daemon
}
- uint64_t money_2 = w2.balance(0);
+ uint64_t money_2 = w2.balance(0, true);
if(money_2 == transfered_money)
{
MGINFO_GREEN("-----------------------FINISHING TRANSACTIONS FLOW TEST OK-----------------------");