CT: Turn CTxOut::vchNonceCommitment into a CConfidentialCommitment subclass

Note: This changes the serialization of the nonce commitment, from an arbitrary length vector to an either 1 (null) or 33 (commitment) byte fixed format.
This commit is contained in:
Mark Friedenbach 2017-03-10 04:08:08 -08:00 committed by Gregory Sanders
parent a2c0f11f8e
commit 58c21ae15c
6 changed files with 31 additions and 19 deletions

View file

@ -724,7 +724,9 @@ bool VerifyAmounts(const CCoinsViewCache& cache, const CTransaction& tx, std::ve
const CConfidentialAsset& asset = tx.vout[i].nAsset;
assert(val.vchCommitment.size() == CConfidentialValue::nCommittedSize ||
val.vchCommitment.size() == CConfidentialValue::nExplicitSize);
if (tx.vout[i].vchNonceCommitment.size() > 33 || tx.vout[i].vchRangeproof.size() > 5000)
if (!tx.vout[i].nNonce.IsValid())
return false;
if (tx.vout[i].vchRangeproof.size() > 5000)
return false;
if (asset.IsExplicit()) {