mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 03:09:37 +01:00
wallet: Have WalletTXOs also store parent tx time
WalletTXOs need to know their parent tx's timestamp for AvailableCoins to work.
This commit is contained in:
parent
78d97b0aed
commit
c52d419846
3 changed files with 8 additions and 4 deletions
|
@ -445,7 +445,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Add(GetOutputType(type, is_from_p2sh),
|
result.Add(GetOutputType(type, is_from_p2sh),
|
||||||
COutput(outpoint, output, nDepth, input_bytes, spendable, solvable, tx_safe, wtx.GetTxTime(), tx_from_me, feerate));
|
COutput(outpoint, output, nDepth, input_bytes, spendable, solvable, tx_safe, txo.GetTxTime(), tx_from_me, feerate));
|
||||||
|
|
||||||
outpoints.push_back(outpoint);
|
outpoints.push_back(outpoint);
|
||||||
|
|
||||||
|
|
|
@ -381,15 +381,17 @@ private:
|
||||||
TxState m_tx_state;
|
TxState m_tx_state;
|
||||||
bool m_tx_coinbase;
|
bool m_tx_coinbase;
|
||||||
std::map<isminefilter, bool> m_tx_from_me;
|
std::map<isminefilter, bool> m_tx_from_me;
|
||||||
|
int64_t m_tx_time;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WalletTXO(const CWalletTx& wtx, const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase, const std::map<isminefilter, bool>& tx_from_me)
|
WalletTXO(const CWalletTx& wtx, const CTxOut& output, const isminetype ismine, const TxState& state, bool coinbase, const std::map<isminefilter, bool>& tx_from_me, int64_t tx_time)
|
||||||
: m_wtx(wtx),
|
: m_wtx(wtx),
|
||||||
m_output(output),
|
m_output(output),
|
||||||
m_ismine(ismine),
|
m_ismine(ismine),
|
||||||
m_tx_state(state),
|
m_tx_state(state),
|
||||||
m_tx_coinbase(coinbase),
|
m_tx_coinbase(coinbase),
|
||||||
m_tx_from_me(tx_from_me)
|
m_tx_from_me(tx_from_me),
|
||||||
|
m_tx_time(tx_time)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const CWalletTx& GetWalletTx() const { return m_wtx; }
|
const CWalletTx& GetWalletTx() const { return m_wtx; }
|
||||||
|
@ -405,6 +407,8 @@ public:
|
||||||
bool IsTxCoinBase() const { return m_tx_coinbase; }
|
bool IsTxCoinBase() const { return m_tx_coinbase; }
|
||||||
|
|
||||||
const std::map<isminefilter, bool>& GetTxFromMe() const { return m_tx_from_me; }
|
const std::map<isminefilter, bool>& GetTxFromMe() const { return m_tx_from_me; }
|
||||||
|
|
||||||
|
int64_t GetTxTime() const { return m_tx_time; }
|
||||||
};
|
};
|
||||||
} // namespace wallet
|
} // namespace wallet
|
||||||
|
|
||||||
|
|
|
@ -4709,7 +4709,7 @@ void CWallet::RefreshSingleTxTXOs(const CWalletTx& wtx)
|
||||||
it->second.SetIsMine(ismine);
|
it->second.SetIsMine(ismine);
|
||||||
it->second.SetState(wtx.m_state);
|
it->second.SetState(wtx.m_state);
|
||||||
} else {
|
} else {
|
||||||
m_txos.emplace(outpoint, WalletTXO{wtx, txout, ismine, wtx.m_state, wtx.IsCoinBase(), wtx.m_from_me});
|
m_txos.emplace(outpoint, WalletTXO{wtx, txout, ismine, wtx.m_state, wtx.IsCoinBase(), wtx.m_from_me, wtx.GetTxTime()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue