Skip to content

Commit

Permalink
Fix createtransaction_tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sproxet committed Dec 4, 2023
1 parent 7a2f44b commit da2fa2e
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/wallet/test/createtransaction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ BOOST_FIXTURE_TEST_SUITE(createtransaction_tests, WalletTestingSetup)

vTxouts.at(0)._mockupDepthInMainChain = 0;

CCoinControl coinControl;
coinControl.fAllowUnconfirmedIsSet = true;
coinControl.fAllowUnconfirmed = false;

{
CWalletTx wtx;
CAmount nFeeRet = 0;
Expand All @@ -327,7 +331,7 @@ BOOST_FIXTURE_TEST_SUITE(createtransaction_tests, WalletTestingSetup)

CReserveKey reservekey(pwalletMain);
pwalletMain->CreateTransaction(vRecipients, wtx, &reservekey, nFeeRet, nChangePosInOut, strFailReason,
nullptr, true, 0, true, vTxouts);
&coinControl, true, 0, true, vTxouts);

ASSERT_FAILURE("Insufficient funds");
}
Expand All @@ -342,7 +346,7 @@ BOOST_FIXTURE_TEST_SUITE(createtransaction_tests, WalletTestingSetup)

CReserveKey reservekey(pwalletMain);
pwalletMain->CreateTransaction(vRecipients, wtx, &reservekey, nFeeRet, nChangePosInOut, strFailReason,
nullptr, true, 0, true, vTxouts);
&coinControl, true, 0, true, vTxouts);

ASSERT_SUCCESS();
ASSERT_VIN_SIZE(2);
Expand Down Expand Up @@ -423,16 +427,19 @@ BOOST_FIXTURE_TEST_SUITE(createtransaction_tests, WalletTestingSetup)

vTxouts.at(0)._mockupDepthInMainChain = 0;

CCoinControl coinControl;
coinControl.fAllowUnconfirmedIsSet = true;
coinControl.fAllowUnconfirmed = false;

{
CCoinControl coinControl;
CWalletTx wtx;
CAmount nFeeRet = 0;
int nChangePosInOut = -1;
std::string strFailReason;

CReserveKey reservekey(pwalletMain);
pwalletMain->CreateTransaction(vRecipients, wtx, &reservekey, nFeeRet, nChangePosInOut, strFailReason,
nullptr, true, 0, true, vTxouts);
&coinControl, true, 0, true, vTxouts);

ASSERT_FAILURE("Insufficient funds");
}
Expand All @@ -447,7 +454,7 @@ BOOST_FIXTURE_TEST_SUITE(createtransaction_tests, WalletTestingSetup)

CReserveKey reservekey(pwalletMain);
pwalletMain->CreateTransaction(vRecipients, wtx, &reservekey, nFeeRet, nChangePosInOut, strFailReason,
nullptr, true, 0, true, vTxouts);
&coinControl, true, 0, true, vTxouts);


ASSERT_SUCCESS();
Expand All @@ -468,7 +475,7 @@ BOOST_FIXTURE_TEST_SUITE(createtransaction_tests, WalletTestingSetup)

CReserveKey reservekey(pwalletMain);
pwalletMain->CreateTransaction(vRecipients, wtx, &reservekey, nFeeRet, nChangePosInOut, strFailReason,
nullptr, true, 0, false, vTxouts);
&coinControl, true, 0, false, vTxouts);

ASSERT_FAILURE("Insufficient funds");
}
Expand All @@ -477,7 +484,8 @@ BOOST_FIXTURE_TEST_SUITE(createtransaction_tests, WalletTestingSetup)
BOOST_AUTO_TEST_CASE(change_position) {
ACQUIRE_LOCKS();

std::vector<CTransparentTxout> vTxouts = GetFakeTransparentTxouts({1 << 17, 1 << 16, 1 << 15, 1 << 14, 1 << 13});
std::vector<CTransparentTxout> vTxouts = GetFakeTransparentTxouts({1 << 17, 1 << 16, 1 << 15, 1 << 14,
1 << 13});
std::vector<CRecipient> vRecipients = GetFakeRecipients({1 << 17, 1 << 13, 1 << 16});

{
Expand Down

0 comments on commit da2fa2e

Please sign in to comment.