SerializedTransaction::getAffectdAccounts

So we can know what transactions affect what accounts.
This commit is contained in:
JoelKatz
2012-04-24 04:34:46 -07:00
parent 0392d8ddcb
commit 9e2d13ff3e
2 changed files with 17 additions and 0 deletions

View File

@@ -75,6 +75,21 @@ std::string SerializedTransaction::getText() const
return ret;
}
std::vector<NewcoinAddress> SerializedTransaction::getAffectedAccounts() const
{
std::vector<NewcoinAddress> accounts;
accounts.push_back(mSourceAccount);
for(boost::ptr_vector<SerializedType>::const_iterator it = mInnerTxn.peekData().begin(),
end = mInnerTxn.peekData().end(); it != end ; ++it)
{
const STAccount* sa = dynamic_cast<const STAccount*>(&*it);
if (sa != NULL) // FIXME: Should we check for duplicates?
accounts.push_back(sa->getValueNCA());
}
return accounts;
}
int SerializedTransaction::getTransaction(Serializer& s, bool include_length) const
{
int l = getLength();

View File

@@ -103,6 +103,8 @@ public:
void makeITFieldPresent(SOE_Field field);
void makeITFieldAbsent(SOE_Field field);
std::vector<NewcoinAddress> getAffectedAccounts() const;
// whole transaction functions
int getTransaction(Serializer& s, bool include_length) const;
uint256 getTransactionID() const;