Transaction Infrastructure Work:

Raw account class (address + public key)
Account State class (account + balance + ledgers valid)
Raw Hanko class
Low-level tranasaction class
Small wallet and key bits
Misc updates to the protocol.
Protocol addition to allow code to wait for replies, but that may not be a good idea.
This commit is contained in:
JoelKatz
2011-11-11 14:13:25 -08:00
parent fd7e41501b
commit e9ae645e3b
11 changed files with 238 additions and 116 deletions

View File

@@ -4,6 +4,7 @@
#include "Transaction.h"
#include "types.h"
#include "BitcoinUtil.h"
#include "Hanko.h"
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
@@ -18,39 +19,20 @@ public:
typedef boost::shared_ptr<Ledger> pointer;
typedef std::pair<int64,uint32> Account;
private:
bool mValidSig;
bool mValidHash;
uint32 mIndex;
bool mValidHash, mValidLedger, mOpen;
uint256 mHash;
uint256 mSignature;
uint256 mParentHash;
uint32 mValidationSeqNum;
uint64 mFeeHeld;
std::map<uint160, Account > mAccounts;
std::list<TransactionPtr> mTransactions;
std::list<TransactionPtr> mDiscardedTransactions;
uint256 mParentHash, mTransHash, mAccountHash;
uint64 mFeeHeld, mTimeStamp;
uint32 mLedgerSeq;
//TransactionBundle mBundle;
// these can be NULL
// we need to keep track in case there are changes in this ledger that effect either the parent or child.
Ledger::pointer mParent;
Ledger::pointer mChild;
void sign();
void hash();
void addTransactionAllowNeg(TransactionPtr trans);
void correctAccounts();
void correctAccount(const uint160& address);
public:
Ledger();
Ledger(uint32 index);
Ledger(newcoin::FullLedger& ledger);
Ledger(Ledger::pointer other);
std::vector<unsigned char> Sign(uint64 timestamp, LocalHanko &Hanko);
#if 0
void setTo(newcoin::FullLedger& ledger);
void mergeIn(Ledger::pointer other);
@@ -61,8 +43,6 @@ public:
void publishValidation();
std::list<TransactionPtr>& getTransactions(){ return(mTransactions); }
bool hasTransaction(TransactionPtr trans);
int64 getAmountHeld(const uint160& address);
void parentAddedTransaction(TransactionPtr cause);
@@ -82,7 +62,7 @@ public:
Ledger::pointer getParent();
Ledger::pointer getChild();
bool isCompatible(Ledger::pointer other);
#endif
};