mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Comment out lots of obsolete LocalAccount stuff.
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "UniqueNodeList.h"
|
#include "UniqueNodeList.h"
|
||||||
#include "ConnectionPool.h"
|
#include "ConnectionPool.h"
|
||||||
#include "PubKeyCache.h"
|
|
||||||
#include "ScopedLock.h"
|
#include "ScopedLock.h"
|
||||||
#include "LedgerMaster.h"
|
#include "LedgerMaster.h"
|
||||||
#include "LedgerAcquire.h"
|
#include "LedgerAcquire.h"
|
||||||
@@ -38,7 +37,6 @@ class Application
|
|||||||
NetworkOPs mNetOps;
|
NetworkOPs mNetOps;
|
||||||
Wallet mWallet;
|
Wallet mWallet;
|
||||||
UniqueNodeList mUNL;
|
UniqueNodeList mUNL;
|
||||||
PubKeyCache mPKCache;
|
|
||||||
LedgerMaster mMasterLedger;
|
LedgerMaster mMasterLedger;
|
||||||
LedgerAcquireMaster mMasterLedgerAcquire;
|
LedgerAcquireMaster mMasterLedgerAcquire;
|
||||||
TransactionMaster mMasterTransaction;
|
TransactionMaster mMasterTransaction;
|
||||||
@@ -63,8 +61,6 @@ public:
|
|||||||
Wallet& getWallet() { return mWallet ; }
|
Wallet& getWallet() { return mWallet ; }
|
||||||
NetworkOPs& getOPs() { return mNetOps; }
|
NetworkOPs& getOPs() { return mNetOps; }
|
||||||
|
|
||||||
PubKeyCache& getPubKeyCache() { return mPKCache; }
|
|
||||||
|
|
||||||
boost::asio::io_service& getIOService() { return mIOService; }
|
boost::asio::io_service& getIOService() { return mIOService; }
|
||||||
|
|
||||||
LedgerMaster& getMasterLedger() { return mMasterLedger; }
|
LedgerMaster& getMasterLedger() { return mMasterLedger; }
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ bool LocalTransaction::makeTransaction()
|
|||||||
{
|
{
|
||||||
if(!!mTransaction) return true;
|
if(!!mTransaction) return true;
|
||||||
|
|
||||||
|
std::cerr << "LocalTransaction is obsolete." << std::endl;
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if 0
|
||||||
LocalAccount::pointer lac(theApp->getWallet().findAccountForTransaction(mAmount));
|
LocalAccount::pointer lac(theApp->getWallet().findAccountForTransaction(mAmount));
|
||||||
if(!lac)
|
if(!lac)
|
||||||
{
|
{
|
||||||
@@ -18,10 +22,6 @@ bool LocalTransaction::makeTransaction()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "LocalTransaction is obsolete." << std::endl;
|
|
||||||
return false;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
mTransaction=Transaction::pointer(new Transaction(lac, mDestAcctID, mAmount, mTag,
|
mTransaction=Transaction::pointer(new Transaction(lac, mDestAcctID, mAmount, mTag,
|
||||||
theApp->getOPs().getCurrentLedgerID()));
|
theApp->getOPs().getCurrentLedgerID()));
|
||||||
if(mTransaction->getStatus()!=NEW)
|
if(mTransaction->getStatus()!=NEW)
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ bool RPCServer::extractString(std::string& param, const Json::Value& params, int
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
NewcoinAddress RPCServer::parseFamily(const std::string& fParam)
|
NewcoinAddress RPCServer::parseFamily(const std::string& fParam)
|
||||||
{
|
{
|
||||||
NewcoinAddress family;
|
NewcoinAddress family;
|
||||||
@@ -171,6 +172,7 @@ NewcoinAddress RPCServer::parseFamily(const std::string& fParam)
|
|||||||
|
|
||||||
return family;
|
return family;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// account_info <account>|<nickname>|<account_public_key>
|
// account_info <account>|<nickname>|<account_public_key>
|
||||||
// account_info <seed>|<pass_phrase>|<key> [<index>]
|
// account_info <seed>|<pass_phrase>|<key> [<index>]
|
||||||
@@ -348,7 +350,9 @@ Json::Value RPCServer::doSendTo(Json::Value& params)
|
|||||||
if (!extractString(sDest, params, 0) || !extractString(sAmount, params, 1))
|
if (!extractString(sDest, params, 0) || !extractString(sAmount, params, 1))
|
||||||
return JSONRPCError(500, "Invalid parameters");
|
return JSONRPCError(500, "Invalid parameters");
|
||||||
|
|
||||||
NewcoinAddress destAccount = parseAccount(sDest);
|
NewcoinAddress destAccount;
|
||||||
|
|
||||||
|
destAccount.setAccountID(sDest) || destAccount.setAccountPublic(sDest);
|
||||||
if (!destAccount.isValid())
|
if (!destAccount.isValid())
|
||||||
return JSONRPCError(500, "Unable to parse destination account");
|
return JSONRPCError(500, "Unable to parse destination account");
|
||||||
|
|
||||||
@@ -400,9 +404,13 @@ Json::Value RPCServer::doTx(Json::Value& params)
|
|||||||
std::string param1, param2;
|
std::string param1, param2;
|
||||||
if (!extractString(param1, params, 0))
|
if (!extractString(param1, params, 0))
|
||||||
{ // all local transactions
|
{ // all local transactions
|
||||||
|
#if 1
|
||||||
|
return "not implemented";
|
||||||
|
#else
|
||||||
Json::Value ret(Json::objectValue);
|
Json::Value ret(Json::objectValue);
|
||||||
theApp->getWallet().addLocalTransactions(ret);
|
theApp->getWallet().addLocalTransactions(ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Transaction::isHexTxID(param1))
|
if (Transaction::isHexTxID(param1))
|
||||||
@@ -419,13 +427,7 @@ Json::Value RPCServer::doTx(Json::Value& params)
|
|||||||
|
|
||||||
if (extractString(param2, params, 1))
|
if (extractString(param2, params, 1))
|
||||||
{ // family seq
|
{ // family seq
|
||||||
LocalAccount::pointer account=theApp->getWallet().parseAccount(param1+":"+param2);
|
return "not implemented";
|
||||||
if (!account)
|
|
||||||
return JSONRPCError(500, "Account not found");
|
|
||||||
Json::Value ret;
|
|
||||||
if (!theApp->getWallet().getTxsJson(account->getAddress(), ret))
|
|
||||||
return JSONRPCError(500, "Unable to get wallet transactions");
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -626,6 +628,96 @@ Json::Value RPCServer::doWalletClaim(Json::Value& params)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wallet_create paying_account account_id [initial_funds]
|
||||||
|
Json::Value RPCServer::doWalletCreate(Json::Value& params)
|
||||||
|
{
|
||||||
|
NewcoinAddress naSourceID;
|
||||||
|
NewcoinAddress naCreateID;
|
||||||
|
|
||||||
|
if (params.size() < 2 || params.size() > 3)
|
||||||
|
{
|
||||||
|
return "invalid params";
|
||||||
|
}
|
||||||
|
else if (!naSourceID.setAccountID(params[0u].asString()))
|
||||||
|
{
|
||||||
|
return "source account id needed";
|
||||||
|
}
|
||||||
|
else if (!naCreateID.setAccountID(params[1u].asString()))
|
||||||
|
{
|
||||||
|
return "create account id needed";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Trying to build:
|
||||||
|
// peer_payment
|
||||||
|
//
|
||||||
|
// Which has no confidential information.
|
||||||
|
|
||||||
|
return "not implemented";
|
||||||
|
#if 0
|
||||||
|
// XXX Need better parsing.
|
||||||
|
uint64 uInitalFunds = 0;
|
||||||
|
uint32 uSourceTag = (params.size() == 2) ? 0 : boost::lexical_cast<uint32>(params[2u].asString());
|
||||||
|
// XXX Annotation is ignored.
|
||||||
|
std::string strAnnotation = (params.size() == 3) ? "" : params[3u].asString();
|
||||||
|
|
||||||
|
NewcoinAddress naMasterSeed;
|
||||||
|
NewcoinAddress naMasterGenerator;
|
||||||
|
|
||||||
|
NewcoinAddress naRegularSeed;
|
||||||
|
NewcoinAddress naRegularGenerator;
|
||||||
|
NewcoinAddress naRegularReservedPublic;
|
||||||
|
NewcoinAddress naRegularReservedPrivate;
|
||||||
|
|
||||||
|
NewcoinAddress naAccountPublic;
|
||||||
|
NewcoinAddress naAccountPrivate;
|
||||||
|
|
||||||
|
naMasterSeed.setFamilySeedGeneric(params[0u].asString());
|
||||||
|
naRegularSeed.setFamilySeedGeneric(params[1u].asString());
|
||||||
|
|
||||||
|
naMasterGenerator.setFamilyGenerator(naMasterSeed);
|
||||||
|
naAccountPublic.setAccountPublic(naMasterGenerator, 0);
|
||||||
|
naAccountPrivate.setAccountPrivate(naMasterGenerator, naMasterSeed, 0);
|
||||||
|
|
||||||
|
naRegularGenerator.setFamilyGenerator(naRegularSeed);
|
||||||
|
|
||||||
|
naRegularReservedPublic.setAccountPublic(naRegularGenerator, -1);
|
||||||
|
naRegularReservedPrivate.setAccountPrivate(naRegularGenerator, naRegularSeed, -1);
|
||||||
|
|
||||||
|
// hash of regular account #reserved public key.
|
||||||
|
uint160 uGeneratorID = naRegularReservedPublic.getAccountID();
|
||||||
|
std::vector<unsigned char> vucGeneratorCipher = naRegularReservedPrivate.accountPrivateEncrypt(naRegularReservedPublic, naMasterGenerator.getFamilyGenerator());
|
||||||
|
std::vector<unsigned char> vucGeneratorSig;
|
||||||
|
|
||||||
|
// XXX Check result.
|
||||||
|
naRegularReservedPrivate.accountPrivateSign(Serializer::getSHA512Half(vucGeneratorCipher), vucGeneratorSig);
|
||||||
|
|
||||||
|
Transaction::pointer trns = Transaction::sharedWalletCreate(
|
||||||
|
naAccountPublic, naAccountPrivate,
|
||||||
|
naAccountPublic,
|
||||||
|
uSourceTag,
|
||||||
|
vucGeneratorCipher,
|
||||||
|
naRegularReservedPublic.getAccountPublic(),
|
||||||
|
vucGeneratorSig);
|
||||||
|
|
||||||
|
(void) theApp->getOPs().processTransaction(trns);
|
||||||
|
|
||||||
|
Json::Value obj(Json::objectValue);
|
||||||
|
|
||||||
|
|
||||||
|
obj["account_id"] = naAccountPublic.humanAccountID();
|
||||||
|
obj["generator_id"] = strHex(uGeneratorID);
|
||||||
|
obj["generator"] = strHex(vucGeneratorCipher);
|
||||||
|
obj["annotation"] = strAnnotation;
|
||||||
|
|
||||||
|
obj["transaction"] = trns->getSTransaction()->getJson(0);
|
||||||
|
obj["status"] = trns->getStatus();
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// wallet_propose
|
// wallet_propose
|
||||||
Json::Value RPCServer::doWalletPropose(Json::Value& params)
|
Json::Value RPCServer::doWalletPropose(Json::Value& params)
|
||||||
{
|
{
|
||||||
@@ -856,21 +948,4 @@ void RPCServer::handle_write(const boost::system::error_code& /*error*/)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NewcoinAddress RPCServer::parseAccount(const std::string& account)
|
|
||||||
{ // FIXME: Support local wallet key names
|
|
||||||
if (account.find(':')!=std::string::npos)
|
|
||||||
{ // local account in family:seq form
|
|
||||||
LocalAccount::pointer lac(theApp->getWallet().parseAccount(account));
|
|
||||||
|
|
||||||
return lac
|
|
||||||
? lac->getAddress()
|
|
||||||
: NewcoinAddress();
|
|
||||||
}
|
|
||||||
|
|
||||||
NewcoinAddress *nap = new NewcoinAddress();
|
|
||||||
|
|
||||||
nap->setAccountID(account) || nap->setAccountPublic(account);
|
|
||||||
|
|
||||||
return *nap;
|
|
||||||
}
|
|
||||||
// vim:ts=4
|
// vim:ts=4
|
||||||
|
|||||||
@@ -31,18 +31,15 @@ class RPCServer : public boost::enable_shared_from_this<RPCServer>
|
|||||||
int getParamCount(const Json::Value& params);
|
int getParamCount(const Json::Value& params);
|
||||||
bool extractString(std::string& param, const Json::Value& params, int index);
|
bool extractString(std::string& param, const Json::Value& params, int index);
|
||||||
|
|
||||||
NewcoinAddress parseFamily(const std::string& family);
|
|
||||||
|
|
||||||
Json::Value doAccountInfo(Json::Value& params);
|
Json::Value doAccountInfo(Json::Value& params);
|
||||||
Json::Value doLock(Json::Value& params);
|
|
||||||
Json::Value doUnlock(Json::Value& params);
|
|
||||||
Json::Value doSendTo(Json::Value& params);
|
|
||||||
Json::Value doConnect(Json::Value& params);
|
Json::Value doConnect(Json::Value& params);
|
||||||
Json::Value doPeers(Json::Value& params);
|
|
||||||
Json::Value doTx(Json::Value& params);
|
|
||||||
Json::Value doLedger(Json::Value& params);
|
Json::Value doLedger(Json::Value& params);
|
||||||
Json::Value doAccount(Json::Value& params);
|
Json::Value doPeers(Json::Value& params);
|
||||||
|
Json::Value doSendTo(Json::Value& params);
|
||||||
|
Json::Value doSessionClose(Json::Value& params);
|
||||||
|
Json::Value doSessionOpen(Json::Value& params);
|
||||||
Json::Value doStop(Json::Value& params);
|
Json::Value doStop(Json::Value& params);
|
||||||
|
Json::Value doTx(Json::Value& params);
|
||||||
|
|
||||||
Json::Value doUnlAdd(Json::Value& params);
|
Json::Value doUnlAdd(Json::Value& params);
|
||||||
Json::Value doUnlDefault(Json::Value& params);
|
Json::Value doUnlDefault(Json::Value& params);
|
||||||
@@ -54,12 +51,14 @@ class RPCServer : public boost::enable_shared_from_this<RPCServer>
|
|||||||
|
|
||||||
Json::Value doValidatorCreate(Json::Value& params);
|
Json::Value doValidatorCreate(Json::Value& params);
|
||||||
|
|
||||||
|
Json::Value doWalletAccounts(Json::Value& params);
|
||||||
Json::Value doWalletClaim(Json::Value& params);
|
Json::Value doWalletClaim(Json::Value& params);
|
||||||
|
Json::Value doWalletCreate(Json::Value& params);
|
||||||
|
Json::Value doWalletLock(Json::Value& params);
|
||||||
Json::Value doWalletPropose(Json::Value& params);
|
Json::Value doWalletPropose(Json::Value& params);
|
||||||
Json::Value doWalletSeed(Json::Value& params);
|
Json::Value doWalletSeed(Json::Value& params);
|
||||||
|
Json::Value doWalletUnlock(Json::Value& params);
|
||||||
|
|
||||||
// Parses a string account name into a local or remote NewcoinAddress.
|
|
||||||
NewcoinAddress parseAccount(const std::string& account);
|
|
||||||
void validatorsResponse(const boost::system::error_code& err, std::string strResponse);
|
void validatorsResponse(const boost::system::error_code& err, std::string strResponse);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
// LocalAccount - an account
|
// LocalAccount - an account
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if 0
|
||||||
LocalAccount::LocalAccount(boost::shared_ptr<LocalAccountFamily> family, int familySeq) :
|
LocalAccount::LocalAccount(boost::shared_ptr<LocalAccountFamily> family, int familySeq) :
|
||||||
mPublicKey(family->getPublicKey(familySeq)), mFamily(family), mAccountFSeq(familySeq)
|
mPublicKey(family->getPublicKey(familySeq)), mFamily(family), mAccountFSeq(familySeq)
|
||||||
{
|
{
|
||||||
@@ -94,6 +95,7 @@ CKey::pointer LocalAccount::getPrivateKey()
|
|||||||
{
|
{
|
||||||
return mFamily->getPrivateKey(mAccountFSeq);
|
return mFamily->getPrivateKey(mAccountFSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// LocalAccountFamily - a sequences of accounts
|
// LocalAccountFamily - a sequences of accounts
|
||||||
//
|
//
|
||||||
@@ -258,10 +260,12 @@ LocalAccount::pointer LocalAccountFamily::get(int seq)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Wallet::Wallet() : mLedger(0) {
|
Wallet::Wallet() : mLedger(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
NewcoinAddress Wallet::addFamily(const NewcoinAddress& familySeed, bool lock)
|
NewcoinAddress Wallet::addFamily(const NewcoinAddress& familySeed, bool lock)
|
||||||
{
|
{
|
||||||
LocalAccountFamily::pointer fam(doPrivate(familySeed, true, !lock));
|
LocalAccountFamily::pointer fam(doPrivate(familySeed, true, !lock));
|
||||||
@@ -324,7 +328,6 @@ bool Wallet::getFamilyInfo(const NewcoinAddress& family, std::string& comment)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
bool Wallet::getFullFamilyInfo(const NewcoinAddress& family, std::string& comment,
|
bool Wallet::getFullFamilyInfo(const NewcoinAddress& family, std::string& comment,
|
||||||
std::string& pubGen, bool& isLocked)
|
std::string& pubGen, bool& isLocked)
|
||||||
{
|
{
|
||||||
@@ -337,7 +340,6 @@ bool Wallet::getFullFamilyInfo(const NewcoinAddress& family, std::string& commen
|
|||||||
isLocked=fit->second->isLocked();
|
isLocked=fit->second->isLocked();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Json::Value Wallet::getFamilyJson(const NewcoinAddress& family)
|
Json::Value Wallet::getFamilyJson(const NewcoinAddress& family)
|
||||||
{
|
{
|
||||||
@@ -347,6 +349,7 @@ Json::Value Wallet::getFamilyJson(const NewcoinAddress& family)
|
|||||||
assert(fit->second->getFamily()==family);
|
assert(fit->second->getFamily()==family);
|
||||||
return fit->second->getJson();
|
return fit->second->getJson();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Wallet::start()
|
void Wallet::start()
|
||||||
{
|
{
|
||||||
@@ -443,6 +446,7 @@ bool Wallet::nodeIdentityCreate() {
|
|||||||
|
|
||||||
void Wallet::load()
|
void Wallet::load()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
std::string sql("SELECT * FROM LocalAcctFamilies;");
|
std::string sql("SELECT * FROM LocalAcctFamilies;");
|
||||||
|
|
||||||
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
||||||
@@ -479,8 +483,10 @@ void Wallet::load()
|
|||||||
} while(db->getNextRow());
|
} while(db->getNextRow());
|
||||||
|
|
||||||
db->endIterRows();
|
db->endIterRows();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// YYY Perhaps this should take a comment.
|
// YYY Perhaps this should take a comment.
|
||||||
LocalAccount::pointer Wallet::getNewLocalAccount(const NewcoinAddress& family)
|
LocalAccount::pointer Wallet::getNewLocalAccount(const NewcoinAddress& family)
|
||||||
{
|
{
|
||||||
@@ -684,13 +690,16 @@ bool Wallet::lock(const NewcoinAddress& family)
|
|||||||
fit->second->lock();
|
fit->second->lock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Wallet::lock()
|
void Wallet::lock()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||||
for(std::map<NewcoinAddress, LocalAccountFamily::pointer>::iterator fit=mFamilies.begin();
|
for(std::map<NewcoinAddress, LocalAccountFamily::pointer>::iterator fit=mFamilies.begin();
|
||||||
fit!=mFamilies.end(); ++fit)
|
fit!=mFamilies.end(); ++fit)
|
||||||
fit->second->lock();
|
fit->second->lock();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wallet::unitTest()
|
bool Wallet::unitTest()
|
||||||
@@ -841,6 +850,7 @@ void Wallet::applyTransaction(Transaction::pointer txn)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
void Wallet::addLocalTransactions(Json::Value& ret)
|
void Wallet::addLocalTransactions(Json::Value& ret)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||||
@@ -848,19 +858,22 @@ void Wallet::addLocalTransactions(Json::Value& ret)
|
|||||||
it!=mTransactions.end(); ++it)
|
it!=mTransactions.end(); ++it)
|
||||||
ret[it->first.GetHex()]=it->second->getJson();
|
ret[it->first.GetHex()]=it->second->getJson();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool Wallet::getTxJson(const uint256& txn, Json::Value& ret)
|
bool Wallet::getTxJson(const uint256& txn, Json::Value& ret)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||||
std::map<uint256, LocalTransaction::pointer>::iterator it = mTransactions.find(txn);
|
std::map<uint256, LocalTransaction::pointer>::iterator it = mTransactions.find(txn);
|
||||||
if (it == mTransactions.end()) return false;
|
if (it == mTransactions.end()) return false;
|
||||||
ret = it->second->getJson();
|
ret = it->second->getJson();
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wallet::getTxsJson(const NewcoinAddress& account, Json::Value& ret)
|
bool Wallet::getTxsJson(const NewcoinAddress& account, Json::Value& ret)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||||
for(std::map<uint256, LocalTransaction::pointer>::iterator it = mTransactions.begin(),
|
for(std::map<uint256, LocalTransaction::pointer>::iterator it = mTransactions.begin(),
|
||||||
end = mTransactions.end(); it != end; ++it)
|
end = mTransactions.end(); it != end; ++it)
|
||||||
@@ -869,7 +882,7 @@ bool Wallet::getTxsJson(const NewcoinAddress& account, Json::Value& ret)
|
|||||||
if(txn && (account == txn->getFromAccount())) // FIXME: Need a way to get all accounts a txn affects
|
if(txn && (account == txn->getFromAccount())) // FIXME: Need a way to get all accounts a txn affects
|
||||||
ret[it->first.GetHex()] = it->second->getJson();
|
ret[it->first.GetHex()] = it->second->getJson();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// vim:ts=4
|
// vim:ts=4
|
||||||
|
|||||||
17
src/Wallet.h
17
src/Wallet.h
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
#include "Serializer.h"
|
#include "Serializer.h"
|
||||||
#include "LocalAccount.h"
|
// #include "LocalAccount.h"
|
||||||
#include "LocalTransaction.h"
|
// #include "LocalTransaction.h"
|
||||||
|
|
||||||
class Ledger;
|
class Ledger;
|
||||||
|
|
||||||
@@ -35,15 +35,16 @@ protected:
|
|||||||
DH* mDh512;
|
DH* mDh512;
|
||||||
DH* mDh1024;
|
DH* mDh1024;
|
||||||
|
|
||||||
|
uint32 mLedger; // ledger we last synched to
|
||||||
|
|
||||||
|
#if 0
|
||||||
std::map<NewcoinAddress, LocalAccountFamily::pointer> mFamilies;
|
std::map<NewcoinAddress, LocalAccountFamily::pointer> mFamilies;
|
||||||
std::map<NewcoinAddress, LocalAccount::pointer> mAccounts;
|
std::map<NewcoinAddress, LocalAccount::pointer> mAccounts;
|
||||||
std::map<uint256, LocalTransaction::pointer> mTransactions;
|
std::map<uint256, LocalTransaction::pointer> mTransactions;
|
||||||
|
|
||||||
uint32 mLedger; // ledger we last synched to
|
|
||||||
|
|
||||||
LocalAccountFamily::pointer doPrivate(const NewcoinAddress& familySeed, bool do_create, bool do_unlock);
|
LocalAccountFamily::pointer doPrivate(const NewcoinAddress& familySeed, bool do_create, bool do_unlock);
|
||||||
LocalAccountFamily::pointer doPublic(const NewcoinAddress& familyGenerator, bool do_create, bool do_db);
|
LocalAccountFamily::pointer doPublic(const NewcoinAddress& familyGenerator, bool do_create, bool do_db);
|
||||||
|
#endif
|
||||||
// void addFamily(const NewcoinAddress& family, const std::string& pubKey, int seq, const std::string& name, const std::string& comment);
|
// void addFamily(const NewcoinAddress& family, const std::string& pubKey, int seq, const std::string& name, const std::string& comment);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -58,6 +59,7 @@ public:
|
|||||||
DH* getDh512() { return DHparams_dup(mDh512); }
|
DH* getDh512() { return DHparams_dup(mDh512); }
|
||||||
DH* getDh1024() { return DHparams_dup(mDh1024); }
|
DH* getDh1024() { return DHparams_dup(mDh1024); }
|
||||||
|
|
||||||
|
#if 0
|
||||||
NewcoinAddress addFamily(const std::string& passPhrase, bool lock);
|
NewcoinAddress addFamily(const std::string& passPhrase, bool lock);
|
||||||
NewcoinAddress addFamily(const NewcoinAddress& familySeed, bool lock);
|
NewcoinAddress addFamily(const NewcoinAddress& familySeed, bool lock);
|
||||||
NewcoinAddress addFamily(const NewcoinAddress& familyGenerator);
|
NewcoinAddress addFamily(const NewcoinAddress& familyGenerator);
|
||||||
@@ -70,10 +72,12 @@ public:
|
|||||||
void getFamilies(std::vector<NewcoinAddress>& familyIDs);
|
void getFamilies(std::vector<NewcoinAddress>& familyIDs);
|
||||||
|
|
||||||
bool lock(const NewcoinAddress& familyName);
|
bool lock(const NewcoinAddress& familyName);
|
||||||
|
#endif
|
||||||
void lock();
|
void lock();
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
|
#if 0
|
||||||
// must be a known local account
|
// must be a known local account
|
||||||
LocalAccount::pointer parseAccount(const std::string& accountSpecifier);
|
LocalAccount::pointer parseAccount(const std::string& accountSpecifier);
|
||||||
|
|
||||||
@@ -81,18 +85,19 @@ public:
|
|||||||
LocalAccount::pointer getLocalAccount(const NewcoinAddress& acctID);
|
LocalAccount::pointer getLocalAccount(const NewcoinAddress& acctID);
|
||||||
LocalAccount::pointer getNewLocalAccount(const NewcoinAddress& family);
|
LocalAccount::pointer getNewLocalAccount(const NewcoinAddress& family);
|
||||||
LocalAccount::pointer findAccountForTransaction(uint64 amount);
|
LocalAccount::pointer findAccountForTransaction(uint64 amount);
|
||||||
|
|
||||||
NewcoinAddress peekKey(const NewcoinAddress& family, int seq);
|
NewcoinAddress peekKey(const NewcoinAddress& family, int seq);
|
||||||
|
|
||||||
bool getFamilyInfo(const NewcoinAddress& family, std::string& comment);
|
bool getFamilyInfo(const NewcoinAddress& family, std::string& comment);
|
||||||
// bool getFullFamilyInfo(const NewcoinAddress& family, std::string& comment, std::string& pubGen, bool& isLocked);
|
// bool getFullFamilyInfo(const NewcoinAddress& family, std::string& comment, std::string& pubGen, bool& isLocked);
|
||||||
|
|
||||||
Json::Value getFamilyJson(const NewcoinAddress& family);
|
Json::Value getFamilyJson(const NewcoinAddress& family);
|
||||||
|
#endif
|
||||||
bool getTxJson(const uint256& txid, Json::Value& value);
|
bool getTxJson(const uint256& txid, Json::Value& value);
|
||||||
bool getTxsJson(const NewcoinAddress& acctid, Json::Value& value);
|
bool getTxsJson(const NewcoinAddress& acctid, Json::Value& value);
|
||||||
void addLocalTransactions(Json::Value&);
|
void addLocalTransactions(Json::Value&);
|
||||||
|
|
||||||
void syncToLedger(bool force, Ledger* ledger);
|
void syncToLedger(bool force, Ledger* ledger);
|
||||||
void applyTransaction(Transaction::pointer);
|
|
||||||
|
|
||||||
static bool unitTest();
|
static bool unitTest();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user