hygiene: Phase 4 — route unconditional debug output through LogPrint
Fourth phase of the code-hygiene remediation, addressing the ~1,082 stray
fprintf(stderr)/printf debug calls so consensus and hot paths stop spewing
to stderr/stdout. Done per-file (18 files) with conservative rules; the tree
builds clean, self-mines, and `verifychain` re-validates the whole chain
(pow/txdb/coins/miner paths) with -debug=1 enabling every converted line —
zero tinyformat/format-arg exceptions.
Net across 18 files: 174 commented-out debug lines deleted, 173 unconditional
live prints converted to LogPrint("<cat>",...)/LogPrintf (net/mining/pow/nspv/
zrpc categories, format strings + args preserved exactly), 40 pure-noise or
sensitive prints deleted, and 194 calls DELIBERATELY LEFT (already behind
fDebug/fZdebug guards, or genuine startup/fatal-error output that must reach
the console before logging init).
Notable:
- Deleted sensitive success-path dumps (nSPV SIG_TXHASH + full tx input/
output/change amounts; kvupdate privkey/pubkey hex) that were writing key
and amount material straight to stderr/stdout.
- Removed the raw 32-byte target hex dumps in the zawy adaptive-PoW helpers
and the legacy one-shot `if(height==340000)` HUSH artifact in pow.cpp.
- Converted per-tx relay + ban/banlist (net), per-setgenerate MININGTHREADS
(rpc/mining), signrawtransaction TXPOW, and per-message nSPV traces.
- Left format/arg-mismatched lines untouched (flagged) to avoid introducing
tinyformat runtime throws.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1231,7 +1231,6 @@ UniValue nspv_listtransactions(const UniValue& params, bool fHelp, const CPubKey
|
||||
CCflag = atoi((char *)params[1].get_str().c_str());
|
||||
if ( params.size() == 3 )
|
||||
skipcount = atoi((char *)params[2].get_str().c_str());
|
||||
//fprintf(stderr,"call txids cc.%d skip.%d\n",CCflag,skipcount);
|
||||
return(NSPV_addresstxids((char *)params[0].get_str().c_str(),CCflag,skipcount,0));
|
||||
}
|
||||
else throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n");
|
||||
@@ -1294,7 +1293,6 @@ UniValue nspv_spend(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
if ( NSPV_address.size() == 0 )
|
||||
throw runtime_error("to nspv_send you need an active nspv_login\n");
|
||||
satoshis = atof(params[1].get_str().c_str())*COIN + 0.0000000049;
|
||||
//fprintf(stderr,"satoshis.%lld from %.8f\n",(long long)satoshis,atof(params[1].get_str().c_str()));
|
||||
if ( satoshis < 1000 )
|
||||
throw runtime_error("amount too small\n");
|
||||
return(NSPV_spend((char *)NSPV_address.c_str(),(char *)params[0].get_str().c_str(),satoshis));
|
||||
|
||||
@@ -496,7 +496,6 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
|
||||
// Check amount
|
||||
if (nValue <= 0)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount");
|
||||
//fprintf(stderr,"nValue %.8f vs curBalance %.8f\n",(double)nValue/COIN,(double)curBalance/COIN);
|
||||
if (nValue > curBalance)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
|
||||
|
||||
@@ -518,9 +517,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
|
||||
for (i=0; i<opretlen; i++)
|
||||
{
|
||||
opretpubkey[i] = opretbuf[i];
|
||||
//printf("%02x",ptr[i]);
|
||||
}
|
||||
//printf(" opretbuf[%d]\n",opretlen);
|
||||
CRecipient opret = { opretpubkey, opretValue, false };
|
||||
vecSend.push_back(opret);
|
||||
}
|
||||
@@ -665,7 +662,6 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
if ( (n= (int32_t)params.size()) >= 3 )
|
||||
{
|
||||
flags = atoi(params[2].get_str().c_str());
|
||||
//printf("flags.%d (%s) n.%d\n",flags,params[2].get_str().c_str(),n);
|
||||
} else flags = 0;
|
||||
if ( n >= 4 )
|
||||
privkey = hush_kvprivkey(&pubkey,(char *)(n >= 4 ? params[3].get_str().c_str() : "password"));
|
||||
@@ -704,14 +700,11 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
if ( hush_kvsigverify(keyvalue,keylen+refvaluesize,refpubkey,sig) < 0 )
|
||||
{
|
||||
ret.push_back(Pair("error",(char *)"error verifying sig, passphrase is probably wrong"));
|
||||
printf("VERIFY ERROR\n");
|
||||
LogPrintf("VERIFY ERROR\n");
|
||||
return ret;
|
||||
} // else printf("verified immediately\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
//for (i=0; i<32; i++)
|
||||
// printf("%02x",((uint8_t *)&sig)[i]);
|
||||
//printf(" sig for keylen.%d + valuesize.%d\n",keylen,refvaluesize);
|
||||
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH3" : SMART_CHAIN_SYMBOL)));
|
||||
height = chainActive.LastTip()->GetHeight();
|
||||
if ( memcmp(&zeroes,&refpubkey,sizeof(refpubkey)) != 0 )
|
||||
@@ -749,9 +742,6 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
}
|
||||
if ( (opretlen= hush_opreturnscript(opretbuf,'K',keyvalue,coresize)) == 40 )
|
||||
opretlen++;
|
||||
//for (i=0; i<opretlen; i++)
|
||||
// printf("%02x",opretbuf[i]);
|
||||
//printf(" opretbuf keylen.%d valuesize.%d height.%d (%02x %02x %02x)\n",*(uint16_t *)&keyvalue[0],*(uint16_t *)&keyvalue[2],*(uint32_t *)&keyvalue[4],keyvalue[8],keyvalue[9],keyvalue[10]);
|
||||
EnsureWalletIsUnlocked();
|
||||
fee = hush_kvfee(flags,opretlen,keylen);
|
||||
ret.push_back(Pair("fee",(double)fee/COIN));
|
||||
@@ -1823,7 +1813,6 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
||||
BOOST_FOREACH(const COutputEntry& r, listReceived)
|
||||
{
|
||||
string account;
|
||||
//fprintf(stderr,"recv iter %s\n",wtx.GetHash().GetHex().c_str());
|
||||
if (pwalletMain->mapAddressBook.count(r.destination))
|
||||
account = pwalletMain->mapAddressBook[r.destination].name;
|
||||
if (fAllAccounts || (account == strAccount))
|
||||
@@ -1972,9 +1961,8 @@ UniValue listtransactions(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
CWalletTx *const pwtx = (*it).second.first;
|
||||
if (pwtx != 0)
|
||||
{
|
||||
//fprintf(stderr,"pwtx iter.%d %s\n",(int32_t)pwtx->nOrderPos,pwtx->GetHash().GetHex().c_str());
|
||||
ListTransactions(*pwtx, strAccount, 0, true, ret, filter);
|
||||
} //else fprintf(stderr,"null pwtx\n");
|
||||
}
|
||||
CAccountingEntry *const pacentry = (*it).second.second;
|
||||
if (pacentry != 0)
|
||||
AcentryToJSON(*pacentry, strAccount, ret);
|
||||
@@ -2959,7 +2947,6 @@ UniValue listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *tipindex,*pindex = it->second;
|
||||
uint32_t locktime;
|
||||
//fprintf(stderr,"nValue %.8f pindex.%p tipindex.%p locktime.%u txheight.%d pindexht.%d\n",(double)nValue/COIN,pindex,chainActive.LastTip(),locktime,txheight,pindex->GetHeight());
|
||||
}
|
||||
else if ( chainActive.LastTip() != 0 )
|
||||
txheight = (chainActive.LastTip()->GetHeight() - out.nDepth - 1);
|
||||
@@ -4675,7 +4662,6 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp, const CPubK
|
||||
obj.push_back(Pair("outindex", (int)entry.op.n));
|
||||
obj.push_back(Pair("rawconfirmations", entry.confirmations));
|
||||
auto wtx = pwalletMain->mapWallet.at(entry.op.hash); //.ToString());
|
||||
//fprintf(stderr,"%s: txid=%s not found in wallet!\n", __func__, entry.op.hash.ToString().c_str());
|
||||
obj.push_back(Pair("time", wtx.GetTxTime()));
|
||||
|
||||
obj.push_back(Pair("confirmations", dpowconfs));
|
||||
@@ -5245,7 +5231,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
// select a random address with enough confirmed balance
|
||||
auto nPotentials = vPotentialAddresses.size();
|
||||
if (nPotentials > 0) {
|
||||
fprintf(stderr,"%s: Selecting one of %lu potential source zaddrs\n", __func__, nPotentials);
|
||||
LogPrintf("%s: Selecting one of %lu potential source zaddrs\n", __func__, nPotentials);
|
||||
fromaddress = vPotentialAddresses[ GetRandInt(nPotentials) ];
|
||||
} else {
|
||||
// Automagic zaddr source selection failed, exit honorably
|
||||
@@ -5407,7 +5393,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
unsigned int MIN_ZOUTS=GetArg("-sietch-min-zouts", DEFAULT_MIN_ZOUTS);
|
||||
|
||||
if((MIN_ZOUTS<3) || (MIN_ZOUTS>MAX_ZOUTS)) {
|
||||
fprintf(stderr,"%s: Sietch min zouts must be >= 3 and <= %d, setting to default value of %d\n", __FUNCTION__, MAX_ZOUTS, DEFAULT_MIN_ZOUTS );
|
||||
LogPrintf("%s: Sietch min zouts must be >= 3 and <= %d, setting to default value of %d\n", __FUNCTION__, MAX_ZOUTS, DEFAULT_MIN_ZOUTS );
|
||||
MIN_ZOUTS=DEFAULT_MIN_ZOUTS;
|
||||
}
|
||||
|
||||
@@ -6025,8 +6011,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
CAmount nValue = out.tx->vout[out.i].nValue;
|
||||
|
||||
if (maximum_utxo_size != 0) {
|
||||
//fprintf(stderr, "utxo txid.%s vout.%i nValue.%li scriptpubkeylength.%i\n",out.tx->GetHash().ToString().c_str(),out.i,nValue,out.tx->vout[out.i].scriptPubKey.size());
|
||||
if (nValue > maximum_utxo_size)
|
||||
if (nValue > maximum_utxo_size)
|
||||
continue;
|
||||
if (nValue == 10000 && out.tx->vout[out.i].scriptPubKey.size() == 35)
|
||||
continue;
|
||||
@@ -6087,7 +6072,6 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
size_t numUtxos = utxoInputs.size();
|
||||
size_t numNotes = saplingNoteInputs.size();
|
||||
|
||||
//fprintf(stderr, "num utxos.%li\n", numUtxos);
|
||||
if (numUtxos < 2 && numNotes == 0) {
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Could not find any funds to merge.");
|
||||
}
|
||||
@@ -6248,7 +6232,6 @@ int32_t hush_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *pT
|
||||
script = (uint8_t *)&out.tx->vout[out.i].scriptPubKey[0];
|
||||
if ( out.tx->vout[out.i].scriptPubKey.size() != 35 || script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(notarypub33,script+1,33) != 0 )
|
||||
{
|
||||
//fprintf(stderr,"scriptsize.%d [0] %02x\n",(int32_t)out.tx->vout[out.i].scriptPubKey.size(),script[0]);
|
||||
continue;
|
||||
}
|
||||
utxovalue = (uint64_t)nValue;
|
||||
@@ -6256,7 +6239,6 @@ int32_t hush_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *pT
|
||||
utxotxid = out.tx->GetHash();
|
||||
utxovout = out.i;
|
||||
best_scriptPubKey = out.tx->vout[out.i].scriptPubKey;
|
||||
//fprintf(stderr,"check %s/v%d %llu\n",(char *)utxotxid.GetHex().c_str(),utxovout,(long long)utxovalue);
|
||||
|
||||
txNew.vin.resize(1);
|
||||
txNew.vout.resize((pTr!=0)+1);
|
||||
@@ -6277,15 +6259,14 @@ int32_t hush_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *pT
|
||||
CTransaction txNewConst(txNew);
|
||||
signSuccess = ProduceSignature(TransactionSignatureCreator(&keystore, &txNewConst, 0, utxovalue, SIGHASH_ALL), best_scriptPubKey, sigdata, consensusBranchId);
|
||||
if (!signSuccess)
|
||||
fprintf(stderr,"notaryvin failed to create signature\n");
|
||||
LogPrintf("notaryvin failed to create signature\n");
|
||||
else
|
||||
{
|
||||
UpdateTransaction(txNew,0,sigdata);
|
||||
ptr = (uint8_t *)&sigdata.scriptSig[0];
|
||||
siglen = sigdata.scriptSig.size();
|
||||
for (i=0; i<siglen; i++)
|
||||
utxosig[i] = ptr[i];//, fprintf(stderr,"%02x",ptr[i]);
|
||||
//fprintf(stderr," siglen.%d notaryvin %s/v%d\n",siglen,utxotxid.GetHex().c_str(),utxovout);
|
||||
utxosig[i] = ptr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-27
@@ -1160,9 +1160,6 @@ int64_t CWallet::NullifierCount()
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
if(fZdebug) {
|
||||
//fprintf(stderr,"%s:mapTxSaplingNullifers.size=%d\n",__FUNCTION__,(int)mapTxSaplingNullifiers.size() );
|
||||
//fprintf(stderr,"%s:mempool.getNullifiers.size=%d\n",__FUNCTION__,(int)mempool.getNullifiers().size() );
|
||||
//fprintf(stderr,"%s:cacheSaplingNullifiers.size=%d\n",__FUNCTION__,(int)pcoinsTip->getNullifiers().size() );
|
||||
}
|
||||
return pcoinsTip->getNullifiers().size();
|
||||
}
|
||||
@@ -1709,7 +1706,6 @@ CWallet::TxItems CWallet::OrderedTxItems(std::list<CAccountingEntry>& acentries,
|
||||
{
|
||||
CWalletTx* wtx = &((*it).second);
|
||||
txOrdered.insert(make_pair(wtx->nOrderPos, TxPair(wtx, (CAccountingEntry*)0)));
|
||||
//fprintf(stderr,"ordered iter.%d %s\n",(int32_t)wtx->nOrderPos,wtx->GetHash().GetHex().c_str());
|
||||
}
|
||||
acentries.clear();
|
||||
walletdb.ListAccountCreditDebit(strAccount, acentries);
|
||||
@@ -2016,9 +2012,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
||||
vAllowListAddress = mapMultiArgs["-allowlistaddress"];
|
||||
if ( !vAllowListAddress.empty() )
|
||||
{
|
||||
fprintf(stderr, "Activated Wallet Filter \n Notary Address: %s \n Adding allowlist address's:\n", NotaryAddress.c_str());
|
||||
LogPrintf("Activated Wallet Filter \n Notary Address: %s \n Adding allowlist address's:\n", NotaryAddress.c_str());
|
||||
for ( auto wladdr : vAllowListAddress )
|
||||
fprintf(stderr, " %s\n", wladdr.c_str());
|
||||
LogPrintf(" %s\n", wladdr.c_str());
|
||||
}
|
||||
}
|
||||
if (fExisted || IsMine(tx) || IsFromMe(tx) || saplingNoteData.size() > 0) {
|
||||
@@ -2036,7 +2032,6 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
||||
{
|
||||
if ( CBitcoinAddress(address).ToString() == wladdr )
|
||||
{
|
||||
//fprintf(stderr, "We received from allowlisted address.%s\n", wladdr.c_str());
|
||||
numvinIsAllowList++;
|
||||
}
|
||||
}
|
||||
@@ -2044,7 +2039,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
||||
}
|
||||
// Now we know if it was a tx sent to us, by either a allowlisted address, or ourself.
|
||||
if ( numvinIsOurs != 0 )
|
||||
fprintf(stderr, "We sent from address: %s vins: %d\n",NotaryAddress.c_str(),numvinIsOurs);
|
||||
LogPrintf("We sent from address: %s vins: %d\n",NotaryAddress.c_str(),numvinIsOurs);
|
||||
if ( numvinIsOurs == 0 && numvinIsAllowList == 0 )
|
||||
return false;
|
||||
}
|
||||
@@ -3047,14 +3042,12 @@ void CWalletTx::GetAmounts(list<COutputEntry>& listReceived,
|
||||
{
|
||||
if ( oneshot++ > 1 )
|
||||
{
|
||||
//fprintf(stderr,"skip change vout\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(fIsMine & filter))
|
||||
{
|
||||
//fprintf(stderr,"skip filtered vout %d %d\n",(int32_t)fIsMine,(int32_t)filter);
|
||||
continue;
|
||||
}
|
||||
// In either case, we need to get the destination address
|
||||
@@ -3575,7 +3568,6 @@ void CWallet::ReacceptWalletTransactions()
|
||||
bool invalid = state.IsInvalid(nDoS);
|
||||
|
||||
// log rejection and deletion
|
||||
//printf("ERROR reaccepting wallet transaction %s to mempool, reason: %s, DoS: %d\n", wtx.GetHash().ToString().c_str(), state.GetRejectReason().c_str(), nDoS);
|
||||
|
||||
if (!wtx.IsCoinBase() && invalid && nDoS > 0 && state.GetRejectReason() != "tx-overwinter-expired")
|
||||
{
|
||||
@@ -3593,11 +3585,8 @@ void CWallet::ReacceptWalletTransactions()
|
||||
bool CWalletTx::RelayWalletTransaction()
|
||||
{
|
||||
int64_t nNow = GetTime();
|
||||
//if(fZdebug)
|
||||
// LogPrintf("%s: now=%li\n",__func__,nNow);
|
||||
if ( pwallet == 0 )
|
||||
{
|
||||
//fprintf(stderr,"unexpected null pwallet in RelayWalletTransaction\n");
|
||||
return(false);
|
||||
}
|
||||
assert(pwallet->GetBroadcastTransactions());
|
||||
@@ -3835,7 +3824,7 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
|
||||
// Do not relay expired transactions, to avoid other nodes banning us
|
||||
// Current code will not ban nodes relaying expired txs but older nodes will
|
||||
if (wtx.nExpiryHeight > 0 && wtx.nExpiryHeight < chainActive.LastTip()->GetHeight()) {
|
||||
fprintf(stderr,"%s: ignoring expired tx %s with expiry %d at height %d\n", __func__, wtx.GetHash().ToString().c_str(), wtx.nExpiryHeight, chainActive.LastTip()->GetHeight() );
|
||||
LogPrintf("%s: ignoring expired tx %s with expiry %d at height %d\n", __func__, wtx.GetHash().ToString().c_str(), wtx.nExpiryHeight, chainActive.LastTip()->GetHeight() );
|
||||
// TODO: expired detection doesn't seem to work right
|
||||
// append to list of txs to delete
|
||||
// vwtxh.push_back(wtx.GetHash());
|
||||
@@ -4156,7 +4145,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
nTotalLower += n;
|
||||
if ( nTotalLower > 4*nTargetValue + CENT )
|
||||
{
|
||||
//fprintf(stderr,"why bother with all the utxo if we have double what is needed?\n");
|
||||
break;
|
||||
}
|
||||
} else if (n < coinLowestLarger.first)
|
||||
@@ -4498,7 +4486,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
//reflecting an assumption the user would accept a bit more delay for
|
||||
//a chance at a free transaction.
|
||||
//But mempool inputs might still be in the mempool, so their age stays 0
|
||||
//fprintf(stderr,"nCredit %.8f interest %.8f\n",(double)nCredit/COIN,(double)pcoin.first->vout[pcoin.second].interest/COIN);
|
||||
int age = pcoin.first->GetDepthInMainChain();
|
||||
if (age != 0)
|
||||
age += 1;
|
||||
@@ -4542,7 +4529,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
}
|
||||
else
|
||||
{
|
||||
//fprintf(stderr,"use notary pubkey\n");
|
||||
scriptChange = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
||||
}
|
||||
}
|
||||
@@ -4739,7 +4725,6 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
|
||||
// Broadcast
|
||||
if (!wtxNew.AcceptToMemoryPool(false))
|
||||
{
|
||||
fprintf(stderr,"commit failed\n");
|
||||
// This must not fail. The transaction has already been signed and recorded.
|
||||
LogPrintf("CommitTransaction(): Error: Transaction not valid\n");
|
||||
return false;
|
||||
@@ -4789,7 +4774,7 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||
fFirstRunRet = false;
|
||||
if ( 0 ) // doesnt help
|
||||
{
|
||||
fprintf(stderr,"loading wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
|
||||
LogPrintf("loading wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
|
||||
FILE *fp;
|
||||
if ( (fp= fopen(strWalletFile.c_str(),"rb")) != 0 )
|
||||
{
|
||||
@@ -4797,9 +4782,7 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"prefetched wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
|
||||
DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this);
|
||||
//fprintf(stderr,"loaded wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
|
||||
if (nLoadWalletRet == DB_NEED_REWRITE)
|
||||
{
|
||||
if (CDB::Rewrite(strWalletFile, "\x04pool"))
|
||||
@@ -4984,7 +4967,6 @@ void CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool)
|
||||
if (!HaveKey(keypool.vchPubKey.GetID()))
|
||||
throw runtime_error("ReserveKeyFromKeyPool(): unknown key in key pool");
|
||||
assert(keypool.vchPubKey.IsValid());
|
||||
//LogPrintf("keypool reserve %d\n", nIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5006,7 +4988,6 @@ void CWallet::ReturnKey(int64_t nIndex)
|
||||
LOCK(cs_wallet);
|
||||
setKeyPool.insert(nIndex);
|
||||
}
|
||||
//LogPrintf("keypool return %d\n", nIndex);
|
||||
}
|
||||
|
||||
bool CWallet::GetKeyFromPool(CPubKey& result)
|
||||
@@ -5293,14 +5274,14 @@ void CWallet::LockNote(const SaplingOutPoint& output)
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
setLockedSaplingNotes.insert(output);
|
||||
fprintf(stderr,"%s: locking note %s...\n", __func__, output.hash.ToString().substr(0,8).c_str() );
|
||||
LogPrintf("%s: locking note %s...\n", __func__, output.hash.ToString().substr(0,8).c_str() );
|
||||
}
|
||||
|
||||
void CWallet::UnlockNote(const SaplingOutPoint& output)
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
setLockedSaplingNotes.erase(output);
|
||||
fprintf(stderr,"%s: unlocking note %s...\n", __func__, output.hash.ToString().substr(0,8).c_str() );
|
||||
LogPrintf("%s: unlocking note %s...\n", __func__, output.hash.ToString().substr(0,8).c_str() );
|
||||
}
|
||||
|
||||
void CWallet::UnlockAllSaplingNotes()
|
||||
@@ -5540,7 +5521,6 @@ int CMerkleTx::GetBlocksToMaturity() const
|
||||
int32_t depth = GetDepthInMainChain();
|
||||
int32_t ut = UnlockTime(0);
|
||||
int32_t toMaturity = (ut - chainActive.Height()) < 0 ? 0 : ut - chainActive.Height();
|
||||
//printf("depth.%i, unlockTime.%i, toMaturity.%i\n", depth, ut, toMaturity);
|
||||
ut = (COINBASE_MATURITY - depth) < 0 ? 0 : COINBASE_MATURITY - depth;
|
||||
return(ut < toMaturity ? toMaturity : ut);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user