mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 15:21:30 +02:00
fix occasional RangeError caused by merging when outputs confirmed
This commit is contained in:
@@ -404,20 +404,15 @@ namespace monero {
|
||||
if (this != self.get()) throw std::runtime_error("this != self");
|
||||
if (self == other) return;
|
||||
|
||||
// merge blocks if they're different which comes back to merging txs
|
||||
// merge blocks if they're different
|
||||
if (m_block != other->m_block) {
|
||||
if (m_block == boost::none) {
|
||||
m_block = std::make_shared<monero_block>();
|
||||
m_block.get()->m_txs.push_back(self);
|
||||
m_block.get()->m_height = other->get_height();
|
||||
m_block = other->m_block;
|
||||
std::replace(m_block.get()->m_txs.begin(), m_block.get()->m_txs.end(), other, self); // update block to point to this tx
|
||||
} else if (other->m_block == boost::none) {
|
||||
m_block.get()->merge(m_block.get(), other->m_block.get()); // comes back to merging txs
|
||||
return;
|
||||
}
|
||||
if (other->m_block == boost::none) {
|
||||
other->m_block = std::make_shared<monero_block>();
|
||||
other->m_block.get()->m_txs.push_back(other);
|
||||
other->m_block.get()->m_height = self->get_height();
|
||||
}
|
||||
m_block.get()->merge(m_block.get(), other->m_block.get());
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise merge tx fields
|
||||
|
||||
Reference in New Issue
Block a user