]> Git Repo - VerusCoin.git/commitdiff
Only enforce Sapling turnstile if balance values have been populated.
authorSean Bowe <[email protected]>
Mon, 18 Mar 2019 20:09:32 +0000 (14:09 -0600)
committerSean Bowe <[email protected]>
Mon, 18 Mar 2019 20:09:32 +0000 (14:09 -0600)
src/main.cpp

index 50687866c63e9cf45172f27d3fc8a6d948275e64..be82258d234e19e4a9e99e2f44d8af902c722edd 100644 (file)
@@ -2469,10 +2469,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
         //
         // If we've reached ConnectBlock, we have all transactions of
         // parents and can expect nChainSaplingValue not to be boost::none.
-        assert(pindex->nChainSaplingValue != boost::none);
-        if (*pindex->nChainSaplingValue < 0) {
-            return state.DoS(100, error("ConnectBlock(): turnstile violation in Sapling shielded value pool"),
-                         REJECT_INVALID, "turnstile-violation-sapling-shielded-pool");
+        // However, the miner and mining RPCs may not have populated this
+        // value and will call `TestBlockValidity`. So, we act
+        // conditionally.
+        if (pindex->nChainSaplingValue) {
+            if (*pindex->nChainSaplingValue < 0) {
+                return state.DoS(100, error("ConnectBlock(): turnstile violation in Sapling shielded value pool"),
+                             REJECT_INVALID, "turnstile-violation-sapling-shielded-pool");
+            }
         }
     }
 
This page took 0.035306 seconds and 4 git commands to generate.