Skip to content

Commit ec2676b

Browse files
committed
wallet: unconfirmed ancestors and descendants are always truc
1 parent 7b4a135 commit ec2676b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/wallet/spend.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <node/types.h>
1313
#include <numeric>
1414
#include <policy/policy.h>
15+
#include <policy/truc_policy.h>
1516
#include <primitives/transaction.h>
1617
#include <primitives/transaction_identifier.h>
1718
#include <script/script.h>
@@ -386,6 +387,14 @@ CoinsResult AvailableCoins(const CWallet& wallet,
386387
safeTx = false;
387388
}
388389

390+
if (nDepth == 0 && params.check_version_trucness) {
391+
if (coinControl->m_version == TRUC_VERSION) {
392+
if (wtx.tx->version != TRUC_VERSION) continue;
393+
} else {
394+
if (wtx.tx->version == TRUC_VERSION) continue;
395+
}
396+
}
397+
389398
if (only_safe && !safeTx) {
390399
continue;
391400
}
@@ -484,6 +493,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
484493
CoinsResult AvailableCoinsListUnspent(const CWallet& wallet, const CCoinControl* coinControl, CoinFilterParams params)
485494
{
486495
params.only_spendable = false;
496+
params.check_version_trucness = false;
487497
return AvailableCoins(wallet, coinControl, /*feerate=*/ std::nullopt, params);
488498
}
489499

src/wallet/spend.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ struct CoinFilterParams {
8383
bool include_immature_coinbase{false};
8484
// By default, skip locked UTXOs
8585
bool skip_locked{true};
86+
// When true, filter unconfirmed coins by whether their
87+
// version's TRUCness matches what is set by CCoinControl.
88+
bool check_version_trucness{true};
8689
};
8790

8891
/**

0 commit comments

Comments
 (0)