Delete obsolete Local* files.

This commit is contained in:
Arthur Britto
2012-05-20 02:00:15 -07:00
parent 8ba9fe2d88
commit fe85e87d4c
3 changed files with 0 additions and 221 deletions

View File

@@ -1,98 +0,0 @@
#ifndef __LOCALACCOUNT__
#define __LOCALACCOUNT__
#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
#include "AccountState.h"
class LocalAccountFamily;
class LocalAccount
{ // tracks keys for local accounts
public:
typedef boost::shared_ptr<LocalAccount> pointer;
protected:
// core account information
CKey::pointer mPublicKey;
NewcoinAddress mAccount;
std::string mComment;
// family information
boost::shared_ptr<LocalAccountFamily> mFamily;
int mAccountFSeq;
public:
LocalAccount(boost::shared_ptr<LocalAccountFamily> 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<LocalAccountFamily>
{ // tracks families of local accounts
public:
typedef boost::shared_ptr<LocalAccountFamily> pointer;
protected:
std::map<int, LocalAccount::pointer> 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<int, LocalAccount::pointer>& 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

View File

@@ -1,65 +0,0 @@
#include <boost/lexical_cast.hpp>
#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<std::string>(mAmount);
Json::Value destination(Json::objectValue);
destination["AccountID"]=mDestAcctID.humanAccountID();
ret["Destination"]=destination;
return ret;
}
return mTransaction->getJson(true, isPaid(), isCredited());
}
// vim:ts=4

View File

@@ -1,58 +0,0 @@
#ifndef __LOCALTRANSACTION__
#define __LOCALTRANSACTION__
// A structure to represent a local transaction
#include <string>
#include <boost/shared_ptr.hpp>
#include "../json/value.h"
#include "uint256.h"
#include "Transaction.h"
class LocalTransaction
{
public:
typedef boost::shared_ptr<LocalTransaction> 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