mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
CA: Switch CTxOutAsset::GetAssetID() to return a constant reference to the stored asset ID rather than perform unnecessary memory reallocation.
This commit is contained in:
parent
c8307f5f58
commit
8b2cb06617
7 changed files with 35 additions and 48 deletions
|
|
@ -684,9 +684,7 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
return false;
|
||||
|
||||
if (asset.IsAsset()) {
|
||||
CAsset fixedAsset;
|
||||
asset.GetAsset(fixedAsset);
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, fixedAsset.begin());
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, asset.GetAsset().begin());
|
||||
assert(ret != 0);
|
||||
}
|
||||
else if (asset.IsAssetCommitment()) {
|
||||
|
|
@ -729,9 +727,7 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
return false;
|
||||
|
||||
if (asset.IsAsset()) {
|
||||
CAsset fixedAsset;
|
||||
asset.GetAsset(fixedAsset);
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, fixedAsset.begin());
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, asset.GetAsset().begin());
|
||||
assert(ret != 0);
|
||||
}
|
||||
else if (asset.IsAssetCommitment()) {
|
||||
|
|
@ -788,9 +784,7 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
{
|
||||
const CTxOutAsset& asset = cache.GetOutputFor(tx.vin[i]).nAsset;
|
||||
if (asset.IsAsset()) {
|
||||
CAsset fixedAsset;
|
||||
asset.GetAsset(fixedAsset);
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &ephemeral_input_tags[i], fixedAsset.begin());
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &ephemeral_input_tags[i], asset.GetAsset().begin());
|
||||
assert(ret != 0);
|
||||
}
|
||||
else {
|
||||
|
|
@ -834,9 +828,7 @@ bool VerifyCoinbaseAmount(const CTransaction& tx, const CAmountMap& mapFees)
|
|||
for (unsigned int i = 0; i < tx.vout.size(); i++) {
|
||||
if (!tx.vout[i].nValue.IsAmount() || !tx.vout[i].nAsset.IsAsset())
|
||||
return false;
|
||||
CAsset asset;
|
||||
tx.vout[i].nAsset.GetAsset(asset);
|
||||
remaining[asset] -= tx.vout[i].nValue.GetAmount();
|
||||
remaining[tx.vout[i].nAsset.GetAsset()] -= tx.vout[i].nValue.GetAmount();
|
||||
}
|
||||
return MoneyRange(remaining);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue