diff --git a/src/avalanche/peermanager.h b/src/avalanche/peermanager.h --- a/src/avalanche/peermanager.h +++ b/src/avalanche/peermanager.h @@ -130,7 +130,7 @@ PeerId nextPeerId = 0; PeerSet peers; - std::unordered_map utxos; + std::unordered_map utxos; using NodeSet = boost::multi_index_container< Node, diff --git a/src/avalanche/peermanager.cpp b/src/avalanche/peermanager.cpp --- a/src/avalanche/peermanager.cpp +++ b/src/avalanche/peermanager.cpp @@ -298,23 +298,23 @@ const PeerId peerid = nextPeerId++; // Attach UTXOs to this proof. - std::unordered_set conflicting_peerids; + std::unordered_set conflicting_proofs; for (const auto &s : proof->getStakes()) { - auto p = utxos.emplace(s.getStake().getUTXO(), peerid); + auto p = utxos.emplace(s.getStake().getUTXO(), proof); if (!p.second) { // We have a collision with an existing proof. - conflicting_peerids.insert(p.first->second); + conflicting_proofs.insert(p.first->second); } } // For now, if there is a conflict, just cleanup the mess. - if (conflicting_peerids.size() > 0) { + if (conflicting_proofs.size() > 0) { for (const auto &s : proof->getStakes()) { auto it = utxos.find(s.getStake().getUTXO()); assert(it != utxos.end()); // We need to delete that one. - if (it->second == peerid) { + if (it->second->getId() == proofid) { utxos.erase(it); } } @@ -471,7 +471,7 @@ if (it == utxos.end()) { return false; } - if (it->second != p.peerid) { + if (it->second->getId() != p.getProofId()) { return false; } @@ -517,7 +517,7 @@ } // Check there is no dangling utxo - for (const auto &[outpoint, peerid] : utxos) { + for (const auto &[outpoint, proof] : utxos) { if (!peersUtxos.count(outpoint)) { return false; }