Skip to content

Commit 6fcdc7d

Browse files
committed
Small touchups + fix test compile errors
1 parent fdaa1cb commit 6fcdc7d

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

src/blockchain_db/blockchain_db_utils.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ static uint64_t set_tx_outs_by_last_locked_block(const cryptonote::transaction &
6464

6565
for (std::size_t i = 0; i < tx.vout.size(); ++i)
6666
{
67-
const auto &out = tx.vout[i];
68-
69-
static_assert(CURRENT_TRANSACTION_VERSION == 2, "This section of code was written with 2 tx versions in mind. "
70-
"Revisit this section and update for the new tx version.");
71-
CHECK_AND_ASSERT_THROW_MES(tx.version == 1 || tx.version == 2, "encountered unexpected tx version");
72-
7367
TIME_MEASURE_NS_START(getting_commitment);
7468

7569
rct::ctkey ctKey = rct::getCtKey(tx, i);

tests/unit_tests/fake_pruned_blockchain.cpp

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
//local headers
3535
#include "common/container_helpers.h"
3636
#include "ringct/rctOps.h"
37+
#include "ringct/rctSigs.h"
3738
#include "tx_construction_helpers.h"
3839

3940
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -303,18 +304,14 @@ void fake_pruned_blockchain::add_block(cryptonote::block &&blk,
303304
parsed_block_with_unlocked_miner_tx.block.miner_tx;
304305
for (size_t local_output_index = 0; local_output_index < unlocked_miner_tx.vout.size(); ++local_output_index)
305306
{
306-
const cryptonote::tx_out &o = unlocked_miner_tx.vout.at(local_output_index);
307-
crypto::public_key output_pubkey;
308-
CHECK_AND_ASSERT_THROW_MES(cryptonote::get_output_public_key(o, output_pubkey),
309-
"cannot get output pubkey");
310-
const rct::key amount_commitment = rct::zeroCommitVartime(o.amount);
311-
const fcmp_pp::curve_trees::OutputPair output_pair{output_pubkey, amount_commitment};
307+
const rct::ctkey ctkey = rct::getCtKey(unlocked_miner_tx, local_output_index);
308+
const fcmp_pp::curve_trees::OutputPair output_pair{rct::rct2pk(ctkey.dest), ctkey.mask};
312309
if (!is_valid_output_pair_for_tree(output_pair))
313310
continue;
314311
const uint64_t global_output_index =
315312
parsed_block_with_unlocked_miner_tx.o_indices.indices.at(0).indices.at(local_output_index);
316313
new_spendable_outputs.push_back(fcmp_pp::curve_trees::OutputContext{
317-
global_output_index, output_pair
314+
global_output_index, false/*torsion_checked*/, output_pair
318315
});
319316
}
320317
}
@@ -326,19 +323,14 @@ void fake_pruned_blockchain::add_block(cryptonote::block &&blk,
326323
const cryptonote::transaction &unlocked_tx = parsed_block_with_unlocked_txs.txes.at(tx_index);
327324
for (size_t local_output_index = 0; local_output_index < unlocked_tx.vout.size(); ++local_output_index)
328325
{
329-
const cryptonote::tx_out &o = unlocked_tx.vout.at(local_output_index);
330-
crypto::public_key output_pubkey;
331-
CHECK_AND_ASSERT_THROW_MES(cryptonote::get_output_public_key(o, output_pubkey),
332-
"cannot get output pubkey");
333-
const rct::key amount_commitment = o.amount
334-
? rct::zeroCommitVartime(o.amount) : unlocked_tx.rct_signatures.outPk.at(local_output_index).mask;
335-
const fcmp_pp::curve_trees::OutputPair output_pair{output_pubkey, amount_commitment};
326+
const rct::ctkey ctkey = rct::getCtKey(unlocked_tx, local_output_index);
327+
const fcmp_pp::curve_trees::OutputPair output_pair{rct::rct2pk(ctkey.dest), ctkey.mask};
336328
if (!is_valid_output_pair_for_tree(output_pair))
337329
continue;
338330
const uint64_t global_output_index =
339331
parsed_block_with_unlocked_txs.o_indices.indices.at(tx_index + 1).indices.at(local_output_index);
340332
new_spendable_outputs.push_back(fcmp_pp::curve_trees::OutputContext{
341-
global_output_index, output_pair
333+
global_output_index, false/*torsion_checked*/, output_pair
342334
});
343335
}
344336
}

0 commit comments

Comments
 (0)