mirror of
https://github.com/monero-project/monero.git
synced 2024-12-14 04:16:32 +02:00
Merge pull request #3609
08343aba
tx_pool: fix loading with colliding key images (moneromooo-monero)
This commit is contained in:
commit
a95461e76d
@ -1268,7 +1268,15 @@ namespace cryptonote
|
|||||||
m_spent_key_images.clear();
|
m_spent_key_images.clear();
|
||||||
m_txpool_size = 0;
|
m_txpool_size = 0;
|
||||||
std::vector<crypto::hash> remove;
|
std::vector<crypto::hash> remove;
|
||||||
bool r = m_blockchain.for_all_txpool_txes([this, &remove](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata *bd) {
|
|
||||||
|
// first add the not kept by block, then the kept by block,
|
||||||
|
// to avoid rejection due to key image collision
|
||||||
|
for (int pass = 0; pass < 2; ++pass)
|
||||||
|
{
|
||||||
|
const bool kept = pass == 1;
|
||||||
|
bool r = m_blockchain.for_all_txpool_txes([this, &remove, kept](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata *bd) {
|
||||||
|
if (!!kept != !!meta.kept_by_block)
|
||||||
|
return true;
|
||||||
cryptonote::transaction tx;
|
cryptonote::transaction tx;
|
||||||
if (!parse_and_validate_tx_from_blob(*bd, tx))
|
if (!parse_and_validate_tx_from_blob(*bd, tx))
|
||||||
{
|
{
|
||||||
@ -1286,6 +1294,7 @@ namespace cryptonote
|
|||||||
}, true);
|
}, true);
|
||||||
if (!r)
|
if (!r)
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (!remove.empty())
|
if (!remove.empty())
|
||||||
{
|
{
|
||||||
LockedTXN lock(m_blockchain);
|
LockedTXN lock(m_blockchain);
|
||||||
|
Loading…
Reference in New Issue
Block a user