mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
fix old bulletproof conditional branches
This commit is contained in:
parent
140daa4783
commit
22d3dc9a45
5 changed files with 16 additions and 4 deletions
|
@ -164,7 +164,7 @@ namespace cryptonote
|
||||||
if (!base_only)
|
if (!base_only)
|
||||||
{
|
{
|
||||||
const bool bulletproof = rct::is_rct_bulletproof(rv.type);
|
const bool bulletproof = rct::is_rct_bulletproof(rv.type);
|
||||||
if (bulletproof && rv.type == rct::RCTTypeBulletproof)
|
if (rct::is_rct_new_bulletproof(rv.type))
|
||||||
{
|
{
|
||||||
if (rv.p.bulletproofs.size() != 1)
|
if (rv.p.bulletproofs.size() != 1)
|
||||||
{
|
{
|
||||||
|
@ -430,6 +430,12 @@ namespace cryptonote
|
||||||
const rct::rctSig &rv = tx.rct_signatures;
|
const rct::rctSig &rv = tx.rct_signatures;
|
||||||
if (!rct::is_rct_bulletproof(rv.type))
|
if (!rct::is_rct_bulletproof(rv.type))
|
||||||
return blob_size;
|
return blob_size;
|
||||||
|
const size_t n_outputs = tx.vout.size();
|
||||||
|
if (n_outputs <= 2)
|
||||||
|
return blob_size;
|
||||||
|
if (rct::is_rct_old_bulletproof(rv.type))
|
||||||
|
return blob_size;
|
||||||
|
const uint64_t bp_base = 368;
|
||||||
const size_t n_padded_outputs = rct::n_bulletproof_max_amounts(rv.p.bulletproofs);
|
const size_t n_padded_outputs = rct::n_bulletproof_max_amounts(rv.p.bulletproofs);
|
||||||
uint64_t bp_clawback = get_transaction_weight_clawback(tx, n_padded_outputs);
|
uint64_t bp_clawback = get_transaction_weight_clawback(tx, n_padded_outputs);
|
||||||
CHECK_AND_ASSERT_THROW_MES_L1(bp_clawback <= std::numeric_limits<uint64_t>::max() - blob_size, "Weight overflow");
|
CHECK_AND_ASSERT_THROW_MES_L1(bp_clawback <= std::numeric_limits<uint64_t>::max() - blob_size, "Weight overflow");
|
||||||
|
|
|
@ -833,7 +833,7 @@ namespace cryptonote
|
||||||
if (tx.version >= 2)
|
if (tx.version >= 2)
|
||||||
{
|
{
|
||||||
rct::rctSig &rv = tx.rct_signatures;
|
rct::rctSig &rv = tx.rct_signatures;
|
||||||
if (rv.type != rct::RCTTypeBulletproof){
|
if (!rct::is_rct_new_bulletproof(rv.type)){
|
||||||
if (rv.outPk.size() != tx.vout.size())
|
if (rv.outPk.size() != tx.vout.size())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Bad outPk size in tx " << tx_hash << ", rejected");
|
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Bad outPk size in tx " << tx_hash << ", rejected");
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ namespace rct {
|
||||||
tools::threadpool::waiter waiter;
|
tools::threadpool::waiter waiter;
|
||||||
std::deque<bool> results(bulletproof ? rv.p.bulletproofs.size() : rv.outPk.size(), false);
|
std::deque<bool> results(bulletproof ? rv.p.bulletproofs.size() : rv.outPk.size(), false);
|
||||||
DP("range proofs verified?");
|
DP("range proofs verified?");
|
||||||
if (bulletproof && rv.type == RCTTypeBulletproof)
|
if (rct::is_rct_new_bulletproof(rv.type))
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < rv.p.bulletproofs.size(); i++)
|
for (size_t i = 0; i < rv.p.bulletproofs.size(); i++)
|
||||||
tpool.submit(&waiter, [&, i] { results[i] = verBulletproof(rv.p.bulletproofs[i]); });
|
tpool.submit(&waiter, [&, i] { results[i] = verBulletproof(rv.p.bulletproofs[i]); });
|
||||||
|
@ -1237,7 +1237,7 @@ namespace rct {
|
||||||
for (const rctSig *rvp: rvv)
|
for (const rctSig *rvp: rvv)
|
||||||
{
|
{
|
||||||
const rctSig &rv = *rvp;
|
const rctSig &rv = *rvp;
|
||||||
if (rv.type != RCTTypeBulletproof){
|
if (!rct::is_rct_new_bulletproof(rv.type)){
|
||||||
if (!proofs.empty() && !verBulletproof_old(proofs))
|
if (!proofs.empty() && !verBulletproof_old(proofs))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1("Aggregate range proof verified failed");
|
LOG_PRINT_L1("Aggregate range proof verified failed");
|
||||||
|
|
|
@ -228,6 +228,11 @@ namespace rct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_rct_new_bulletproof(int type)
|
||||||
|
{
|
||||||
|
return is_rct_bulletproof(type) && !is_rct_old_bulletproof(type);
|
||||||
|
}
|
||||||
|
|
||||||
bool is_rct_borromean(int type)
|
bool is_rct_borromean(int type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|
|
@ -575,6 +575,7 @@ namespace rct {
|
||||||
bool is_rct_simple(int type);
|
bool is_rct_simple(int type);
|
||||||
bool is_rct_bulletproof(int type);
|
bool is_rct_bulletproof(int type);
|
||||||
bool is_rct_old_bulletproof(int type);
|
bool is_rct_old_bulletproof(int type);
|
||||||
|
bool is_rct_new_bulletproof(int type);
|
||||||
bool is_rct_borromean(int type);
|
bool is_rct_borromean(int type);
|
||||||
|
|
||||||
static inline const rct::key &pk2rct(const crypto::public_key &pk) { return (const rct::key&)pk; }
|
static inline const rct::key &pk2rct(const crypto::public_key &pk) { return (const rct::key&)pk; }
|
||||||
|
|
Loading…
Reference in a new issue