wallet: Store whether a COutput is from the wallet

Instead of determining whether the containing transaction is from the
wallet dynamically as needed, just pass it in to COutput and store it.
The transaction ownership isn't going to change.
This commit is contained in:
Andrew Chow
2022-01-18 19:03:23 -05:00
parent b799814bbd
commit d51f27d3bb
4 changed files with 15 additions and 19 deletions

View File

@@ -51,7 +51,10 @@ public:
/** The time of the transaction containing this output as determined by CWalletTx::nTimeSmart */
int64_t time;
COutput(const CWallet& wallet, const CWalletTx& wtx, int iIn, int depth, bool spendable, bool solvable, bool safe, int64_t time, bool use_max_sig_in)
/** Whether the transaction containing this output is sent from the owning wallet */
bool from_me;
COutput(const CWallet& wallet, const CWalletTx& wtx, int iIn, int depth, bool spendable, bool solvable, bool safe, int64_t time, bool from_me, bool use_max_sig_in)
: tx(&wtx),
i(iIn),
depth(depth),
@@ -60,7 +63,8 @@ public:
solvable(solvable),
use_max_sig(use_max_sig_in),
safe(safe),
time(time)
time(time),
from_me(from_me)
{
// If known and signable by the given wallet, compute input_bytes
// Failure will keep this value -1