@@ -2636,17 +2636,17 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
26362636 * addresses should still be handled by the typical bitcoin based undo code
26372637 * */
26382638 if (tx.ContainsZerocoins ()) {
2639- if (tx.IsZerocoinSpend ()) {
2639+ if (tx.HasZerocoinSpendInputs ()) {
26402640 // erase all zerocoinspends in this transaction
2641- for (const CTxIn& txin : tx.vin ) {
2641+ for (const CTxIn & txin : tx.vin ) {
26422642 bool isPublicSpend = txin.scriptSig .IsZerocoinPublicSpend ();
26432643 if (txin.scriptSig .IsZerocoinSpend () || isPublicSpend) {
26442644 CBigNum serial;
26452645 if (isPublicSpend) {
2646- libzerocoin::ZerocoinParams* params = Params ().Zerocoin_Params (false );
2646+ libzerocoin::ZerocoinParams * params = Params ().Zerocoin_Params (false );
26472647 PublicCoinSpend publicSpend (params);
26482648 CValidationState state;
2649- if (!ZPIVModule::ParseZerocoinPublicSpend (txin, tx, state, publicSpend)){
2649+ if (!ZPIVModule::ParseZerocoinPublicSpend (txin, tx, state, publicSpend)) {
26502650 return error (" Failed to parse public spend" );
26512651 }
26522652 serial = publicSpend.getCoinSerialNumber ();
@@ -2660,8 +2660,8 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
26602660
26612661 // if this was our spend, then mark it unspent now
26622662 if (pwalletMain) {
2663- if (pwalletMain->IsMyZerocoinSpend (spend. getCoinSerialNumber () )) {
2664- if (!pwalletMain->SetMintUnspent (spend. getCoinSerialNumber () ))
2663+ if (pwalletMain->IsMyZerocoinSpend (serial )) {
2664+ if (!pwalletMain->SetMintUnspent (serial ))
26652665 LogPrintf (" %s: failed to automatically reset mint" , __func__);
26662666 }
26672667 }
@@ -2670,18 +2670,19 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
26702670 }
26712671 }
26722672
2673- if (tx.HasZerocoinMintOutputs ()) {
2674- // erase all zerocoinmints in this transaction
2675- for (const CTxOut& txout : tx.vout ) {
2676- if (txout.scriptPubKey .empty () || !txout.IsZerocoinMint ())
2677- continue ;
2673+ if (tx.HasZerocoinMintOutputs ()) {
2674+ // erase all zerocoinmints in this transaction
2675+ for (const CTxOut & txout : tx.vout ) {
2676+ if (txout.scriptPubKey .empty () || !txout.IsZerocoinMint ())
2677+ continue ;
26782678
2679- PublicCoin pubCoin (Params ().Zerocoin_Params (false ));
2680- if (!TxOutToPublicCoin (txout, pubCoin, state))
2681- return error (" DisconnectBlock(): TxOutToPublicCoin() failed" );
2679+ PublicCoin pubCoin (Params ().Zerocoin_Params (false ));
2680+ if (!TxOutToPublicCoin (txout, pubCoin, state))
2681+ return error (" DisconnectBlock(): TxOutToPublicCoin() failed" );
26822682
2683- if (!zerocoinDB->EraseCoinMint (pubCoin.getValue ()))
2684- return error (" DisconnectBlock(): Failed to erase coin mint" );
2683+ if (!zerocoinDB->EraseCoinMint (pubCoin.getValue ()))
2684+ return error (" DisconnectBlock(): Failed to erase coin mint" );
2685+ }
26852686 }
26862687 }
26872688
0 commit comments