mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Moved cpp code to src/cpp and js code to src/js.
This commit is contained in:
55
src/cpp/ripple/CanonicalTXSet.cpp
Normal file
55
src/cpp/ripple/CanonicalTXSet.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user