@@ -271,47 +271,45 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet,
271271 double dPriority = 0 ;
272272 CAmount nTotalIn = 0 ;
273273 bool fMissingInputs = false ;
274- bool hasZerocoinSpends = tx. HasZerocoinSpendInputs ();
275- if (hasZerocoinSpends)
274+
275+ if (tx. HasZerocoinSpendInputs ()) {
276276 nTotalIn = tx.GetZerocoinSpent ();
277+ } else {
278+ for (const CTxIn& txin : tx.vin ) {
279+ // Read prev transaction
280+ if (!view.HaveCoin (txin.prevout )) {
281+ // This should never happen; all transactions in the memory
282+ // pool should connect to either transactions in the chain
283+ // or other transactions in the memory pool.
284+ if (!mempool.mapTx .count (txin.prevout .hash )) {
285+ LogPrintf (" ERROR: mempool transaction missing input\n " );
286+ fMissingInputs = true ;
287+ if (porphan)
288+ vOrphan.pop_back ();
289+ break ;
290+ }
277291
278- for (const CTxIn& txin : tx.vin ) {
279- // Read prev transaction
280- if (!view.HaveCoin (txin.prevout )) {
281- // This should never happen; all transactions in the memory
282- // pool should connect to either transactions in the chain
283- // or other transactions in the memory pool.
284- if (!mempool.mapTx .count (txin.prevout .hash )) {
285- LogPrintf (" ERROR: mempool transaction missing input\n " );
286- fMissingInputs = true ;
287- if (porphan)
288- vOrphan.pop_back ();
289- break ;
292+ // Has to wait for dependencies
293+ if (!porphan) {
294+ // Use list for automatic deletion
295+ vOrphan.push_back (COrphan (&tx));
296+ porphan = &vOrphan.back ();
297+ }
298+ mapDependers[txin.prevout .hash ].push_back (porphan);
299+ porphan->setDependsOn .insert (txin.prevout .hash );
300+ nTotalIn += mempool.mapTx .find (txin.prevout .hash )->GetTx ().vout [txin.prevout .n ].nValue ;
301+ continue ;
290302 }
291303
292- // Has to wait for dependencies
293- if (!porphan) {
294- // Use list for automatic deletion
295- vOrphan.push_back (COrphan (&tx));
296- porphan = &vOrphan.back ();
297- }
298- mapDependers[txin.prevout .hash ].push_back (porphan);
299- porphan->setDependsOn .insert (txin.prevout .hash );
300- nTotalIn += mempool.mapTx .find (txin.prevout .hash )->GetTx ().vout [txin.prevout .n ].nValue ;
301- continue ;
302- }
304+ const Coin& coin = view.AccessCoin (txin.prevout );
305+ assert (!coin.IsSpent ());
303306
304- const Coin& coin = view.AccessCoin (txin.prevout );
305- assert (hasZerocoinSpends || !coin.IsSpent ());
306-
307- CAmount nValueIn = coin.out .nValue ;
308- nTotalIn += nValueIn;
309-
310- int nConf = nHeight - coin.nHeight ;
311-
312- // zPIV spends can have very large priority, use non-overflowing safe functions
313- dPriority = double_safe_addition (dPriority, ((double )nValueIn * nConf));
307+ CAmount nValueIn = coin.out .nValue ;
308+ nTotalIn += nValueIn;
314309
310+ int nConf = nHeight - coin.nHeight ;
311+ dPriority = double_safe_addition (dPriority, ((double )nValueIn * nConf));
312+ }
315313 }
316314 if (fMissingInputs ) continue ;
317315
0 commit comments