|
|
|
@ -210,78 +210,6 @@ MicroCore::find_output_in_tx(const transaction& tx,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns tx hash in a given block which
|
|
|
|
|
* contains given output's public key
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
MicroCore::get_tx_hash_from_output_pubkey(const public_key& output_pubkey,
|
|
|
|
|
const uint64_t& block_height,
|
|
|
|
|
crypto::hash& tx_hash,
|
|
|
|
|
cryptonote::transaction& tx_found)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
tx_hash = null_hash;
|
|
|
|
|
|
|
|
|
|
// get block of given height
|
|
|
|
|
block blk;
|
|
|
|
|
if (!get_block_by_height(block_height, blk))
|
|
|
|
|
{
|
|
|
|
|
cerr << "Cant get block of height: " << block_height << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// get all transactions in the block found
|
|
|
|
|
// initialize the first list with transaction for solving
|
|
|
|
|
// the block i.e. coinbase.
|
|
|
|
|
list<transaction> txs {blk.miner_tx};
|
|
|
|
|
list<crypto::hash> missed_txs;
|
|
|
|
|
|
|
|
|
|
if (!m_blockchain_storage.get_transactions(blk.tx_hashes, txs, missed_txs))
|
|
|
|
|
{
|
|
|
|
|
cerr << "Cant find transcations in block: " << block_height << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!missed_txs.empty())
|
|
|
|
|
{
|
|
|
|
|
cerr << "Transactions not found in blk: " << block_height << endl;
|
|
|
|
|
|
|
|
|
|
for (const crypto::hash& h : missed_txs)
|
|
|
|
|
{
|
|
|
|
|
cerr << " - tx hash: " << h << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// search outputs in each transactions
|
|
|
|
|
// until output with pubkey of interest is found
|
|
|
|
|
for (const transaction& tx : txs)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
tx_out found_out;
|
|
|
|
|
|
|
|
|
|
// we dont need here output_index
|
|
|
|
|
size_t output_index;
|
|
|
|
|
|
|
|
|
|
if (find_output_in_tx(tx, output_pubkey, found_out, output_index))
|
|
|
|
|
{
|
|
|
|
|
// we found the desired public key
|
|
|
|
|
tx_hash = get_transaction_hash(tx);
|
|
|
|
|
tx_found = tx;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
|
MicroCore::get_blk_timestamp(uint64_t blk_height)
|
|
|
|
|
{
|
|
|
|
|