mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 10:35:50 +00:00
Make these pieces work together.
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "util/pugixml.hpp"
|
#include "util/pugixml.hpp"
|
||||||
#include "Application.h"
|
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -69,7 +69,7 @@ HEADERS = \
|
|||||||
|
|
||||||
SRCS= \
|
SRCS= \
|
||||||
test.cpp Hanko.cpp Transaction.cpp SHAMap.cpp SHAMapNodes.cpp Serializer.cpp Ledger.cpp \
|
test.cpp Hanko.cpp Transaction.cpp SHAMap.cpp SHAMapNodes.cpp Serializer.cpp Ledger.cpp \
|
||||||
AccountState.cpp
|
AccountState.cpp Wallet.cpp NewcoinAddress.cpp Config.cpp util/pugixml.o
|
||||||
|
|
||||||
|
|
||||||
# Application.cpp HttpReply.cpp main.cpp RPCCommands.cpp \
|
# Application.cpp HttpReply.cpp main.cpp RPCCommands.cpp \
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ NewcoinAddress::NewcoinAddress(const char* pszAddress)
|
|||||||
SetString(pszAddress);
|
SetString(pszAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint160 NewcoinAddress::GetHash160()
|
uint160 NewcoinAddress::GetHash160() const
|
||||||
{
|
{
|
||||||
assert(vchData.size() == 20);
|
assert(vchData.size() == 20);
|
||||||
uint160 hash160;
|
uint160 hash160;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ bool Transaction::sign(LocalAccount& fromLocalAccount)
|
|||||||
{
|
{
|
||||||
if( (mAmount==0) || (mSourceLedger==0) || (mAccountTo==0) )
|
if( (mAmount==0) || (mSourceLedger==0) || (mAccountTo==0) )
|
||||||
return false;
|
return false;
|
||||||
if(mAccountFrom!=fromLocalAccount.mAddress)
|
if(mAccountFrom!=fromLocalAccount.mAddress.GetHash160())
|
||||||
return false;
|
return false;
|
||||||
Serializer::pointer signBuf=getRaw(true);
|
Serializer::pointer signBuf=getRaw(true);
|
||||||
if(!signBuf->makeSignature(mSignature, fromLocalAccount.peekPrivKey()))
|
if(!signBuf->makeSignature(mSignature, fromLocalAccount.peekPrivKey()))
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
class UniqueNodeList
|
class UniqueNodeList
|
||||||
{
|
{
|
||||||
// hanko to public key
|
// hanko to public key
|
||||||
//std::map<uint160,uint512> mUNL;
|
//std::map<uint160, uint256> mUNL;
|
||||||
public:
|
public:
|
||||||
//void load();
|
//void load();
|
||||||
//void save();
|
//void save();
|
||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
void removeNode(uint160& hanko);
|
void removeNode(uint160& hanko);
|
||||||
|
|
||||||
// 0- we don't care, 1- we care and is valid, 2-invalid signature
|
// 0- we don't care, 1- we care and is valid, 2-invalid signature
|
||||||
int checkValid(newcoin::Validation& valid);
|
// int checkValid(newcoin::Validation& valid);
|
||||||
|
|
||||||
void dumpUNL(std::string& retStr);
|
void dumpUNL(std::string& retStr);
|
||||||
|
|
||||||
|
|||||||
16
Wallet.cpp
16
Wallet.cpp
@@ -1,11 +1,16 @@
|
|||||||
#include "Wallet.h"
|
#include "Wallet.h"
|
||||||
#include "NewcoinAddress.h"
|
#include "NewcoinAddress.h"
|
||||||
#include "Conversion.h"
|
|
||||||
#include "Application.h"
|
|
||||||
#include "LedgerMaster.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
using namespace std;
|
|
||||||
|
LocalAccount::LocalAccount(bool)
|
||||||
|
{
|
||||||
|
mPrivateKey.MakeNewKey();
|
||||||
|
mPublicKey.SetPubKey(mPrivateKey.GetPubKey());
|
||||||
|
mAddress.SetPubKey(mPublicKey.GetPubKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
Wallet::Wallet()
|
Wallet::Wallet()
|
||||||
{
|
{
|
||||||
@@ -170,3 +175,6 @@ bool Wallet::commitTransaction(TransactionPtr trans)
|
|||||||
}
|
}
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
8
Wallet.h
8
Wallet.h
@@ -2,9 +2,8 @@
|
|||||||
#define __WALLET__
|
#define __WALLET__
|
||||||
|
|
||||||
#include "keystore.h"
|
#include "keystore.h"
|
||||||
#include "newcoin.pb.h"
|
|
||||||
#include "Transaction.h"
|
|
||||||
#include "Serializer.h"
|
#include "Serializer.h"
|
||||||
|
#include "Transaction.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -18,18 +17,19 @@ class LocalAccount
|
|||||||
public:
|
public:
|
||||||
//CKey mKey;
|
//CKey mKey;
|
||||||
//std::string mHumanAddress;
|
//std::string mHumanAddress;
|
||||||
uint160 mAddress;
|
NewcoinAddress mAddress;
|
||||||
CKey mPublicKey, mPrivateKey;
|
CKey mPublicKey, mPrivateKey;
|
||||||
int64 mAmount;
|
int64 mAmount;
|
||||||
uint32 mSeqNum;
|
uint32 mSeqNum;
|
||||||
|
|
||||||
|
LocalAccount(bool); // create a new local acount
|
||||||
bool signRaw(Serializer::pointer);
|
bool signRaw(Serializer::pointer);
|
||||||
bool signRaw(Serializer::pointer, std::vector<unsigned char>& signature);
|
bool signRaw(Serializer::pointer, std::vector<unsigned char>& signature);
|
||||||
bool checkSignRaw(Serializer::pointer, int signaturePosition=-1, int signedData=-1);
|
bool checkSignRaw(Serializer::pointer, int signaturePosition=-1, int signedData=-1);
|
||||||
CKey& peekPrivKey() { return mPrivateKey; }
|
CKey& peekPrivKey() { return mPrivateKey; }
|
||||||
CKey& peekPubKey() { return mPublicKey; }
|
CKey& peekPubKey() { return mPublicKey; }
|
||||||
|
|
||||||
const uint160& getAddress(void) const { return mAddress; }
|
uint160 getAddress(void) const { return mAddress.GetHash160(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Wallet : public CBasicKeyStore
|
class Wallet : public CBasicKeyStore
|
||||||
|
|||||||
Reference in New Issue
Block a user