wallet: Remove isminetype

Since the only remaining isminetypes are ISMINE_NO and ISMINE_SPENDABLE,
this enum is now just a bool and can be removed. IsMine is changed to
return a bool and any usage of isminetypes and isminefilters are changed
to be the remaining ISMINE_SPENDABLE case.
This commit is contained in:
Ava Chow
2025-05-15 17:01:46 -07:00
parent 009a69a616
commit be776a1443
21 changed files with 159 additions and 257 deletions

View File

@@ -7,16 +7,11 @@
#include <chain.h>
#include <interfaces/wallet.h>
#include <key_io.h>
#include <wallet/types.h>
#include <cstdint>
#include <QDateTime>
using wallet::ISMINE_NO;
using wallet::ISMINE_SPENDABLE;
using wallet::isminetype;
/* Return positive answer if transaction should be shown in list.
*/
bool TransactionRecord::showTransaction()
@@ -39,26 +34,26 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
Txid hash = wtx.tx->GetHash();
std::map<std::string, std::string> mapValue = wtx.value_map;
isminetype fAllFromMe = ISMINE_SPENDABLE;
bool all_from_me = true;
bool any_from_me = false;
if (wtx.is_coinbase) {
fAllFromMe = ISMINE_NO;
all_from_me = false;
} else {
for (const isminetype mine : wtx.txin_is_mine)
for (const bool mine : wtx.txin_is_mine)
{
if(fAllFromMe > mine) fAllFromMe = mine;
all_from_me = all_from_me && mine;
if (mine) any_from_me = true;
}
}
if (fAllFromMe || !any_from_me) {
if (all_from_me || !any_from_me) {
CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
for(unsigned int i = 0; i < wtx.tx->vout.size(); i++)
{
const CTxOut& txout = wtx.tx->vout[i];
if (fAllFromMe) {
if (all_from_me) {
// Change is only really possible if we're the sender
// Otherwise, someone just sent bitcoins to a change address, which should be shown
if (wtx.txout_is_change[i]) {
@@ -97,7 +92,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
parts.append(sub);
}
isminetype mine = wtx.txout_is_mine[i];
bool mine = wtx.txout_is_mine[i];
if(mine)
{
//