Skip to content

Commit 9417d7a

Browse files
committed
Be much more agressive in AccessCoin docs.
While the current implementation is pretty free, there is a lot of possibility for this to blow up in our face with future changes, especially as the backing map gets tweaked.
1 parent f58349c commit 9417d7a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/coins.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,13 @@ class CCoinsViewCache : public CCoinsViewBacked
222222

223223
/**
224224
* Return a reference to Coin in the cache, or a pruned one if not found. This is
225-
* more efficient than GetCoin. Modifications to other cache entries are
226-
* allowed while accessing the returned pointer.
225+
* more efficient than GetCoin.
226+
*
227+
* Generally, do not hold the reference returned for more than a short scope.
228+
* While the current implementation allows for modifications to the contents
229+
* of the cache while holding the reference, this behavior should not be relied
230+
* on! To be safe, best to not hold the returned reference through any other
231+
* calls to this cache.
227232
*/
228233
const Coin& AccessCoin(const COutPoint &output) const;
229234

0 commit comments

Comments
 (0)