mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
79 lines
1.7 KiB
C++
79 lines
1.7 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
Copyright (c) 2011-2013, OpenCoin, Inc.
|
|
*/
|
|
//==============================================================================
|
|
|
|
bool CanonicalTXSet::Key::operator< (Key const& rhs) const
|
|
{
|
|
if (mAccount < rhs.mAccount) return true;
|
|
|
|
if (mAccount > rhs.mAccount) return false;
|
|
|
|
if (mSeq < rhs.mSeq) return true;
|
|
|
|
if (mSeq > rhs.mSeq) return false;
|
|
|
|
return mTXid < rhs.mTXid;
|
|
}
|
|
|
|
bool CanonicalTXSet::Key::operator> (Key const& rhs) const
|
|
{
|
|
if (mAccount > rhs.mAccount) return true;
|
|
|
|
if (mAccount < rhs.mAccount) return false;
|
|
|
|
if (mSeq > rhs.mSeq) return true;
|
|
|
|
if (mSeq < rhs.mSeq) return false;
|
|
|
|
return mTXid > rhs.mTXid;
|
|
}
|
|
|
|
bool CanonicalTXSet::Key::operator<= (Key const& rhs) const
|
|
{
|
|
if (mAccount < rhs.mAccount) return true;
|
|
|
|
if (mAccount > rhs.mAccount) return false;
|
|
|
|
if (mSeq < rhs.mSeq) return true;
|
|
|
|
if (mSeq > rhs.mSeq) return false;
|
|
|
|
return mTXid <= rhs.mTXid;
|
|
}
|
|
|
|
bool CanonicalTXSet::Key::operator>= (Key const& rhs)const
|
|
{
|
|
if (mAccount > rhs.mAccount) return true;
|
|
|
|
if (mAccount < rhs.mAccount) return false;
|
|
|
|
if (mSeq > rhs.mSeq) return true;
|
|
|
|
if (mSeq < rhs.mSeq) return false;
|
|
|
|
return mTXid >= rhs.mTXid;
|
|
}
|
|
|
|
void CanonicalTXSet::push_back (SerializedTransaction::ref txn)
|
|
{
|
|
uint256 effectiveAccount = mSetHash;
|
|
|
|
effectiveAccount ^= txn->getSourceAccount ().getAccountID ().to256 ();
|
|
|
|
mMap.insert (std::make_pair (
|
|
Key (effectiveAccount, txn->getSequence (), txn->getTransactionID ()),
|
|
txn));
|
|
}
|
|
|
|
CanonicalTXSet::iterator CanonicalTXSet::erase (iterator const& it)
|
|
{
|
|
iterator tmp = it;
|
|
++tmp;
|
|
mMap.erase (it);
|
|
return tmp;
|
|
}
|
|
|
|
|