diff --git a/Application.cpp b/Application.cpp index ec31953d6..0d828b4e2 100644 --- a/Application.cpp +++ b/Application.cpp @@ -3,6 +3,7 @@ #include "PeerDoor.h" #include "RPCDoor.h" #include "BitcoinUtil.h" +#include "DeterministicKeys.h" #include "database/SqliteDatabase.h" //#include #include @@ -29,6 +30,17 @@ Application::Application() mWallet.load(); mPeerDoor=NULL; mRPCDoor=NULL; + + DetKeySet ks("This is a test payphrase."); + + Ledger::pointer firstLedger(new Ledger(ks.getAccountID(0), 1000000)); + firstLedger->setClosed(); + firstLedger->setAccepted(); + mMasterLedger.pushLedger(firstLedger); + + Ledger::pointer secondLedger=firstLedger->closeLedger(time(NULL)); + mMasterLedger.pushLedger(secondLedger); + mMasterLedger.setSynced(); } diff --git a/Application.h b/Application.h index 6da425ea8..c6dd5b0f8 100644 --- a/Application.h +++ b/Application.h @@ -68,4 +68,4 @@ public: extern Application* theApp; -#endif \ No newline at end of file +#endif diff --git a/DeterministicKeys.cpp b/DeterministicKeys.cpp index c298050a2..7893f1ebd 100644 --- a/DeterministicKeys.cpp +++ b/DeterministicKeys.cpp @@ -133,6 +133,11 @@ CKey::pointer DetKeySet::getPrivKey(uint32 n) return ret; } +uint160 DetKeySet::getAccountID(uint32 n) +{ + return getPubKey(n)->GetAddress().GetHash160(); +} + void DetKeySet::getPubKeys(uint32 first, uint32 count, std::list& keys) { while(count-->0) diff --git a/DeterministicKeys.h b/DeterministicKeys.h index d67cf77eb..5a3e53d7b 100644 --- a/DeterministicKeys.h +++ b/DeterministicKeys.h @@ -27,6 +27,7 @@ public: CKey::pointer getPubKey(uint32 n); CKey::pointer getPrivKey(uint32 n); + uint160 getAccountID(uint32 n); void getPubKeys(uint32 first, uint32 count, std::list& keys); void getPrivKeys(uint32 first, uint32 count, std::list& keys); diff --git a/LedgerMaster.h b/LedgerMaster.h index 20fcfc40a..2f2a55461 100644 --- a/LedgerMaster.h +++ b/LedgerMaster.h @@ -33,8 +33,8 @@ public: LedgerMaster(); uint32 getCurrentLedgerIndex(); - bool IsSynced() { return mIsSynced; } - void SetSynced() { mIsSynced=true; } + bool isSynced() { return mIsSynced; } + void setSynced() { mIsSynced=true; } Ledger::pointer getCurrentLedger() { return mCurrentLedger; } Ledger::pointer getClosingLedger() { return mFinalizingLedger; } diff --git a/Makefile b/Makefile index 4277ad518..9d0ff21cf 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,8 @@ SRCS= keystore.cpp BitcoinUtil.cpp \ AccountState.cpp Wallet.cpp NewcoinAddress.cpp Config.cpp PackedMessage.cpp \ Application.cpp TimingService.cpp KnownNodeList.cpp ConnectionPool.cpp Peer.cpp \ PeerDoor.cpp RPCDoor.cpp RPCServer.cpp rpc.cpp Conversion.cpp RequestParser.cpp HashedObject.cpp \ - UniqueNodeList.cpp PubKeyCache.cpp SHAMapDiff.cpp DeterministicKeys.cpp + UniqueNodeList.cpp PubKeyCache.cpp SHAMapDiff.cpp DeterministicKeys.cpp LedgerMaster.cpp \ + LedgerHistory.cpp DBSRCS= SqliteDatabase.cpp database.cpp @@ -94,7 +95,7 @@ all: newcoind newcoin.pb.h: newcoin.proto protoc --cpp_out=. newcoin.proto -%.o: %.cpp newcoin.pb.h $(HEADERS) +%.o: %.cpp $(CXX) -c $(CXXFLAGS) -o $@ $<