Browse Source

Merge #10221: Stop treating coinbase outputs differently in GUI: show them at 1conf

608bbcc [qt] Stop treating coinbase outputs differently: show them at 1conf (Matt Corallo)

Tree-SHA512: 62ba10520da8b83cf8e97c86dec3ccdcca8b7bfae0174d1a4099d33aa5d11933cc7c248394bf67c2b105211cf7931955816c741957832e703211030c7f4f002f
0.15
Jonas Schnelli 8 years ago
parent
commit
e96486cbeb
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D
  1. 10
      src/qt/transactionrecord.cpp
  2. 27
      src/wallet/wallet.cpp
  3. 4
      src/wallet/wallet.h

10
src/qt/transactionrecord.cpp

@ -18,14 +18,8 @@
*/ */
bool TransactionRecord::showTransaction(const CWalletTx &wtx) bool TransactionRecord::showTransaction(const CWalletTx &wtx)
{ {
if (wtx.IsCoinBase()) // There are currently no cases where we hide transactions, but
{ // we may want to use this in the future for things like RBF.
// Ensures we show generated coins / mined transactions at depth 1
if (!wtx.IsInMainChain())
{
return false;
}
}
return true; return true;
} }

27
src/wallet/wallet.cpp

@ -1155,33 +1155,6 @@ void CWallet::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const
for (size_t i = 0; i < pblock->vtx.size(); i++) { for (size_t i = 0; i < pblock->vtx.size(); i++) {
SyncTransaction(pblock->vtx[i], pindex, i); SyncTransaction(pblock->vtx[i], pindex, i);
} }
// The GUI expects a NotifyTransactionChanged when a coinbase tx
// which is in our wallet moves from in-the-best-block to
// 2-confirmations (as it only displays them at that time).
// We do that here.
if (hashPrevBestCoinbase.IsNull()) {
// Immediately after restart we have no idea what the coinbase
// transaction from the previous block is.
// For correctness we scan over the entire wallet, looking for
// the previous block's coinbase, just in case it is ours, so
// that we can notify the UI that it should now be displayed.
if (pindex->pprev) {
for (const std::pair<uint256, CWalletTx>& p : mapWallet) {
if (p.second.IsCoinBase() && p.second.hashBlock == pindex->pprev->GetBlockHash()) {
NotifyTransactionChanged(this, p.first, CT_UPDATED);
break;
}
}
}
} else {
std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(hashPrevBestCoinbase);
if (mi != mapWallet.end()) {
NotifyTransactionChanged(this, hashPrevBestCoinbase, CT_UPDATED);
}
}
hashPrevBestCoinbase = pblock->vtx[0]->GetHash();
} }
void CWallet::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock) { void CWallet::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock) {

4
src/wallet/wallet.h

@ -715,10 +715,6 @@ private:
*/ */
bool AddWatchOnly(const CScript& dest) override; bool AddWatchOnly(const CScript& dest) override;
// Used to NotifyTransactionChanged of the previous block's coinbase when
// the next block comes in
uint256 hashPrevBestCoinbase;
public: public:
/* /*
* Main wallet lock. * Main wallet lock.

Loading…
Cancel
Save