diff --git a/src/wallet/monero_wallet_full.cpp b/src/wallet/monero_wallet_full.cpp index b1d89b1..3a65c0a 100644 --- a/src/wallet/monero_wallet_full.cpp +++ b/src/wallet/monero_wallet_full.cpp @@ -449,6 +449,7 @@ namespace monero { * Returns true iff wallet vout1 is ordered before vout2 by ascending account and subaddress indices then index. */ bool vout_before(const std::shared_ptr& o1, const std::shared_ptr& o2) { + if (o1 == o2) return false; // ignore equal references std::shared_ptr ow1 = std::static_pointer_cast(o1); std::shared_ptr ow2 = std::static_pointer_cast(o2); @@ -461,7 +462,7 @@ namespace monero { if (ow1->m_subaddress_index.get() < ow2->m_subaddress_index.get()) return true; if (ow1->m_subaddress_index.get() == ow2->m_subaddress_index.get()) { if (ow1->m_index.get() < ow2->m_index.get()) return true; - if (ow1->m_index.get() == ow2->m_index.get() && ow1->m_key_image != boost::none) return ow1->m_key_image.get()->m_hex.get().compare(ow2->m_key_image.get()->m_hex.get()) < 0; + if (ow1->m_index.get() == ow2->m_index.get()) throw std::runtime_error("Should never sort outputs with duplicate indices"); } } return false;