Browse Source

Merge pull request #1 from MyHush/duke

sync upstream
danger
Denio 4 years ago
committed by GitHub
parent
commit
15b2e598c6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/wallet/rpcwallet.cpp
  2. 33
      src/wallet/wallet.cpp

10
src/wallet/rpcwallet.cpp

@ -4388,7 +4388,9 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp, const CPubKey& my
// Fetch the note that is being spent
auto res = pwalletMain->mapSaplingNullifiersToNotes.find(spend.nullifier);
if (res == pwalletMain->mapSaplingNullifiersToNotes.end()) {
fprintf(stderr,"Could not find spending note %s", uint256_str(str, spend.nullifier));
if(fZdebug) {
fprintf(stderr,"Could not find spending note %s\n", uint256_str(str, spend.nullifier));
}
continue;
}
auto op = res->second;
@ -4442,8 +4444,10 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp, const CPubKey& my
pa = recovered->second;
isOutgoing = true;
} else {
// Unreadable
fprintf(stderr,"Could not recover Sapling note!");
// Unreadable or unconfirmed?
if(fZdebug) {
fprintf(stderr,"Could not recover Sapling note!\n");
}
continue;
}
}

33
src/wallet/wallet.cpp

@ -1288,10 +1288,6 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly)
LogPrintf("Building Witnesses for block %i %.4f complete\n", pblockindex->GetHeight(), pblockindex->GetHeight() / double(height));
}
SproutMerkleTree sproutTree;
sproutRoot = pblockindex->pprev->hashFinalSproutRoot;
pcoinsTip->GetSproutAnchorAt(sproutRoot, sproutTree);
SaplingMerkleTree saplingTree;
saplingRoot = pblockindex->pprev->hashFinalSaplingRoot;
pcoinsTip->GetSaplingAnchorAt(saplingRoot, saplingTree);
@ -1302,7 +1298,7 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly)
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
if (wtxItem.second.mapSproutNoteData.empty() && wtxItem.second.mapSaplingNoteData.empty())
if (wtxItem.second.mapSaplingNoteData.empty())
continue;
if (wtxItem.second.GetDepthInMainChain() > 0) {
@ -3066,38 +3062,11 @@ void CWallet::DeleteWalletTransactions(const CBlockIndex* pindex) {
continue;
}
//Check for unspent inputs or spend less than N Blocks ago. (Sprout)
for (auto & pair : pwtx->mapSproutNoteData) {
SproutNoteData nd = pair.second;
if (!nd.nullifier || pwalletMain->GetSproutSpendDepth(*nd.nullifier) <= fDeleteTransactionsAfterNBlocks) {
LogPrint("deletetx","DeleteTx - Unspent sprout input tx %s\n", pwtx->GetHash().ToString());
deleteTx = false;
continue;
}
}
if (!deleteTx) {
txSaveCount++;
continue;
}
//Check for outputs that no longer have parents in the wallet. Exclude parents that are in the same transaction. (Sprout)
for (int i = 0; i < pwtx->vjoinsplit.size(); i++) {
const JSDescription& jsdesc = pwtx->vjoinsplit[i];
for (const uint256 &nullifier : jsdesc.nullifiers) {
// JSOutPoint op = pwalletMain->mapSproutNullifiersToNotes[nullifier];
if (pwalletMain->IsSproutNullifierFromMe(nullifier)) {
const uint256& parentHash = pwalletMain->mapSproutNullifiersToNotes[nullifier].hash;
const CWalletTx* parent = pwalletMain->GetWalletTx(parentHash);
if (parent != NULL && parentHash != wtxid) {
LogPrint("deletetx","DeleteTx - Parent of sprout tx %s found\n", pwtx->GetHash().ToString());
deleteTx = false;
continue;
}
}
}
}
if (!deleteTx) {
txSaveCount++;
continue;

Loading…
Cancel
Save