Skip to content

Commit 381b8fc

Browse files
committed
Clarify CCoinsViewMemPool documentation.
Thanks to @sdaftuar for correcting my misunderstanding.
1 parent acb1153 commit 381b8fc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ UniValue gettxout(const JSONRPCRequest& request)
991991
if (fMempool) {
992992
LOCK(mempool.cs);
993993
CCoinsViewMemPool view(pcoinsTip, mempool);
994-
if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { // TODO: filtering spent coins should be done by the CCoinsViewMemPool
994+
if (!view.GetCoin(out, coin) || mempool.isSpent(out)) {
995995
return NullUniValue;
996996
}
997997
} else {

src/txmempool.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,13 @@ class CTxMemPool
676676
/**
677677
* CCoinsView that brings transactions from a memorypool into view.
678678
* It does not check for spendings by memory pool transactions.
679+
* Instead, it provides access to all Coins which are either unspent in the
680+
* base CCoinsView, or are outputs from any mempool transaction!
681+
* This allows transaction replacement to work as expected, as you want to
682+
* have all inputs "available" to check signatures, and any cycles in the
683+
* dependency graph are checked directly in AcceptToMemoryPool.
684+
* It also allows you to sign a double-spend directly in signrawtransaction,
685+
* as long as the conflicting transaction is not yet confirmed.
679686
*/
680687
class CCoinsViewMemPool : public CCoinsViewBacked
681688
{

0 commit comments

Comments
 (0)