aboutsummaryrefslogtreecommitdiff
path: root/src/coins.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2017-06-20 18:18:09 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2017-06-20 18:27:45 -0700
commitb3eb0d6485510f2bdf36d256ab60ce29b8213744 (patch)
treed74e67230ffbe2f00eadc0834e642636abec6611 /src/coins.h
parentefbcf2b1d5ff4ee7132eae9c9e203d2b875c545b (diff)
parent9417d7a336e71ee31ce673a6de5abb3d56941204 (diff)
Merge #10537: Few Minor per-utxo assert-semantics re-adds and tweak
9417d7a33 Be much more agressive in AccessCoin docs. (Matt Corallo) f58349ca8 Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4d3 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f2b Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca
Diffstat (limited to 'src/coins.h')
-rw-r--r--src/coins.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/coins.h b/src/coins.h
index dc3210b8ac..4774c9f6a6 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -224,8 +224,13 @@ public:
/**
* Return a reference to Coin in the cache, or a pruned one if not found. This is
- * more efficient than GetCoin. Modifications to other cache entries are
- * allowed while accessing the returned pointer.
+ * more efficient than GetCoin.
+ *
+ * Generally, do not hold the reference returned for more than a short scope.
+ * While the current implementation allows for modifications to the contents
+ * of the cache while holding the reference, this behavior should not be relied
+ * on! To be safe, best to not hold the returned reference through any other
+ * calls to this cache.
*/
const Coin& AccessCoin(const COutPoint &output) const;
@@ -240,7 +245,7 @@ public:
* If no unspent output exists for the passed outpoint, this call
* has no effect.
*/
- void SpendCoin(const COutPoint &outpoint, Coin* moveto = nullptr);
+ bool SpendCoin(const COutPoint &outpoint, Coin* moveto = nullptr);
/**
* Push the modifications applied to this cache to its base.