mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fire up the initial ledgers and attach them to the application.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include "PeerDoor.h"
|
#include "PeerDoor.h"
|
||||||
#include "RPCDoor.h"
|
#include "RPCDoor.h"
|
||||||
#include "BitcoinUtil.h"
|
#include "BitcoinUtil.h"
|
||||||
|
#include "DeterministicKeys.h"
|
||||||
#include "database/SqliteDatabase.h"
|
#include "database/SqliteDatabase.h"
|
||||||
//#include <boost/log/trivial.hpp>
|
//#include <boost/log/trivial.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -29,6 +30,17 @@ Application::Application()
|
|||||||
mWallet.load();
|
mWallet.load();
|
||||||
mPeerDoor=NULL;
|
mPeerDoor=NULL;
|
||||||
mRPCDoor=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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,11 @@ CKey::pointer DetKeySet::getPrivKey(uint32 n)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint160 DetKeySet::getAccountID(uint32 n)
|
||||||
|
{
|
||||||
|
return getPubKey(n)->GetAddress().GetHash160();
|
||||||
|
}
|
||||||
|
|
||||||
void DetKeySet::getPubKeys(uint32 first, uint32 count, std::list<CKey::pointer>& keys)
|
void DetKeySet::getPubKeys(uint32 first, uint32 count, std::list<CKey::pointer>& keys)
|
||||||
{
|
{
|
||||||
while(count-->0)
|
while(count-->0)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public:
|
|||||||
|
|
||||||
CKey::pointer getPubKey(uint32 n);
|
CKey::pointer getPubKey(uint32 n);
|
||||||
CKey::pointer getPrivKey(uint32 n);
|
CKey::pointer getPrivKey(uint32 n);
|
||||||
|
uint160 getAccountID(uint32 n);
|
||||||
|
|
||||||
void getPubKeys(uint32 first, uint32 count, std::list<CKey::pointer>& keys);
|
void getPubKeys(uint32 first, uint32 count, std::list<CKey::pointer>& keys);
|
||||||
void getPrivKeys(uint32 first, uint32 count, std::list<CKey::pointer>& keys);
|
void getPrivKeys(uint32 first, uint32 count, std::list<CKey::pointer>& keys);
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public:
|
|||||||
LedgerMaster();
|
LedgerMaster();
|
||||||
|
|
||||||
uint32 getCurrentLedgerIndex();
|
uint32 getCurrentLedgerIndex();
|
||||||
bool IsSynced() { return mIsSynced; }
|
bool isSynced() { return mIsSynced; }
|
||||||
void SetSynced() { mIsSynced=true; }
|
void setSynced() { mIsSynced=true; }
|
||||||
|
|
||||||
Ledger::pointer getCurrentLedger() { return mCurrentLedger; }
|
Ledger::pointer getCurrentLedger() { return mCurrentLedger; }
|
||||||
Ledger::pointer getClosingLedger() { return mFinalizingLedger; }
|
Ledger::pointer getClosingLedger() { return mFinalizingLedger; }
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -71,7 +71,8 @@ SRCS= keystore.cpp BitcoinUtil.cpp \
|
|||||||
AccountState.cpp Wallet.cpp NewcoinAddress.cpp Config.cpp PackedMessage.cpp \
|
AccountState.cpp Wallet.cpp NewcoinAddress.cpp Config.cpp PackedMessage.cpp \
|
||||||
Application.cpp TimingService.cpp KnownNodeList.cpp ConnectionPool.cpp Peer.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 \
|
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
|
DBSRCS= SqliteDatabase.cpp database.cpp
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ all: newcoind
|
|||||||
newcoin.pb.h: newcoin.proto
|
newcoin.pb.h: newcoin.proto
|
||||||
protoc --cpp_out=. newcoin.proto
|
protoc --cpp_out=. newcoin.proto
|
||||||
|
|
||||||
%.o: %.cpp newcoin.pb.h $(HEADERS)
|
%.o: %.cpp
|
||||||
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user