This is not optimal, but this should at least make the logic for when we

publish transactions to which accounts sensible.
This commit is contained in:
JoelKatz
2013-01-17 11:33:42 -08:00
parent 65a1d00751
commit 809868c6fc
2 changed files with 4 additions and 35 deletions

View File

@@ -1329,11 +1329,10 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTr
if (!mSubAccount.empty() || (!mSubRTAccount.empty()) )
{
typedef std::map<RippleAddress, bool>::value_type AccountPair;
BOOST_FOREACH(const AccountPair& affectedAccount, getAffectedAccounts(stTxn))
std::vector<RippleAddress> accounts = meta ? meta->getAffectedAccounts() : stTxn.getMentionedAccounts();
BOOST_FOREACH(const RippleAddress& affectedAccount, accounts)
{
subInfoMapIterator simiIt = mSubRTAccount.find(affectedAccount.first.getAccountID());
subInfoMapIterator simiIt = mSubRTAccount.find(affectedAccount.getAccountID());
if (simiIt != mSubRTAccount.end())
{
@@ -1345,7 +1344,7 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTr
if (bAccepted)
{
simiIt = mSubAccount.find(affectedAccount.first.getAccountID());
simiIt = mSubAccount.find(affectedAccount.getAccountID());
if (simiIt != mSubAccount.end())
{
@@ -1372,35 +1371,6 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTr
}
}
// JED: I know this is sort of ugly. I'm going to rework this to get the affected accounts in a different way when we want finer granularity than just "account"
std::map<RippleAddress,bool> NetworkOPs::getAffectedAccounts(const SerializedTransaction& stTxn)
{
std::map<RippleAddress,bool> accounts;
BOOST_FOREACH(const SerializedType& it, stTxn.peekData())
{
const STAccount* sa = dynamic_cast<const STAccount*>(&it);
if (sa)
{
RippleAddress na = sa->getValueNCA();
accounts[na]=true;
}else
{
if( it.getFName() == sfLimitAmount )
{
const STAmount* amount = dynamic_cast<const STAmount*>(&it);
if(amount)
{
RippleAddress na;
na.setAccountID(amount->getIssuer());
accounts[na]=true;
}
}
}
}
return accounts;
}
//
// Monitoring
//

View File

@@ -122,7 +122,6 @@ protected:
void pubAcceptedTransaction(Ledger::ref lpCurrent, const SerializedTransaction& stTxn, TER terResult,TransactionMetaSet::pointer& meta);
void pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTransaction& stTxn, TER terResult,bool accepted,TransactionMetaSet::pointer& meta);
std::map<RippleAddress,bool> getAffectedAccounts(const SerializedTransaction& stTxn);
void pubServer();