Functions for owned nodes (nodes that have a single other node that owns

them) and dual-owner nodes (nodes that have two other nodes that own them).
Owned nodes would be things like nicknames. Dual-owner nodes would be things
like ripple balances.
This commit is contained in:
JoelKatz
2012-08-24 09:32:58 -07:00
parent e6511732c7
commit db873ff9f5
2 changed files with 30 additions and 0 deletions

View File

@@ -109,6 +109,31 @@ bool SerializedLedgerEntry::thread(const uint256& txID, uint32 ledgerSeq, uint25
return true; return true;
} }
bool SerializedLedgerEntry::hasOneOwner()
{
return (mType != ltACCOUNT_ROOT) && (getIFieldIndex(sfAccount) != -1);
}
bool SerializedLedgerEntry::hasTwoOwners()
{
return mType == ltRIPPLE_STATE;
}
NewcoinAddress SerializedLedgerEntry::getOwner()
{
return getIValueFieldAccount(sfAccount);
}
NewcoinAddress SerializedLedgerEntry::getFirstOwner()
{
return getIValueFieldAccount(sfLowID);
}
NewcoinAddress SerializedLedgerEntry::getSecondOwner()
{
return getIValueFieldAccount(sfHighID);
}
std::vector<uint256> SerializedLedgerEntry::getOwners() std::vector<uint256> SerializedLedgerEntry::getOwners()
{ {
std::vector<uint256> owners; std::vector<uint256> owners;

View File

@@ -65,6 +65,11 @@ public:
bool isThreadedType(); // is this a ledger entry that can be threaded bool isThreadedType(); // is this a ledger entry that can be threaded
bool isThreaded(); // is this ledger entry actually threaded bool isThreaded(); // is this ledger entry actually threaded
bool hasOneOwner(); // This node has one other node that owns it (like nickname)
bool hasTwoOwners(); // This node has two nodes that own it (like ripple balance)
NewcoinAddress getOwner();
NewcoinAddress getFirstOwner();
NewcoinAddress getSecondOwner();
uint256 getThreadedTransaction(); uint256 getThreadedTransaction();
uint32 getThreadedLedger(); uint32 getThreadedLedger();
bool thread(const uint256& txID, uint32 ledgerSeq, uint256& prevTxID, uint32& prevLedgerID); bool thread(const uint256& txID, uint32 ledgerSeq, uint256& prevTxID, uint32& prevLedgerID);