Tie to new code.

This commit is contained in:
JoelKatz
2012-04-23 16:01:35 -07:00
parent 39fbc0fb62
commit f4639058f0

View File

@@ -762,6 +762,12 @@ void Wallet::syncToLedger(bool force, Ledger* ledger)
if(mLedger<ledger->getLedgerSeq()) mLedger=ledger->getLedgerSeq();
}
#if 0
// We can't replicate the transaction logic in the wallet
// The right way is to apply the transactions to the ledger
// And then sync all affected accounts to the ledger
void Wallet::applyTransaction(Transaction::pointer txn)
{
TransStatus st=txn->getStatus();
@@ -830,6 +836,8 @@ void Wallet::applyTransaction(Transaction::pointer txn)
}
}
#endif
void Wallet::addLocalTransactions(Json::Value& ret)
{
boost::recursive_mutex::scoped_lock sl(mLock);
@@ -851,11 +859,11 @@ bool Wallet::getTxJson(const uint256& txn, Json::Value& ret)
bool Wallet::getTxsJson(const NewcoinAddress& account, Json::Value& ret)
{
boost::recursive_mutex::scoped_lock sl(mLock);
for(std::map<uint256, LocalTransaction::pointer>::iterator it=mTransactions.begin();
it!=mTransactions.end(); ++it)
for(std::map<uint256, LocalTransaction::pointer>::iterator it = mTransactions.begin(),
end = mTransactions.end(); it != end; ++it)
{
Transaction::pointer txn = it->second->getTransaction();
if(txn && ((account==txn->getFromAccount())||(account==txn->getToAccount())) )
if(txn && (account == txn->getFromAccount())) // FIXME: Need a way to get all accounts a txn affects
ret[it->first.GetHex()] = it->second->getJson();
}