mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 11:35:53 +00:00
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
|
|
#include "CanonicalTXSet.h"
|
|
|
|
bool CanonicalTXKey::operator<(const CanonicalTXKey& key) const
|
|
{
|
|
if (mAccount < key.mAccount) return true;
|
|
if (mAccount > key.mAccount) return false;
|
|
if (mSeq < key.mSeq) return true;
|
|
if (mSeq > key.mSeq) return false;
|
|
return mTXid < key.mTXid;
|
|
}
|
|
|
|
bool CanonicalTXKey::operator>(const CanonicalTXKey& key) const
|
|
{
|
|
if (mAccount > key.mAccount) return true;
|
|
if (mAccount < key.mAccount) return false;
|
|
if (mSeq > key.mSeq) return true;
|
|
if (mSeq < key.mSeq) return false;
|
|
return mTXid > key.mTXid;
|
|
}
|
|
|
|
bool CanonicalTXKey::operator<=(const CanonicalTXKey& key) const
|
|
{
|
|
if (mAccount < key.mAccount) return true;
|
|
if (mAccount > key.mAccount) return false;
|
|
if (mSeq < key.mSeq) return true;
|
|
if (mSeq > key.mSeq) return false;
|
|
return mTXid <= key.mTXid;
|
|
}
|
|
|
|
bool CanonicalTXKey::operator>=(const CanonicalTXKey& key)const
|
|
{
|
|
if (mAccount > key.mAccount) return true;
|
|
if (mAccount < key.mAccount) return false;
|
|
if (mSeq > key.mSeq) return true;
|
|
if (mSeq < key.mSeq) return false;
|
|
return mTXid >= key.mTXid;
|
|
}
|
|
|
|
void CanonicalTXSet::push_back(SerializedTransaction::ref txn)
|
|
{
|
|
uint256 effectiveAccount = mSetHash;
|
|
effectiveAccount ^= txn->getSourceAccount().getAccountID().to256();
|
|
mMap.insert(std::make_pair(CanonicalTXKey(effectiveAccount, txn->getSequence(), txn->getTransactionID()), txn));
|
|
}
|
|
|
|
CanonicalTXSet::iterator CanonicalTXSet::erase(const iterator& it)
|
|
{
|
|
iterator tmp = it;
|
|
++tmp;
|
|
mMap.erase(it);
|
|
return tmp;
|
|
}
|
|
|
|
|