From 381b8fc36537f9fa42f4487bcf55920b2ae0bda9 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 27 Jun 2017 14:46:19 -0400 Subject: Clarify CCoinsViewMemPool documentation. Thanks to @sdaftuar for correcting my misunderstanding. --- src/rpc/blockchain.cpp | 2 +- src/txmempool.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 8f7f76841d..c17ca2fa3a 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -991,7 +991,7 @@ UniValue gettxout(const JSONRPCRequest& request) if (fMempool) { LOCK(mempool.cs); CCoinsViewMemPool view(pcoinsTip, mempool); - if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { // TODO: filtering spent coins should be done by the CCoinsViewMemPool + if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { return NullUniValue; } } else { diff --git a/src/txmempool.h b/src/txmempool.h index 78ac3c209b..70d7429f22 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -676,6 +676,13 @@ private: /** * CCoinsView that brings transactions from a memorypool into view. * It does not check for spendings by memory pool transactions. + * Instead, it provides access to all Coins which are either unspent in the + * base CCoinsView, or are outputs from any mempool transaction! + * This allows transaction replacement to work as expected, as you want to + * have all inputs "available" to check signatures, and any cycles in the + * dependency graph are checked directly in AcceptToMemoryPool. + * It also allows you to sign a double-spend directly in signrawtransaction, + * as long as the conflicting transaction is not yet confirmed. */ class CCoinsViewMemPool : public CCoinsViewBacked { -- cgit v1.2.3