From fe85e87d4cfd84dbc34482132dd56c2324c25d46 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sun, 20 May 2012 02:00:15 -0700 Subject: [PATCH] Delete obsolete Local* files. --- src/LocalAccount.h | 98 ---------------------------------------- src/LocalTransaction.cpp | 65 -------------------------- src/LocalTransaction.h | 58 ------------------------ 3 files changed, 221 deletions(-) delete mode 100644 src/LocalAccount.h delete mode 100644 src/LocalTransaction.cpp delete mode 100644 src/LocalTransaction.h diff --git a/src/LocalAccount.h b/src/LocalAccount.h deleted file mode 100644 index 9e677c7bdd..0000000000 --- a/src/LocalAccount.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __LOCALACCOUNT__ -#define __LOCALACCOUNT__ - -#include -#include - -#include "AccountState.h" - -class LocalAccountFamily; - -class LocalAccount -{ // tracks keys for local accounts -public: - typedef boost::shared_ptr pointer; - -protected: - // core account information - CKey::pointer mPublicKey; - NewcoinAddress mAccount; - std::string mComment; - - // family information - boost::shared_ptr mFamily; - int mAccountFSeq; - -public: - LocalAccount(boost::shared_ptr family, int accountSeq); - - // Database operations - bool read(); // reads any existing data - bool write(); // creates the record in the first place - bool updateName(); // writes changed name/comment - bool updateBalance(); // writes changed balance/seq - - const NewcoinAddress& getAddress() const { return mAccount; } - int getAcctFSeq() const { return mAccountFSeq; } - - std::string getFullName() const; - std::string getFamilyName() const; - - bool isLocked() const; - bool isIssued() const; - - CKey::pointer getPublicKey() { return mPublicKey; } - CKey::pointer getPrivateKey(); - Json::Value getJson() const; - - AccountState::pointer getAccountState() const; - uint64 getEffectiveBalance() const; -}; - -class LocalAccountFamily : public boost::enable_shared_from_this -{ // tracks families of local accounts -public: - typedef boost::shared_ptr pointer; - -protected: - std::map mAccounts; - - NewcoinAddress mFamily; // Family generator - - uint32 mLastSeq; - std::string mComment; - - BIGNUM* mRootPrivateKey; - -public: - - LocalAccountFamily(const NewcoinAddress& familyGenerator); - ~LocalAccountFamily(); - - const NewcoinAddress& getFamily() const { return mFamily; } - - void unlock(BIGNUM* privateKey); - void lock(); - bool isLocked() const { return mRootPrivateKey==NULL; } - - void setSeq(uint32 s) { mLastSeq=s; } - uint32 getSeq() { return mLastSeq; } - void setComment(const std::string& c) { mComment=c; } - - std::map& getAcctMap() { return mAccounts; } - LocalAccount::pointer get(int seq); - NewcoinAddress getAccount(int seq, bool keep); - CKey::pointer getPrivateKey(int seq); - CKey::pointer getPublicKey(int seq); - - std::string getComment() const { return mComment; } - Json::Value getJson() const; - - static std::string getSQLFields(); - std::string getSQL() const; - static LocalAccountFamily::pointer readFamily(const NewcoinAddress& family); - void write(bool is_new); -}; - -#endif -// vim:ts=4 diff --git a/src/LocalTransaction.cpp b/src/LocalTransaction.cpp deleted file mode 100644 index 8746cceff9..0000000000 --- a/src/LocalTransaction.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -#include - -#include "../json/writer.h" - -#include "LocalTransaction.h" -#include "Application.h" -#include "Wallet.h" - -bool LocalTransaction::makeTransaction() -{ - if(!!mTransaction) return true; - - std::cerr << "LocalTransaction is obsolete." << std::endl; - return false; - -#if 0 - LocalAccount::pointer lac(theApp->getWallet().findAccountForTransaction(mAmount)); - if(!lac) - { - std::cerr << "Account with sufficient balance not found" << std::endl; - return false; - } - - mTransaction=Transaction::pointer(new Transaction(lac, mDestAcctID, mAmount, mTag, - theApp->getOPs().getCurrentLedgerID())); - if(mTransaction->getStatus()!=NEW) - { -#ifdef DEBUG - std::cerr << "Status not NEW" << std::endl; - Json::Value t=mTransaction->getJson(true); - Json::StyledStreamWriter w; - w.write(std::cerr, t); -#endif - return false; - } - return true; -#endif -} - -void LocalTransaction::performTransaction() -{ - mTransaction=theApp->getOPs().processTransaction(mTransaction); -} - -Json::Value LocalTransaction::getJson() const -{ - if(!mTransaction) - { // has no corresponding transaction - Json::Value ret(Json::objectValue); - ret["Status"]="unfunded"; - ret["Amount"]=boost::lexical_cast(mAmount); - - Json::Value destination(Json::objectValue); - destination["AccountID"]=mDestAcctID.humanAccountID(); - - ret["Destination"]=destination; - - return ret; - } - - return mTransaction->getJson(true, isPaid(), isCredited()); -} - -// vim:ts=4 diff --git a/src/LocalTransaction.h b/src/LocalTransaction.h deleted file mode 100644 index 3913e12854..0000000000 --- a/src/LocalTransaction.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __LOCALTRANSACTION__ -#define __LOCALTRANSACTION__ - -// A structure to represent a local transaction - -#include - -#include - -#include "../json/value.h" - -#include "uint256.h" -#include "Transaction.h" - -class LocalTransaction -{ -public: - typedef boost::shared_ptr pointer; - -protected: - - // core specifications - NewcoinAddress mDestAcctID; - uint64 mAmount; - uint32 mTag; - std::string mComment; - bool mPaid, mCredited; - - Transaction::pointer mTransaction; - -public: - - LocalTransaction(const NewcoinAddress &dest, uint64 amount, uint32 tag) : - mDestAcctID(dest), mAmount(amount), mTag(tag), mPaid(false), mCredited(false) { ; } - void setComment(const std::string& comment) { mComment=comment; } - - const NewcoinAddress& getDestinationAccount() const { return mDestAcctID; } - uint64 getAmount() const { return mAmount; } - uint32 getTag() const { return mTag; } - const std::string& getComment() const { return mComment; } - - Transaction::pointer getTransaction() { return mTransaction; } - void setTransaction(Transaction::pointer t) { mTransaction=t; } - - bool isPaid() const { return mPaid; } - void setPaid() { mPaid=true; } - void setUnpaid() { mPaid=false; } - bool isCredited() const { return mCredited; } - void setCredited() { mCredited=true; } - void setUncredited() { mCredited=false; } - - void performTransaction(); // perform this transaction as if we received it from the network - bool makeTransaction(); // create a transaction object according to these rules - - Json::Value getJson() const; -}; - -#endif