@@ -2636,17 +2636,17 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
2636
2636
* addresses should still be handled by the typical bitcoin based undo code
2637
2637
* */
2638
2638
if (tx.ContainsZerocoins()) {
2639
- if (tx.IsZerocoinSpend ()) {
2639
+ if (tx.HasZerocoinSpendInputs ()) {
2640
2640
//erase all zerocoinspends in this transaction
2641
- for (const CTxIn& txin : tx.vin) {
2641
+ for (const CTxIn & txin : tx.vin) {
2642
2642
bool isPublicSpend = txin.scriptSig.IsZerocoinPublicSpend();
2643
2643
if (txin.scriptSig.IsZerocoinSpend() || isPublicSpend) {
2644
2644
CBigNum serial;
2645
2645
if (isPublicSpend) {
2646
- libzerocoin::ZerocoinParams* params = Params().Zerocoin_Params(false);
2646
+ libzerocoin::ZerocoinParams * params = Params().Zerocoin_Params(false);
2647
2647
PublicCoinSpend publicSpend(params);
2648
2648
CValidationState state;
2649
- if (!ZPIVModule::ParseZerocoinPublicSpend(txin, tx, state, publicSpend)){
2649
+ if (!ZPIVModule::ParseZerocoinPublicSpend(txin, tx, state, publicSpend)) {
2650
2650
return error("Failed to parse public spend");
2651
2651
}
2652
2652
serial = publicSpend.getCoinSerialNumber();
@@ -2660,8 +2660,8 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
2660
2660
2661
2661
//if this was our spend, then mark it unspent now
2662
2662
if (pwalletMain) {
2663
- if (pwalletMain->IsMyZerocoinSpend(spend.getCoinSerialNumber() )) {
2664
- if (!pwalletMain->SetMintUnspent(spend.getCoinSerialNumber() ))
2663
+ if (pwalletMain->IsMyZerocoinSpend(serial )) {
2664
+ if (!pwalletMain->SetMintUnspent(serial ))
2665
2665
LogPrintf("%s: failed to automatically reset mint", __func__);
2666
2666
}
2667
2667
}
@@ -2670,18 +2670,19 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
2670
2670
}
2671
2671
}
2672
2672
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;
2678
2678
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");
2682
2682
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
+ }
2685
2686
}
2686
2687
}
2687
2688
0 commit comments