mirror of https://github.com/oxen-io/oxen-core.git
Merge a52a5fe282
into 6b662f1f5f
This commit is contained in:
commit
6e3b009da5
|
@ -34,6 +34,7 @@ namespace wallet
|
|||
|
||||
// A derivation is simply the private view key multiplied by the tx public key
|
||||
// do this for every tx public key in the transaction
|
||||
//TODO SEAN THIS IS A BOTTLENECK
|
||||
auto derivations = wallet_keys->generate_key_derivations(tx_public_keys);
|
||||
bool coinbase_transaction = cryptonote::is_coinbase(tx.tx);
|
||||
// Output belongs to public key derived as follows:
|
||||
|
@ -55,6 +56,7 @@ namespace wallet
|
|||
std::optional<cryptonote::subaddress_index> sub_index{std::nullopt};
|
||||
for (derivation_index = 0; derivation_index < derivations.size(); derivation_index++)
|
||||
{
|
||||
//TODO SEAN THIS IS A BOTTLENECK
|
||||
sub_index = wallet_keys->output_and_derivation_ours(
|
||||
derivations[derivation_index], output_target->key, output_index);
|
||||
if (sub_index)
|
||||
|
|
|
@ -144,7 +144,6 @@ namespace wallet
|
|||
Wallet::add_block(const Block& block)
|
||||
{
|
||||
oxen::log::trace(logcat, "add block called with block height {}", block.height);
|
||||
auto db_tx = db->db_transaction();
|
||||
|
||||
db->store_block(block);
|
||||
|
||||
|
@ -164,9 +163,7 @@ namespace wallet
|
|||
}
|
||||
}
|
||||
|
||||
db_tx.commit();
|
||||
|
||||
last_scan_height++;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -185,11 +182,24 @@ namespace wallet
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector<std::thread> threads;
|
||||
|
||||
auto db_tx = db->db_transaction();
|
||||
for (const auto& block : blocks)
|
||||
{
|
||||
if (block.height == last_scan_height + 1)
|
||||
add_block(block);
|
||||
{
|
||||
threads.emplace_back([&]() {
|
||||
add_block(block);
|
||||
});
|
||||
last_scan_height++;
|
||||
}
|
||||
}
|
||||
// Wait for all threads to finish
|
||||
for (auto& t : threads) {
|
||||
t.join();
|
||||
}
|
||||
db_tx.commit();
|
||||
daemon_comms->register_wallet(*this, last_scan_height + 1 /*next needed block*/, false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue