mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
More pieces.
This commit is contained in:
@@ -101,6 +101,12 @@ Json::Value TMNEUnfunded::getJson(int) const
|
||||
return Json::Value("delete_unfunded");
|
||||
}
|
||||
|
||||
void TMNEUnfunded::setBalances(const STAmount& first, const STAmount& second)
|
||||
{
|
||||
firstAmount = first;
|
||||
secondAmount = second;
|
||||
}
|
||||
|
||||
int TMNEUnfunded::compare(const TransactionMetaNodeEntry&) const
|
||||
{
|
||||
assert(false); // Can't be two deletes for same node
|
||||
@@ -137,6 +143,20 @@ void TransactionMetaNode::addRaw(Serializer& s)
|
||||
s.add8(TransactionMetaNodeEntry::TMNEndOfMetadata);
|
||||
}
|
||||
|
||||
TransactionMetaNodeEntry* TransactionMetaNode::findEntry(int nodeType)
|
||||
{
|
||||
for (boost::ptr_vector<TransactionMetaNodeEntry>::iterator it = mEntries.begin(), end = mEntries.end();
|
||||
it != end; ++it)
|
||||
if (it->getType() == nodeType)
|
||||
return &*it;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TransactionMetaNode::addNode(TransactionMetaNodeEntry* node)
|
||||
{
|
||||
mEntries.push_back(node);
|
||||
}
|
||||
|
||||
void TransactionMetaNode::thread(const uint256& prevTx, uint32 prevLgr)
|
||||
{
|
||||
assert((mPreviousLedger == 0) || (mPreviousLedger == prevLgr));
|
||||
@@ -241,8 +261,14 @@ void TransactionMetaSet::threadNode(const uint256& node, const uint256& prevTx,
|
||||
modifyNode(node).thread(prevTx, prevLgr);
|
||||
}
|
||||
|
||||
bool TransactionMetaSet::deleteUnfunded(const uint256& node, const STAmount& firstBalance, const STAmount &secondBalance)
|
||||
bool TransactionMetaSet::deleteUnfunded(const uint256& nodeID,
|
||||
const STAmount& firstBalance, const STAmount &secondBalance)
|
||||
{
|
||||
// WRITEME
|
||||
return true;
|
||||
TransactionMetaNode& node = modifyNode(nodeID);
|
||||
TMNEUnfunded* entry = dynamic_cast<TMNEUnfunded*>(node.findEntry(TransactionMetaNodeEntry::TMNDeleteUnfunded));
|
||||
if (entry)
|
||||
entry->setBalances(firstBalance, secondBalance);
|
||||
else
|
||||
node.addNode(new TMNEUnfunded(firstBalance, secondBalance));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
TMNEUnfunded() : TransactionMetaNodeEntry(TMNDeleteUnfunded) { ; }
|
||||
TMNEUnfunded(const STAmount& f, const STAmount& s) :
|
||||
TransactionMetaNodeEntry(TMNDeleteUnfunded), firstAmount(f), secondAmount(s) { ; }
|
||||
void setBalances(const STAmount& firstBalance, const STAmount& secondBalance);
|
||||
virtual void addRaw(Serializer&) const;
|
||||
virtual Json::Value getJson(int) const;
|
||||
virtual int compare(const TransactionMetaNodeEntry&) const;
|
||||
@@ -112,6 +113,9 @@ public:
|
||||
uint32 getPreviousLedger() const { return mPreviousLedger; }
|
||||
const boost::ptr_vector<TransactionMetaNodeEntry>& peekEntries() const { return mEntries; }
|
||||
|
||||
TransactionMetaNodeEntry* findEntry(int nodeType);
|
||||
void addNode(TransactionMetaNodeEntry*);
|
||||
|
||||
bool operator<(const TransactionMetaNode& n) const { return mNode < n.mNode; }
|
||||
bool operator<=(const TransactionMetaNode& n) const { return mNode <= n.mNode; }
|
||||
bool operator>(const TransactionMetaNode& n) const { return mNode > n.mNode; }
|
||||
|
||||
Reference in New Issue
Block a user