Merge pull request #4921
ac665418
ringct: fix dummy bulletproofs on ledger in fake mode (moneromooo-monero)
This commit is contained in:
commit
e9aa886d9e
|
@ -46,13 +46,34 @@ using namespace std;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
rct::Bulletproof make_dummy_bulletproof(size_t n_outs)
|
rct::Bulletproof make_dummy_bulletproof(const std::vector<uint64_t> &outamounts, rct::keyV &C, rct::keyV &masks)
|
||||||
{
|
{
|
||||||
|
const size_t n_outs = outamounts.size();
|
||||||
const rct::key I = rct::identity();
|
const rct::key I = rct::identity();
|
||||||
size_t nrl = 0;
|
size_t nrl = 0;
|
||||||
while ((1u << nrl) < n_outs)
|
while ((1u << nrl) < n_outs)
|
||||||
++nrl;
|
++nrl;
|
||||||
nrl += 6;
|
nrl += 6;
|
||||||
|
|
||||||
|
C.resize(n_outs);
|
||||||
|
masks.resize(n_outs);
|
||||||
|
for (size_t i = 0; i < n_outs; ++i)
|
||||||
|
{
|
||||||
|
masks[i] = I;
|
||||||
|
rct::key sv8, sv;
|
||||||
|
sv = rct::zero();
|
||||||
|
sv.bytes[0] = outamounts[i] & 255;
|
||||||
|
sv.bytes[1] = (outamounts[i] >> 8) & 255;
|
||||||
|
sv.bytes[2] = (outamounts[i] >> 16) & 255;
|
||||||
|
sv.bytes[3] = (outamounts[i] >> 24) & 255;
|
||||||
|
sv.bytes[4] = (outamounts[i] >> 32) & 255;
|
||||||
|
sv.bytes[5] = (outamounts[i] >> 40) & 255;
|
||||||
|
sv.bytes[6] = (outamounts[i] >> 48) & 255;
|
||||||
|
sv.bytes[7] = (outamounts[i] >> 56) & 255;
|
||||||
|
sc_mul(sv8.bytes, sv.bytes, rct::INV_EIGHT.bytes);
|
||||||
|
rct::addKeys2(C[i], rct::INV_EIGHT, sv8, rct::H);
|
||||||
|
}
|
||||||
|
|
||||||
return rct::Bulletproof{rct::keyV(n_outs, I), I, I, I, I, I, I, rct::keyV(nrl, I), rct::keyV(nrl, I), I, I, I};
|
return rct::Bulletproof{rct::keyV(n_outs, I), I, I, I, I, I, I, rct::keyV(nrl, I), rct::keyV(nrl, I), I, I, I};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -769,9 +790,7 @@ namespace rct {
|
||||||
if (hwdev.get_mode() == hw::device::TRANSACTION_CREATE_FAKE)
|
if (hwdev.get_mode() == hw::device::TRANSACTION_CREATE_FAKE)
|
||||||
{
|
{
|
||||||
// use a fake bulletproof for speed
|
// use a fake bulletproof for speed
|
||||||
rv.p.bulletproofs.push_back(make_dummy_bulletproof(outamounts.size()));
|
rv.p.bulletproofs.push_back(make_dummy_bulletproof(outamounts, C, masks));
|
||||||
C = rct::keyV(outamounts.size(), I);
|
|
||||||
masks = rct::keyV(outamounts.size(), I);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -799,9 +818,7 @@ namespace rct {
|
||||||
if (hwdev.get_mode() == hw::device::TRANSACTION_CREATE_FAKE)
|
if (hwdev.get_mode() == hw::device::TRANSACTION_CREATE_FAKE)
|
||||||
{
|
{
|
||||||
// use a fake bulletproof for speed
|
// use a fake bulletproof for speed
|
||||||
rv.p.bulletproofs.push_back(make_dummy_bulletproof(batch_amounts.size()));
|
rv.p.bulletproofs.push_back(make_dummy_bulletproof(batch_amounts, C, masks));
|
||||||
C = rct::keyV(batch_amounts.size(), I);
|
|
||||||
masks = rct::keyV(batch_amounts.size(), I);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue