mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
CSurjectionCheck copies vector instead of swapping
This commit is contained in:
parent
3c376534e3
commit
87c1fc29af
1 changed files with 1 additions and 8 deletions
|
|
@ -611,9 +611,7 @@ private:
|
||||||
secp256k1_generator gen;
|
secp256k1_generator gen;
|
||||||
const bool store;
|
const bool store;
|
||||||
public:
|
public:
|
||||||
CSurjectionCheck(secp256k1_surjectionproof& proofIn, std::vector<secp256k1_generator>& vTags_, secp256k1_generator& genIn, const bool storeIn) : proof(proofIn), gen(genIn), store(storeIn) {
|
CSurjectionCheck(secp256k1_surjectionproof& proofIn, std::vector<secp256k1_generator>& tags_in, secp256k1_generator& genIn, const bool storeIn) : proof(proofIn), vTags(tags_in), gen(genIn), store(storeIn) {}
|
||||||
vTags.swap(vTags_);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator()();
|
bool operator()();
|
||||||
};
|
};
|
||||||
|
|
@ -954,8 +952,6 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<secp256k1_generator> copy_targetGenerators(targetGenerators);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < tx.vout.size(); i++)
|
for (size_t i = 0; i < tx.vout.size(); i++)
|
||||||
{
|
{
|
||||||
const CConfidentialAsset& asset = tx.vout[i].nAsset;
|
const CConfidentialAsset& asset = tx.vout[i].nAsset;
|
||||||
|
|
@ -979,9 +975,6 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
||||||
if (!QueueCheck(pvChecks, new CSurjectionCheck(proof, targetGenerators, gen, cacheStore))) {
|
if (!QueueCheck(pvChecks, new CSurjectionCheck(proof, targetGenerators, gen, cacheStore))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Each CSurjectionCheck uses swap to keep pointers valid.
|
|
||||||
// Original values need to put back in place for next output
|
|
||||||
targetGenerators = copy_targetGenerators;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue