Add more logging for consolidation + sweeping
This commit is contained in:
@@ -50,7 +50,7 @@ void AsyncRPCOperation_saplingconsolidation::main() {
|
|||||||
set_error_code(code);
|
set_error_code(code);
|
||||||
set_error_message(message);
|
set_error_message(message);
|
||||||
} catch (const runtime_error& e) {
|
} catch (const runtime_error& e) {
|
||||||
std::cerr << boost::stacktrace::stacktrace() << '\n';
|
std::cerr << "Consolidation stacktrace:" << '\n' << boost::stacktrace::stacktrace() << '\n';
|
||||||
set_error_code(-1);
|
set_error_code(-1);
|
||||||
set_error_code(-1);
|
set_error_code(-1);
|
||||||
set_error_message("runtime error: " + string(e.what()));
|
set_error_message("runtime error: " + string(e.what()));
|
||||||
@@ -73,7 +73,7 @@ void AsyncRPCOperation_saplingconsolidation::main() {
|
|||||||
set_state(OperationStatus::FAILED);
|
set_state(OperationStatus::FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string s = strprintf("%s: Sapling Consolidation transaction created. (status=%s", getId(), getStateAsString());
|
std::string s = strprintf("%s: Sapling Consolidation operation complete. (status=%s", getId(), getStateAsString());
|
||||||
if (success) {
|
if (success) {
|
||||||
s += strprintf(", success)\n");
|
s += strprintf(", success)\n");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -515,13 +515,14 @@ void CWallet::RunSaplingSweep(int blockHeight) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogPrintf("%s: Sweep enabled at blockHeight=%d nextSweep=%d\n", __func__, blockHeight, nextSweep);
|
||||||
if (nextSweep > blockHeight) {
|
if (nextSweep > blockHeight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Don't Run if consolidation will run soon.
|
//Don't Run if consolidation will run soon.
|
||||||
if (fSaplingConsolidationEnabled && nextConsolidation - 5 <= blockHeight) {
|
if (fSaplingConsolidationEnabled && nextConsolidation - 5 <= blockHeight) {
|
||||||
LogPrintf("%s: not consolidating since next sweep is within 5 blocks\n", __func__);
|
LogPrintf("%s: not sweeping since next consolidation is within 5 blocks, nextConsolidation=%d , blockHeight=%d\n", __func__, nextConsolidation, blockHeight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,9 +546,10 @@ void CWallet::RunSaplingSweep(int blockHeight) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::RunSaplingConsolidation(int blockHeight) {
|
void CWallet::RunSaplingConsolidation(int blockHeight) {
|
||||||
if (!NetworkUpgradeActive(blockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
// Sapling is always active on HUSH+HSCs
|
||||||
return;
|
//if (!NetworkUpgradeActive(blockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||||
}
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
|
|
||||||
@@ -555,6 +557,8 @@ void CWallet::RunSaplingConsolidation(int blockHeight) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogPrintf("%s: consolidation enabled at blockHeight=%d fSweepRunning=%d\n", __func__, blockHeight, fSweepRunning );
|
||||||
|
|
||||||
if (fSweepRunning) {
|
if (fSweepRunning) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -565,6 +569,7 @@ void CWallet::RunSaplingConsolidation(int blockHeight) {
|
|||||||
fprintf(stderr,"%s: height=%d interval=%d\n", __func__, blockHeight, consolidateInterval);
|
fprintf(stderr,"%s: height=%d interval=%d\n", __func__, blockHeight, consolidateInterval);
|
||||||
|
|
||||||
if (blockHeight % consolidateInterval == 0) {
|
if (blockHeight % consolidateInterval == 0) {
|
||||||
|
LogPrintf("%s: creating consolidation operation at blockHeight=%d\n", __func__, blockHeight);
|
||||||
std::shared_ptr<AsyncRPCQueue> q = getAsyncRPCQueue();
|
std::shared_ptr<AsyncRPCQueue> q = getAsyncRPCQueue();
|
||||||
std::shared_ptr<AsyncRPCOperation> lastOperation = q->getOperationForId(saplingConsolidationOperationId);
|
std::shared_ptr<AsyncRPCOperation> lastOperation = q->getOperationForId(saplingConsolidationOperationId);
|
||||||
if (lastOperation != nullptr) {
|
if (lastOperation != nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user