Fix deletetx=1 coredump and more logspam

This commit is contained in:
Duke Leto
2020-09-21 01:03:38 -04:00
parent 61e805083c
commit b5d308f182
3 changed files with 11 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2016 The Zcash developers // Copyright (c) 2016 The Zcash developers
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php // file COPYING or https://www.opensource.org/licenses/mit-license.php
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *

View File

@@ -78,7 +78,7 @@ void AsyncRPCOperation_saplingconsolidation::main() {
bool AsyncRPCOperation_saplingconsolidation::main_impl() { bool AsyncRPCOperation_saplingconsolidation::main_impl() {
bool status=true; bool status=true;
auto opid=getId(); auto opid=getId();
LogPrint("zrpcunsafe", "%s: Beginning AsyncRPCOperation_saplingconsolidation.\n", opid); LogPrintf("%s: Beginning AsyncRPCOperation_saplingconsolidation.\n", __func__, opid);
auto consensusParams = Params().GetConsensus(); auto consensusParams = Params().GetConsensus();
auto nextActivationHeight = NextActivationHeight(targetHeight_, consensusParams); auto nextActivationHeight = NextActivationHeight(targetHeight_, consensusParams);
if (nextActivationHeight && targetHeight_ + CONSOLIDATION_EXPIRY_DELTA >= nextActivationHeight.get()) { if (nextActivationHeight && targetHeight_ + CONSOLIDATION_EXPIRY_DELTA >= nextActivationHeight.get()) {
@@ -161,7 +161,7 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() {
auto builder = TransactionBuilder(consensusParams, targetHeight_, pwalletMain); auto builder = TransactionBuilder(consensusParams, targetHeight_, pwalletMain);
//builder.SetExpiryHeight(targetHeight_ + CONSOLIDATION_EXPIRY_DELTA); //builder.SetExpiryHeight(targetHeight_ + CONSOLIDATION_EXPIRY_DELTA);
auto actualAmountToSend = amountToSend < fConsolidationTxFee ? 0 : amountToSend - fConsolidationTxFee; auto actualAmountToSend = amountToSend < fConsolidationTxFee ? 0 : amountToSend - fConsolidationTxFee;
LogPrint("zrpcunsafe", "%s: Beginning to create transaction with Sapling output amount=%s\n", opid, FormatMoney(actualAmountToSend)); LogPrintf("%s: %s Beginning to create transaction with Sapling output amount=%s\n", __func__, opid, FormatMoney(actualAmountToSend));
// Select Sapling notes // Select Sapling notes
std::vector<SaplingOutPoint> ops; std::vector<SaplingOutPoint> ops;

View File

@@ -2452,20 +2452,22 @@ void CWallet::UpdateWalletTransactionOrder(std::map<std::pair<int,int>, CWalletT
CWalletDB walletdb(strWalletFile, "r+", false); CWalletDB walletdb(strWalletFile, "r+", false);
for (map<const uint256, CWalletTx*>::iterator it = mapUpdatedTxs.begin(); it != mapUpdatedTxs.end(); ++it) { for (map<const uint256, CWalletTx*>::iterator it = mapUpdatedTxs.begin(); it != mapUpdatedTxs.end(); ++it) {
CWalletTx* pwtx = it->second; CWalletTx* pwtx = it->second;
LogPrintf("%s: Updating Positon to %i for Tx %s\n ", __func__, pwtx->nOrderPos, pwtx->GetHash().ToString()); LogPrintf("%s: Updating Position to %i for Tx %s\n ", __func__, pwtx->nOrderPos, pwtx->GetHash().ToString());
bool ret = pwtx->WriteToDisk(&walletdb); bool ret = pwtx->WriteToDisk(&walletdb);
if(fZdebug) if(fZdebug)
fprintf(stderr,"%s: wrote data to disk at %s for tx=%s ret=%d\n",__func__, strWalletFile.c_str(), pwtx->GetHash().ToString().c_str(), ret ); fprintf(stderr,"%s: wrote data to disk at %s for tx=%s ret=%d\n",__func__, strWalletFile.c_str(), pwtx->GetHash().ToString().c_str(), ret );
mapWallet[pwtx->GetHash()].nOrderPos = pwtx->nOrderPos; mapWallet[pwtx->GetHash()].nOrderPos = pwtx->nOrderPos;
} }
if(fZdebug)
fprintf(stderr,"%s: updated nOrderPos on %lu transactions\n",__func__, mapUpdatedTxs.size() );
//Update Next Wallet Tx Positon //Update Next Wallet Tx Position
nOrderPosNext = previousPosition++; nOrderPosNext = previousPosition++;
CWalletDB(strWalletFile).WriteOrderPosNext(nOrderPosNext); CWalletDB(strWalletFile).WriteOrderPosNext(nOrderPosNext);
if(fZdebug) if(fZdebug)
fprintf(stderr,"%s: wrote data to disk at %s nOrderPosNext=%li\n",__func__, strWalletFile.c_str(), nOrderPosNext ); fprintf(stderr,"%s: wrote data to disk at %s nOrderPosNext=%li\n",__func__, strWalletFile.c_str(), nOrderPosNext );
LogPrint("%s: Total Transactions Reordered %i, Next Position %i\n ", __func__, mapUpdatedTxs.size(), nOrderPosNext); LogPrintf("%s: Total Transactions Reordered %i, Next Position %i\n ", __func__, mapUpdatedTxs.size(), nOrderPosNext);
} }
/** /**
@@ -2692,7 +2694,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
int64_t nNow = GetTime(); int64_t nNow = GetTime();
const CChainParams& chainParams = Params(); const CChainParams& chainParams = Params();
if(fZdebug) if(fZdebug)
LogPrintf("%s: fUpdate=%d now=%li\n",fUpdate,nNow); LogPrintf("%s: fUpdate=%d now=%li\n",__func__,fUpdate,nNow);
CBlockIndex* pindex = pindexStart; CBlockIndex* pindex = pindexStart;
{ {
@@ -2755,7 +2757,7 @@ void CWallet::ReacceptWalletTransactions()
{ {
int64_t nNow = GetTime(); int64_t nNow = GetTime();
if(fZdebug) if(fZdebug)
LogPrintf("%s: now=%li\n",nNow); LogPrintf("%s: now=%li\n",__func__,nNow);
if ( IsInitialBlockDownload() ) if ( IsInitialBlockDownload() )
return; return;
@@ -2814,7 +2816,7 @@ bool CWalletTx::RelayWalletTransaction()
{ {
int64_t nNow = GetTime(); int64_t nNow = GetTime();
if(fZdebug) if(fZdebug)
LogPrintf("%s: now=%li\n",nNow); LogPrintf("%s: now=%li\n",__func__,nNow);
if ( pwallet == 0 ) if ( pwallet == 0 )
{ {
//fprintf(stderr,"unexpected null pwallet in RelayWalletTransaction\n"); //fprintf(stderr,"unexpected null pwallet in RelayWalletTransaction\n");