mirror of
https://github.com/monero-project/monero.git
synced 2024-12-27 20:19:24 -05:00
scan_tx: fix custom comparator for == case; fixes #8951
Co-authored-by: woodser <woodser@protonmail.com>
This commit is contained in:
parent
00fd416a99
commit
f7fb5c7faa
@ -1715,21 +1715,26 @@ void wallet2::sort_scan_tx_entries(std::vector<process_tx_entry_t> &unsorted_tx_
|
|||||||
else // l.tx_entry.block_height == r.tx_entry.block_height
|
else // l.tx_entry.block_height == r.tx_entry.block_height
|
||||||
{
|
{
|
||||||
// coinbase tx is the first tx in a block
|
// coinbase tx is the first tx in a block
|
||||||
|
if (cryptonote::is_coinbase(r.tx))
|
||||||
|
return false;
|
||||||
if (cryptonote::is_coinbase(l.tx))
|
if (cryptonote::is_coinbase(l.tx))
|
||||||
return true;
|
return true;
|
||||||
if (cryptonote::is_coinbase(r.tx))
|
|
||||||
|
// in case std::sort is comparing elem to itself
|
||||||
|
if (l.tx_hash == r.tx_hash)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// see which tx hash comes first in the block
|
// see which tx hash comes first in the block
|
||||||
THROW_WALLET_EXCEPTION_IF(parsed_blocks.find(l.tx_entry.block_height) == parsed_blocks.end(),
|
THROW_WALLET_EXCEPTION_IF(parsed_blocks.find(l.tx_entry.block_height) == parsed_blocks.end(),
|
||||||
error::wallet_internal_error, "Expected block not returned by daemon");
|
error::wallet_internal_error, std::string("Expected block not returned by daemon, ") +
|
||||||
|
"left tx: " + string_tools::pod_to_hex(l.tx_hash) + ", right tx: " + string_tools::pod_to_hex(r.tx_hash));
|
||||||
const auto &blk = parsed_blocks[l.tx_entry.block_height];
|
const auto &blk = parsed_blocks[l.tx_entry.block_height];
|
||||||
for (const auto &tx_hash : blk.tx_hashes)
|
for (const auto &tx_hash : blk.tx_hashes)
|
||||||
{
|
{
|
||||||
if (tx_hash == l.tx_hash)
|
|
||||||
return true;
|
|
||||||
if (tx_hash == r.tx_hash)
|
if (tx_hash == r.tx_hash)
|
||||||
return false;
|
return false;
|
||||||
|
if (tx_hash == l.tx_hash)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
THROW_WALLET_EXCEPTION(error::wallet_internal_error, "Tx hashes not found in block");
|
THROW_WALLET_EXCEPTION(error::wallet_internal_error, "Tx hashes not found in block");
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user