wallet/rpc: fix listtransactions with a large count, and read wallet data by reference in more RPCs
The parts of origin/perf/wallet-scan-rpc-costs that dev's note cache did not already cover: - listtransactions computed count+from in an int, so a large count (e.g. INT_MAX, a common "all" idiom) wrapped and returned nothing. It is now clamped. Regtest: `listtransactions "*" 2147483647 1` returned 0 entries on the old binary and 150 of 151 here; a normal page is byte-identical. - Fewer per-entry copies of wallet transactions in listtransactions and gettransaction, and reads by reference in other wallet RPCs. - z_viewtransaction skips a spend whose parent transaction is no longer in the wallet (e.g. after -deletetx) instead of failing with map::at; that spend, and outputs only its key could recover, are then left out of the reply. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3351,12 +3351,14 @@ boost::optional<std::pair<
|
||||
SaplingPaymentAddress>> CWalletTx::DecryptSaplingNote(SaplingOutPoint op) const
|
||||
{
|
||||
// Check whether we can decrypt this SaplingOutPoint
|
||||
if (this->mapSaplingNoteData.count(op) == 0) {
|
||||
mapSaplingNoteData_t::const_iterator ndIt = this->mapSaplingNoteData.find(op);
|
||||
if (ndIt == this->mapSaplingNoteData.end()) {
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
auto output = this->vShieldedOutput[op.n];
|
||||
auto nd = this->mapSaplingNoteData.at(op);
|
||||
// References: a SaplingNoteData copy deep-copies the note's witness list.
|
||||
const OutputDescription& output = this->vShieldedOutput[op.n];
|
||||
const SaplingNoteData& nd = ndIt->second;
|
||||
|
||||
auto maybe_pt = SaplingNotePlaintext::decrypt(
|
||||
output.encCiphertext,
|
||||
|
||||
Reference in New Issue
Block a user