mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
VerifyAmounts: break out asserts into result checks only
This commit is contained in:
parent
8ab5a89f71
commit
29b8fe161b
1 changed files with 7 additions and 3 deletions
|
|
@ -669,6 +669,7 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
// This is used to add in the explicit values
|
||||
unsigned char explBlinds[32];
|
||||
memset(explBlinds, 0, sizeof(explBlinds));
|
||||
int ret;
|
||||
|
||||
// Tally up value commitments, check balance
|
||||
if (!tx.IsCoinBase())
|
||||
|
|
@ -685,7 +686,8 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
if (asset.IsAssetID()) {
|
||||
uint256 fixedAsset;
|
||||
asset.GetAssetID(fixedAsset);
|
||||
assert(secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, fixedAsset.begin()));
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, fixedAsset.begin());
|
||||
assert(ret != 0);
|
||||
}
|
||||
else if (asset.IsAssetCommitment()) {
|
||||
if (secp256k1_generator_parse(secp256k1_ctx_verify_amounts, &gen, &asset.vchAssetTag[0]) != 1)
|
||||
|
|
@ -729,7 +731,8 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
if (asset.IsAssetID()) {
|
||||
uint256 fixedAsset;
|
||||
asset.GetAssetID(fixedAsset);
|
||||
assert(secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, fixedAsset.begin()));
|
||||
ret = secp256k1_generator_generate(secp256k1_ctx_verify_amounts, &gen, fixedAsset.begin());
|
||||
assert(ret != 0);
|
||||
}
|
||||
else if (asset.IsAssetCommitment()) {
|
||||
if (secp256k1_generator_parse(secp256k1_ctx_verify_amounts, &gen, &asset.vchAssetTag[0]) != 1)
|
||||
|
|
@ -787,7 +790,8 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
|
|||
if (asset.IsAssetID()) {
|
||||
uint256 fixedAsset;
|
||||
asset.GetAssetID(fixedAsset);
|
||||
assert(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], fixedAsset.begin());
|
||||
assert(ret != 0);
|
||||
}
|
||||
else {
|
||||
if (secp256k1_generator_parse(secp256k1_ctx_verify_amounts, &ephemeral_input_tags[i], &asset.vchAssetTag[0]) != 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue