mirror of
https://github.com/XRPLF/rippled.git
synced 2026-10-03 10:18:26 +00:00
Merge branch 'develop'
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -37,3 +37,6 @@ db/*.db-*
|
||||
rippled.cfg
|
||||
validators.txt
|
||||
test/config.js
|
||||
|
||||
# Doxygen generated documentation output
|
||||
HtmlDocumentation
|
||||
|
||||
@@ -123,7 +123,8 @@ RIPPLE_SRCS = [
|
||||
'src/cpp/leveldb_core.cpp',
|
||||
'src/cpp/websocket_core.cpp',
|
||||
'modules/ripple_basics/ripple_basics.cpp',
|
||||
'modules/ripple_client/ripple_client.cpp',
|
||||
'modules/ripple_client/ripple_client.cpp',
|
||||
'modules/ripple_data/ripple_data.cpp',
|
||||
'modules/ripple_db/ripple_db.cpp',
|
||||
'modules/ripple_json/ripple_json.cpp',
|
||||
'modules/ripple_ledger/ripple_ledger.cpp',
|
||||
@@ -139,6 +140,7 @@ for dir in ['.', 'ripple', 'database', 'json', 'leveldb/db', 'leveldb/port', 'le
|
||||
for dir in [
|
||||
'ripple_basics',
|
||||
'ripple_client',
|
||||
'ripple_data',
|
||||
'ripple_db',
|
||||
'ripple_json',
|
||||
'ripple_ledger',
|
||||
|
||||
BIN
artwork/LogoForDocumentation.png
Normal file
BIN
artwork/LogoForDocumentation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -22,8 +22,6 @@
|
||||
@ingroup ripple_basics
|
||||
*/
|
||||
|
||||
#include "ripple_basics.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
@@ -38,8 +36,6 @@
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@@ -47,7 +43,7 @@
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
// VFALCO: TODO, Replace OpenSSL randomness with a dependency-free implementation
|
||||
// Perhaps Schneier's Yarrow or a variant. Abstract the collection of
|
||||
// Perhaps Schneier's Fortuna or a variant. Abstract the collection of
|
||||
// entropy and provide OS-specific implementation. We can re-use the
|
||||
// BearShare source code for this.
|
||||
//
|
||||
@@ -55,6 +51,11 @@
|
||||
//
|
||||
#include <openssl/rand.h> // Because of ripple_RandomNumbers.cpp
|
||||
|
||||
|
||||
#include "ripple_basics.h"
|
||||
|
||||
|
||||
|
||||
// VFALCO: TODO, fix these warnings!
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
|
||||
@@ -68,6 +69,7 @@
|
||||
|
||||
#include "utility/ripple_ByteOrder.cpp"
|
||||
#include "utility/ripple_DiffieHellmanUtil.cpp"
|
||||
#include "utility/ripple_InstanceCounter.cpp"
|
||||
#include "utility/ripple_StringUtilities.cpp"
|
||||
#include "utility/ripple_Sustain.cpp"
|
||||
#include "utility/ripple_ThreadName.cpp"
|
||||
|
||||
@@ -74,6 +74,11 @@ namespace boost {
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/icl/interval_set.hpp> // oof this one is ugly
|
||||
|
||||
// InstanceCounter
|
||||
//#include <string>
|
||||
//#include <vector>
|
||||
//#include <boost/thread/mutex.hpp>
|
||||
|
||||
// TaggedCache
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
@@ -84,6 +89,12 @@ namespace boost {
|
||||
// RippleTime
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
// ScopedLock
|
||||
//#include <boost/thread/recursive_mutex.hpp>
|
||||
//#include <boost/shared_ptr.hpp>
|
||||
//#include <boost/make_shared.hpp>
|
||||
//#include <boost/ref.hpp>
|
||||
|
||||
// ByteOrder
|
||||
#ifdef WIN32
|
||||
// (nothing)
|
||||
@@ -104,6 +115,8 @@ namespace boost {
|
||||
|
||||
// VFALCO: TODO, remove this dependency!!!
|
||||
#include <openssl/dh.h> // for DiffieHellmanUtil
|
||||
#include <openssl/ripemd.h> // For HashUtilities
|
||||
#include <openssl/sha.h> // For HashUtilities
|
||||
|
||||
|
||||
#include "../ripple_json/ripple_json.h"
|
||||
@@ -118,8 +131,10 @@ namespace boost {
|
||||
|
||||
#include "utility/ripple_ByteOrder.h"
|
||||
#include "utility/ripple_DiffieHellmanUtil.h"
|
||||
#include "utility/ripple_InstanceCounter.h"
|
||||
#include "utility/ripple_PlatformMacros.h"
|
||||
#include "utility/ripple_RandomNumbers.h"
|
||||
#include "utility/ripple_ScopedLock.h"
|
||||
#include "utility/ripple_StringUtilities.h"
|
||||
#include "utility/ripple_Sustain.h"
|
||||
#include "utility/ripple_ThreadName.h"
|
||||
@@ -127,5 +142,6 @@ namespace boost {
|
||||
#include "utility/ripple_UptimeTimer.h"
|
||||
|
||||
#include "types/ripple_UInt256.h"
|
||||
#include "utility/ripple_HashUtilities.h" // requires UInt256
|
||||
|
||||
#endif
|
||||
|
||||
@@ -505,7 +505,6 @@ inline bool operator!=(const uint256& a, const uint256& b) { return (base_ui
|
||||
inline const uint256 operator^(const uint256& a, const uint256& b) { return (base_uint256)a ^ (base_uint256)b; }
|
||||
inline const uint256 operator&(const uint256& a, const uint256& b) { return (base_uint256)a & (base_uint256)b; }
|
||||
inline const uint256 operator|(const uint256& a, const uint256& b) { return (base_uint256)a | (base_uint256)b; }
|
||||
extern std::size_t hash_value(const uint256&);
|
||||
|
||||
template<unsigned int BITS> inline std::ostream& operator<<(std::ostream& out, const base_uint<BITS>& u)
|
||||
{
|
||||
@@ -731,8 +730,6 @@ inline const uint160 operator^(const uint160& a, const uint160& b) { return (b
|
||||
inline const uint160 operator&(const uint160& a, const uint160& b) { return (base_uint160)a & (base_uint160)b; }
|
||||
inline const uint160 operator|(const uint160& a, const uint160& b) { return (base_uint160)a | (base_uint160)b; }
|
||||
|
||||
extern std::size_t hash_value(const uint160&);
|
||||
|
||||
inline const std::string strHex(const uint160& ui)
|
||||
{
|
||||
return strHex(ui.begin(), ui.size());
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
#ifndef __BITCOIN_UTIL__
|
||||
#define __BITCOIN_UTIL__
|
||||
|
||||
// TODO: these things should all go somewhere
|
||||
|
||||
#include <string>
|
||||
#include <openssl/ripemd.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
std::string strprintf(const char* format, ...);
|
||||
std::string FormatFullVersion();
|
||||
void RandAddSeedPerfmon();
|
||||
|
||||
#define loop for (;;)
|
||||
#define PAIR(t1, t2) pair<t1, t2>
|
||||
|
||||
#if !defined(WIN32) && !defined(WIN64)
|
||||
#define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
|
||||
#endif
|
||||
#ifndef RIPPLE_HASHUTILITIES_H
|
||||
#define RIPPLE_HASHUTILITIES_H
|
||||
|
||||
// VFALCO: NOTE, these came from BitcoinUtil.h
|
||||
|
||||
// VFALCO: TODO, Rewrite the callers so we don't need templates,
|
||||
// then define these in a .cpp so they are no longer inline.
|
||||
//
|
||||
template<typename T1>
|
||||
inline uint256 SHA256Hash(const T1 pbegin, const T1 pend)
|
||||
{
|
||||
@@ -1,4 +1,3 @@
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
InstanceType* InstanceType::sHeadInstance = NULL;
|
||||
bool InstanceType::sMultiThreaded = false;
|
||||
@@ -1,10 +1,9 @@
|
||||
#ifndef INSTANCE_COUNTER__H
|
||||
#define INSTANCE_COUNTER__H
|
||||
#ifndef RIPPLE_INSTANCECOUNTER_H
|
||||
#define RIPPLE_INSTANCECOUNTER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
// VFALCO: TODO Clean up this junk, remove the macros, replace
|
||||
// with a robust leak checker when we have atomics.
|
||||
//
|
||||
|
||||
#define DEFINE_INSTANCE(x) \
|
||||
extern InstanceType IT_##x; \
|
||||
@@ -23,6 +22,7 @@
|
||||
|
||||
#define IS_INSTANCE(x) Instance_##x
|
||||
|
||||
// VFALCO: NOTE, that this is just a glorified leak checker with an awkward API
|
||||
class InstanceType
|
||||
{
|
||||
protected:
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
{
|
||||
if (sMultiThreaded)
|
||||
{
|
||||
// VFALCO: NOTE, Junk that will go away with atomics
|
||||
mLock.lock();
|
||||
++mInstances;
|
||||
mLock.unlock();
|
||||
@@ -106,3 +106,77 @@ bool AddSystemEntropy()
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// "Never go to sea with two chronometers; take one or three."
|
||||
// Our three time sources are:
|
||||
// - System clock
|
||||
// - Median of other nodes's clocks
|
||||
// - The user (asking the user to fix the system clock if the first two disagree)
|
||||
//
|
||||
|
||||
void RandAddSeedPerfmon()
|
||||
{
|
||||
// VFALCO: This is how we simulate local functions
|
||||
struct
|
||||
{
|
||||
int64 operator() () const
|
||||
{
|
||||
return time (NULL);
|
||||
}
|
||||
} GetTime;
|
||||
|
||||
struct
|
||||
{
|
||||
void operator() ()
|
||||
{
|
||||
struct
|
||||
{
|
||||
// VFALCO: TODO, clean this up
|
||||
int64 operator() () const
|
||||
{
|
||||
int64 nCounter = 0;
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
|
||||
#else
|
||||
timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
nCounter = t.tv_sec * 1000000 + t.tv_usec;
|
||||
#endif
|
||||
return nCounter;
|
||||
}
|
||||
} GetPerformanceCounter;
|
||||
|
||||
// Seed with CPU performance counter
|
||||
int64 nCounter = GetPerformanceCounter();
|
||||
RAND_add(&nCounter, sizeof(nCounter), 1.5);
|
||||
memset(&nCounter, 0, sizeof(nCounter));
|
||||
}
|
||||
} RandAddSeed;
|
||||
|
||||
RandAddSeed();
|
||||
|
||||
// This can take up to 2 seconds, so only do it every 10 minutes
|
||||
static int64 nLastPerfmon;
|
||||
if (GetTime () < nLastPerfmon + 10 * 60)
|
||||
return;
|
||||
nLastPerfmon = GetTime ();
|
||||
|
||||
#ifdef WIN32
|
||||
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
|
||||
// Seed with the entire set of perfmon data
|
||||
unsigned char pdata[250000];
|
||||
memset(pdata, 0, sizeof(pdata));
|
||||
unsigned long nSize = sizeof(pdata);
|
||||
long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize);
|
||||
RegCloseKey(HKEY_PERFORMANCE_DATA);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
RAND_add(pdata, nSize, nSize/100.0);
|
||||
memset(pdata, 0, nSize);
|
||||
//printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -45,4 +45,7 @@ inline static void getRand (void *buf, int num)
|
||||
return getRand (reinterpret_cast<unsigned char *>(buf), num);
|
||||
}
|
||||
|
||||
// Lifted from BitcoinUtil.h
|
||||
extern void RandAddSeedPerfmon();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
#ifndef __SCOPEDLOCKHOLDER__
|
||||
#define __SCOPEDLOCKHOLDER__
|
||||
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#ifndef RIPPLE_SCOPEDLOCK_H
|
||||
#define RIPPLE_SCOPEDLOCK_H
|
||||
|
||||
typedef boost::recursive_mutex::scoped_lock ScopedLock;
|
||||
|
||||
// A lock holder that can be returned and copied by value
|
||||
// When the last reference goes away, the lock is released
|
||||
|
||||
// VFALCO: TODO, replace these with a more generic template, and not use boost
|
||||
//
|
||||
class SharedScopedLock
|
||||
{
|
||||
protected:
|
||||
@@ -33,6 +30,7 @@ protected:
|
||||
boost::recursive_mutex& mMutex;
|
||||
|
||||
public:
|
||||
// VFALCO: TODO, get rid of this unlock parameter to restore sanity
|
||||
ScopedUnlock(boost::recursive_mutex& mutex, bool unlock = true) : mUnlocked(unlock), mMutex(mutex)
|
||||
{
|
||||
if (unlock)
|
||||
@@ -1,4 +1,35 @@
|
||||
|
||||
#if !defined(WIN32) && !defined(WIN64)
|
||||
#define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
|
||||
#endif
|
||||
|
||||
std::string strprintf(const char* format, ...)
|
||||
{
|
||||
char buffer[50000];
|
||||
char* p = buffer;
|
||||
int limit = sizeof(buffer);
|
||||
int ret;
|
||||
for (;;)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, format);
|
||||
ret = _vsnprintf(p, limit, format, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
if (ret >= 0 && ret < limit)
|
||||
break;
|
||||
if (p != buffer)
|
||||
delete[] p;
|
||||
limit *= 2;
|
||||
p = new char[limit];
|
||||
if (p == NULL)
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
std::string str(p, p+ret);
|
||||
if (p != buffer)
|
||||
delete[] p;
|
||||
return str;
|
||||
}
|
||||
|
||||
char charHex(int iDigit)
|
||||
{
|
||||
return iDigit < 10 ? '0' + iDigit : 'A' - 10 + iDigit;
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern std::string strprintf(const char* format, ...);
|
||||
|
||||
extern std::string urlEncode(const std::string& strSrc);
|
||||
|
||||
template<class Iterator>
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "ripple_client.h"
|
||||
|
||||
#include "../ripple_data/ripple_data.h"
|
||||
|
||||
// VFALCO: TODO, fix these warnings!
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
|
||||
|
||||
185
modules/ripple_data/crypto/ripple_Base58.cpp
Normal file
185
modules/ripple_data/crypto/ripple_Base58.cpp
Normal file
@@ -0,0 +1,185 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin Developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
char const* Base58::s_currentAlphabet = Base58::getRippleAlphabet ();
|
||||
|
||||
char const* Base58::getCurrentAlphabet ()
|
||||
{
|
||||
return s_currentAlphabet;
|
||||
}
|
||||
|
||||
void Base58::setCurrentAlphabet (char const* alphabet)
|
||||
{
|
||||
s_currentAlphabet = alphabet;
|
||||
}
|
||||
|
||||
char const* Base58::getBitcoinAlphabet ()
|
||||
{
|
||||
return "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
}
|
||||
|
||||
char const* Base58::getRippleAlphabet ()
|
||||
{
|
||||
return "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz";
|
||||
}
|
||||
|
||||
char const* Base58::getTestnetAlphabet ()
|
||||
{
|
||||
return "RPShNAF39wBUDnEGHJKLM4pQrsT7VWXYZ2bcdeCg65jkm8ofqi1tuvaxyz";
|
||||
}
|
||||
|
||||
std::string Base58::encode (const unsigned char* pbegin, const unsigned char* pend)
|
||||
{
|
||||
char const* alphabet = getCurrentAlphabet ();
|
||||
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum bn58 = 58;
|
||||
CBigNum bn0 = 0;
|
||||
|
||||
// Convert big endian data to little endian
|
||||
// Extra zero at the end make sure bignum will interpret as a positive number
|
||||
std::vector<unsigned char> vchTmp(pend-pbegin+1, 0);
|
||||
std::reverse_copy(pbegin, pend, vchTmp.begin());
|
||||
|
||||
// Convert little endian data to bignum
|
||||
CBigNum bn(vchTmp);
|
||||
|
||||
// Convert bignum to std::string
|
||||
std::string str;
|
||||
// Expected size increase from base58 conversion is approximately 137%
|
||||
// use 138% to be safe
|
||||
str.reserve((pend - pbegin) * 138 / 100 + 1);
|
||||
CBigNum dv;
|
||||
CBigNum rem;
|
||||
while (bn > bn0)
|
||||
{
|
||||
if (!BN_div(&dv, &rem, &bn, &bn58, pctx))
|
||||
throw bignum_error("EncodeBase58 : BN_div failed");
|
||||
bn = dv;
|
||||
unsigned int c = rem.getuint();
|
||||
str += alphabet [c];
|
||||
}
|
||||
|
||||
// Leading zeroes encoded as base58 zeros
|
||||
for (const unsigned char* p = pbegin; p < pend && *p == 0; p++)
|
||||
str += alphabet [0];
|
||||
|
||||
// Convert little endian std::string to big endian
|
||||
reverse(str.begin(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string Base58::encode (const std::vector<unsigned char>& vch)
|
||||
{
|
||||
return encode (&vch[0], &vch[0] + vch.size());
|
||||
}
|
||||
|
||||
std::string Base58::encodeWithCheck (const std::vector<unsigned char>& vchIn)
|
||||
{
|
||||
// add 4-byte hash check to the end
|
||||
std::vector<unsigned char> vch(vchIn);
|
||||
uint256 hash = SHA256Hash(vch.begin(), vch.end());
|
||||
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
|
||||
return encode (vch);
|
||||
}
|
||||
|
||||
bool Base58::decode (const char* psz, std::vector<unsigned char>& vchRet, const char* pAlpha)
|
||||
{
|
||||
assert (pAlpha != 0);
|
||||
|
||||
CAutoBN_CTX pctx;
|
||||
vchRet.clear();
|
||||
CBigNum bn58 = 58;
|
||||
CBigNum bn = 0;
|
||||
CBigNum bnChar;
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
|
||||
// Convert big endian string to bignum
|
||||
for (const char* p = psz; *p; p++)
|
||||
{
|
||||
const char* p1 = strchr(pAlpha, *p);
|
||||
if (p1 == NULL)
|
||||
{
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
if (*p != '\0')
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
bnChar.setuint(p1 - pAlpha);
|
||||
if (!BN_mul(&bn, &bn, &bn58, pctx))
|
||||
throw bignum_error("DecodeBase58 : BN_mul failed");
|
||||
bn += bnChar;
|
||||
}
|
||||
|
||||
// Get bignum as little endian data
|
||||
std::vector<unsigned char> vchTmp = bn.getvch();
|
||||
|
||||
// Trim off sign byte if present
|
||||
if (vchTmp.size() >= 2 && vchTmp.end()[-1] == 0 && vchTmp.end()[-2] >= 0x80)
|
||||
vchTmp.erase(vchTmp.end()-1);
|
||||
|
||||
// Restore leading zeros
|
||||
int nLeadingZeros = 0;
|
||||
for (const char* p = psz; *p == pAlpha[0]; p++)
|
||||
nLeadingZeros++;
|
||||
vchRet.assign(nLeadingZeros + vchTmp.size(), 0);
|
||||
|
||||
// Convert little endian data to big endian
|
||||
std::reverse_copy(vchTmp.begin(), vchTmp.end(), vchRet.end() - vchTmp.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Base58::decode (const std::string& str, std::vector<unsigned char>& vchRet)
|
||||
{
|
||||
return decode (str.c_str(), vchRet);
|
||||
}
|
||||
|
||||
bool Base58::decodeWithCheck (const char* psz, std::vector<unsigned char>& vchRet, const char* pAlphabet)
|
||||
{
|
||||
if (pAlphabet == NULL)
|
||||
pAlphabet = s_currentAlphabet;
|
||||
if (!decode (psz, vchRet, pAlphabet))
|
||||
return false;
|
||||
if (vchRet.size() < 4)
|
||||
{
|
||||
vchRet.clear();
|
||||
return false;
|
||||
}
|
||||
uint256 hash = SHA256Hash(vchRet.begin(), vchRet.end()-4);
|
||||
if (memcmp(&hash, &vchRet.end()[-4], 4) != 0)
|
||||
{
|
||||
vchRet.clear();
|
||||
return false;
|
||||
}
|
||||
vchRet.resize(vchRet.size()-4);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Base58::decodeWithCheck (const std::string& str, std::vector<unsigned char>& vchRet, const char* pAlphabet)
|
||||
{
|
||||
return decodeWithCheck (str.c_str(), vchRet, pAlphabet);
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
61
modules/ripple_data/crypto/ripple_Base58.h
Normal file
61
modules/ripple_data/crypto/ripple_Base58.h
Normal file
@@ -0,0 +1,61 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin Developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
//
|
||||
// Why base-58 instead of standard base-64 encoding?
|
||||
// - Don't want 0OIl characters that look the same in some fonts and
|
||||
// could be used to create visually identical looking account numbers.
|
||||
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
|
||||
// - E-mail usually won't line-break if there's no punctuation to break at.
|
||||
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
|
||||
//
|
||||
#ifndef RIPPLE_BASE58_H
|
||||
#define RIPPLE_BASE58_H
|
||||
|
||||
/** Performs Base 58 encoding and decoding.
|
||||
*/
|
||||
class Base58
|
||||
{
|
||||
public:
|
||||
// VFALCO: TODO, clean up this poor API
|
||||
static char const* getCurrentAlphabet ();
|
||||
static void setCurrentAlphabet (char const* alphabet);
|
||||
|
||||
static char const* getBitcoinAlphabet ();
|
||||
static char const* getRippleAlphabet ();
|
||||
static char const* getTestnetAlphabet ();
|
||||
|
||||
static std::string encode (const unsigned char* pbegin, const unsigned char* pend);
|
||||
static std::string encode (const std::vector<unsigned char>& vch);
|
||||
static std::string encodeWithCheck (const std::vector<unsigned char>& vchIn);
|
||||
|
||||
static bool decode (const char* psz, std::vector<unsigned char>& vchRet, const char* pAlphabet=getCurrentAlphabet ());
|
||||
static bool decode (const std::string& str, std::vector<unsigned char>& vchRet);
|
||||
static bool decodeWithCheck (const char* psz, std::vector<unsigned char>& vchRet, const char* pAlphabet=getCurrentAlphabet ());
|
||||
static bool decodeWithCheck (const std::string& str, std::vector<unsigned char>& vchRet, const char* pAlphabet);
|
||||
|
||||
private:
|
||||
static char const* s_currentAlphabet;
|
||||
};
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
110
modules/ripple_data/crypto/ripple_Base58Data.cpp
Normal file
110
modules/ripple_data/crypto/ripple_Base58Data.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin Developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
//
|
||||
// Why base-58 instead of standard base-64 encoding?
|
||||
// - Don't want 0OIl characters that look the same in some fonts and
|
||||
// could be used to create visually identical looking account numbers.
|
||||
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
|
||||
// - E-mail usually won't line-break if there's no punctuation to break at.
|
||||
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
|
||||
//
|
||||
|
||||
CBase58Data::CBase58Data()
|
||||
: nVersion(1)
|
||||
{
|
||||
}
|
||||
|
||||
CBase58Data::~CBase58Data()
|
||||
{
|
||||
if (!vchData.empty())
|
||||
memset(&vchData[0], 0, vchData.size());
|
||||
}
|
||||
|
||||
void CBase58Data::SetData(int nVersionIn, const std::vector<unsigned char>& vchDataIn)
|
||||
{
|
||||
nVersion = nVersionIn;
|
||||
vchData = vchDataIn;
|
||||
}
|
||||
|
||||
void CBase58Data::SetData(int nVersionIn, const void* pdata, size_t nSize)
|
||||
{
|
||||
nVersion = nVersionIn;
|
||||
vchData.resize(nSize);
|
||||
if (nSize)
|
||||
memcpy(&vchData[0], pdata, nSize);
|
||||
}
|
||||
|
||||
void CBase58Data::SetData(int nVersionIn, const unsigned char *pbegin, const unsigned char *pend)
|
||||
{
|
||||
SetData(nVersionIn, (void*)pbegin, pend - pbegin);
|
||||
}
|
||||
|
||||
bool CBase58Data::SetString(const char* psz, unsigned char version, const char* pAlphabet)
|
||||
{
|
||||
std::vector<unsigned char> vchTemp;
|
||||
Base58::decodeWithCheck (psz, vchTemp, pAlphabet);
|
||||
if (vchTemp.empty() || vchTemp[0] != version)
|
||||
{
|
||||
vchData.clear();
|
||||
nVersion = 1;
|
||||
return false;
|
||||
}
|
||||
nVersion = vchTemp[0];
|
||||
vchData.resize(vchTemp.size() - 1);
|
||||
if (!vchData.empty())
|
||||
memcpy(&vchData[0], &vchTemp[1], vchData.size());
|
||||
memset(&vchTemp[0], 0, vchTemp.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBase58Data::SetString(const std::string& str, unsigned char version)
|
||||
{
|
||||
return SetString(str.c_str(), version);
|
||||
}
|
||||
|
||||
std::string CBase58Data::ToString() const
|
||||
{
|
||||
std::vector<unsigned char> vch(1, nVersion);
|
||||
|
||||
vch.insert(vch.end(), vchData.begin(), vchData.end());
|
||||
|
||||
return Base58::encodeWithCheck (vch);
|
||||
}
|
||||
|
||||
int CBase58Data::CompareTo(const CBase58Data& b58) const
|
||||
{
|
||||
if (nVersion < b58.nVersion) return -1;
|
||||
if (nVersion > b58.nVersion) return 1;
|
||||
if (vchData < b58.vchData) return -1;
|
||||
if (vchData > b58.vchData) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CBase58Data::operator==(const CBase58Data& b58) const { return CompareTo(b58) == 0; }
|
||||
bool CBase58Data::operator!=(const CBase58Data& b58) const { return CompareTo(b58) != 0; }
|
||||
bool CBase58Data::operator<=(const CBase58Data& b58) const { return CompareTo(b58) <= 0; }
|
||||
bool CBase58Data::operator>=(const CBase58Data& b58) const { return CompareTo(b58) >= 0; }
|
||||
bool CBase58Data::operator< (const CBase58Data& b58) const { return CompareTo(b58) < 0; }
|
||||
bool CBase58Data::operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
|
||||
|
||||
// vim:ts=4
|
||||
65
modules/ripple_data/crypto/ripple_Base58Data.h
Normal file
65
modules/ripple_data/crypto/ripple_Base58Data.h
Normal file
@@ -0,0 +1,65 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin Developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
//
|
||||
// Why base-58 instead of standard base-64 encoding?
|
||||
// - Don't want 0OIl characters that look the same in some fonts and
|
||||
// could be used to create visually identical looking account numbers.
|
||||
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
|
||||
// - E-mail usually won't line-break if there's no punctuation to break at.
|
||||
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
|
||||
//
|
||||
#ifndef RIPPLE_BASE58DATA_H
|
||||
#define RIPPLE_BASE58DATA_H
|
||||
|
||||
class CBase58Data
|
||||
{
|
||||
protected:
|
||||
unsigned char nVersion;
|
||||
std::vector<unsigned char> vchData;
|
||||
|
||||
CBase58Data();
|
||||
~CBase58Data();
|
||||
|
||||
void SetData(int nVersionIn, const std::vector<unsigned char>& vchDataIn);
|
||||
void SetData(int nVersionIn, const void* pdata, size_t nSize);
|
||||
void SetData(int nVersionIn, const unsigned char *pbegin, const unsigned char *pend);
|
||||
|
||||
public:
|
||||
bool SetString(const char* psz, unsigned char version, const char* pAlphabet = 0);
|
||||
bool SetString(const std::string& str, unsigned char version);
|
||||
|
||||
std::string ToString() const;
|
||||
int CompareTo(const CBase58Data& b58) const;
|
||||
|
||||
bool operator==(const CBase58Data& b58) const;
|
||||
bool operator!=(const CBase58Data& b58) const;
|
||||
bool operator<=(const CBase58Data& b58) const;
|
||||
bool operator>=(const CBase58Data& b58) const;
|
||||
bool operator< (const CBase58Data& b58) const;
|
||||
bool operator> (const CBase58Data& b58) const;
|
||||
|
||||
friend std::size_t hash_value(const CBase58Data& b58);
|
||||
};
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
530
modules/ripple_data/crypto/ripple_CBigNum.cpp
Normal file
530
modules/ripple_data/crypto/ripple_CBigNum.cpp
Normal file
@@ -0,0 +1,530 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
CBigNum::CBigNum()
|
||||
{
|
||||
BN_init(this);
|
||||
}
|
||||
|
||||
CBigNum::CBigNum(const CBigNum& b)
|
||||
{
|
||||
BN_init(this);
|
||||
if (!BN_copy(this, &b))
|
||||
{
|
||||
BN_clear_free(this);
|
||||
throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_copy failed");
|
||||
}
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator=(const CBigNum& b)
|
||||
{
|
||||
if (!BN_copy(this, &b))
|
||||
throw bignum_error("CBigNum::operator= : BN_copy failed");
|
||||
return (*this);
|
||||
}
|
||||
|
||||
CBigNum::~CBigNum()
|
||||
{
|
||||
BN_clear_free(this);
|
||||
}
|
||||
|
||||
CBigNum::CBigNum(char n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum::CBigNum(short n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum::CBigNum(int n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum::CBigNum(long n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum::CBigNum(int64 n) { BN_init(this); setint64(n); }
|
||||
CBigNum::CBigNum(unsigned char n) { BN_init(this); setulong(n); }
|
||||
CBigNum::CBigNum(unsigned short n) { BN_init(this); setulong(n); }
|
||||
CBigNum::CBigNum(unsigned int n) { BN_init(this); setulong(n); }
|
||||
CBigNum::CBigNum(uint64 n) { BN_init(this); setuint64(n); }
|
||||
CBigNum::CBigNum(uint256 n) { BN_init(this); setuint256(n); }
|
||||
|
||||
CBigNum::CBigNum(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
BN_init(this);
|
||||
setvch(vch);
|
||||
}
|
||||
|
||||
void CBigNum::setuint(unsigned int n)
|
||||
{
|
||||
setulong(static_cast<unsigned long>(n));
|
||||
}
|
||||
|
||||
unsigned int CBigNum::getuint() const
|
||||
{
|
||||
return BN_get_word(this);
|
||||
}
|
||||
|
||||
int CBigNum::getint() const
|
||||
{
|
||||
unsigned long n = BN_get_word(this);
|
||||
if (!BN_is_negative(this))
|
||||
return (n > INT_MAX ? INT_MAX : n);
|
||||
else
|
||||
return (n > INT_MAX ? INT_MIN : -(int)n);
|
||||
}
|
||||
|
||||
void CBigNum::setint64(int64 n)
|
||||
{
|
||||
unsigned char pch[sizeof(n) + 6];
|
||||
unsigned char* p = pch + 4;
|
||||
bool fNegative = false;
|
||||
if (n < (int64)0)
|
||||
{
|
||||
n = -n;
|
||||
fNegative = true;
|
||||
}
|
||||
bool fLeadingZeroes = true;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char c = (n >> 56) & 0xff;
|
||||
n <<= 8;
|
||||
if (fLeadingZeroes)
|
||||
{
|
||||
if (c == 0)
|
||||
continue;
|
||||
if (c & 0x80)
|
||||
*p++ = (fNegative ? 0x80 : 0);
|
||||
else if (fNegative)
|
||||
c |= 0x80;
|
||||
fLeadingZeroes = false;
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
unsigned int nSize = p - (pch + 4);
|
||||
pch[0] = (nSize >> 24) & 0xff;
|
||||
pch[1] = (nSize >> 16) & 0xff;
|
||||
pch[2] = (nSize >> 8) & 0xff;
|
||||
pch[3] = (nSize) & 0xff;
|
||||
BN_mpi2bn(pch, p - pch, this);
|
||||
}
|
||||
|
||||
uint64 CBigNum::getuint64() const
|
||||
{
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
return static_cast<uint64>(getulong());
|
||||
#else
|
||||
int len = BN_num_bytes(this);
|
||||
if (len > 8)
|
||||
throw std::runtime_error("BN getuint64 overflow");
|
||||
|
||||
unsigned char buf[8];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
BN_bn2bin(this, buf + 8 - len);
|
||||
return
|
||||
static_cast<uint64>(buf[0]) << 56 | static_cast<uint64>(buf[1]) << 48 |
|
||||
static_cast<uint64>(buf[2]) << 40 | static_cast<uint64>(buf[3]) << 32 |
|
||||
static_cast<uint64>(buf[4]) << 24 | static_cast<uint64>(buf[5]) << 16 |
|
||||
static_cast<uint64>(buf[6]) << 8 | static_cast<uint64>(buf[7]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CBigNum::setuint64(uint64 n)
|
||||
{
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
setulong(static_cast<unsigned long>(n));
|
||||
#else
|
||||
unsigned char buf[8];
|
||||
buf[0] = static_cast<unsigned char>((n >> 56) & 0xff);
|
||||
buf[1] = static_cast<unsigned char>((n >> 48) & 0xff);
|
||||
buf[2] = static_cast<unsigned char>((n >> 40) & 0xff);
|
||||
buf[3] = static_cast<unsigned char>((n >> 32) & 0xff);
|
||||
buf[4] = static_cast<unsigned char>((n >> 24) & 0xff);
|
||||
buf[5] = static_cast<unsigned char>((n >> 16) & 0xff);
|
||||
buf[6] = static_cast<unsigned char>((n >> 8) & 0xff);
|
||||
buf[7] = static_cast<unsigned char>((n) & 0xff);
|
||||
BN_bin2bn(buf, 8, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CBigNum::setuint256(const uint256& n)
|
||||
{
|
||||
BN_bin2bn(n.begin(), n.size(), NULL);
|
||||
}
|
||||
|
||||
uint256 CBigNum::getuint256()
|
||||
{
|
||||
uint256 ret;
|
||||
unsigned int size = BN_num_bytes(this);
|
||||
if (size > ret.size())
|
||||
return ret;
|
||||
BN_bn2bin(this, ret.begin() + (ret.size() - BN_num_bytes(this)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CBigNum::setvch(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
std::vector<unsigned char> vch2(vch.size() + 4);
|
||||
unsigned int nSize = vch.size();
|
||||
// BIGNUM's byte stream format expects 4 bytes of
|
||||
// big endian size data info at the front
|
||||
vch2[0] = (nSize >> 24) & 0xff;
|
||||
vch2[1] = (nSize >> 16) & 0xff;
|
||||
vch2[2] = (nSize >> 8) & 0xff;
|
||||
vch2[3] = (nSize >> 0) & 0xff;
|
||||
// swap data to big endian
|
||||
std::reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
|
||||
BN_mpi2bn(&vch2[0], vch2.size(), this);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> CBigNum::getvch() const
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
if (nSize < 4)
|
||||
return std::vector<unsigned char>();
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
vch.erase(vch.begin(), vch.begin() + 4);
|
||||
reverse(vch.begin(), vch.end());
|
||||
return vch;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::SetCompact(unsigned int nCompact)
|
||||
{
|
||||
unsigned int nSize = nCompact >> 24;
|
||||
std::vector<unsigned char> vch(4 + nSize);
|
||||
vch[3] = nSize;
|
||||
if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff;
|
||||
if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff;
|
||||
if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff;
|
||||
BN_mpi2bn(&vch[0], vch.size(), this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned int CBigNum::GetCompact() const
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
nSize -= 4;
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
unsigned int nCompact = nSize << 24;
|
||||
if (nSize >= 1) nCompact |= (vch[4] << 16);
|
||||
if (nSize >= 2) nCompact |= (vch[5] << 8);
|
||||
if (nSize >= 3) nCompact |= (vch[6] << 0);
|
||||
return nCompact;
|
||||
}
|
||||
|
||||
void CBigNum::SetHex(const std::string& str)
|
||||
{
|
||||
// skip 0x
|
||||
const char* psz = str.c_str();
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
bool fNegative = false;
|
||||
if (*psz == '-')
|
||||
{
|
||||
fNegative = true;
|
||||
psz++;
|
||||
}
|
||||
if (psz[0] == '0' && tolower(psz[1]) == 'x')
|
||||
psz += 2;
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
|
||||
// hex string to bignum
|
||||
static char phexdigit[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,
|
||||
0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
|
||||
*this = 0;
|
||||
while (isxdigit(*psz))
|
||||
{
|
||||
*this <<= 4;
|
||||
int n = phexdigit[(int) *psz++];
|
||||
*this += n;
|
||||
}
|
||||
if (fNegative)
|
||||
*this = 0 - *this;
|
||||
}
|
||||
|
||||
std::string CBigNum::ToString(int nBase) const
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum bnBase = nBase;
|
||||
CBigNum bn0 = 0;
|
||||
std::string str;
|
||||
CBigNum bn = *this;
|
||||
BN_set_negative(&bn, false);
|
||||
CBigNum dv;
|
||||
CBigNum rem;
|
||||
if (BN_cmp(&bn, &bn0) == 0)
|
||||
return "0";
|
||||
while (BN_cmp(&bn, &bn0) > 0)
|
||||
{
|
||||
if (!BN_div(&dv, &rem, &bn, &bnBase, pctx))
|
||||
throw bignum_error("CBigNum::ToString() : BN_div failed");
|
||||
bn = dv;
|
||||
unsigned int c = rem.getuint();
|
||||
str += "0123456789abcdef"[c];
|
||||
}
|
||||
if (BN_is_negative(this))
|
||||
str += "-";
|
||||
reverse(str.begin(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string CBigNum::GetHex() const
|
||||
{
|
||||
return ToString(16);
|
||||
}
|
||||
|
||||
bool CBigNum::operator!() const
|
||||
{
|
||||
return BN_is_zero(this);
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator+=(const CBigNum& b)
|
||||
{
|
||||
if (!BN_add(this, this, &b))
|
||||
throw bignum_error("CBigNum::operator+= : BN_add failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator-=(const CBigNum& b)
|
||||
{
|
||||
*this = *this - b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator*=(const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
if (!BN_mul(this, this, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator*= : BN_mul failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator/=(const CBigNum& b)
|
||||
{
|
||||
*this = *this / b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator%=(const CBigNum& b)
|
||||
{
|
||||
*this = *this % b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator<<=(unsigned int shift)
|
||||
{
|
||||
if (!BN_lshift(this, this, shift))
|
||||
throw bignum_error("CBigNum:operator<<= : BN_lshift failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator>>=(unsigned int shift)
|
||||
{
|
||||
// Note: BN_rshift segfaults on 64-bit if 2^shift is greater than the number
|
||||
// if built on ubuntu 9.04 or 9.10, probably depends on version of openssl
|
||||
CBigNum a = 1;
|
||||
a <<= shift;
|
||||
if (BN_cmp(&a, this) > 0)
|
||||
{
|
||||
*this = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (!BN_rshift(this, this, shift))
|
||||
throw bignum_error("CBigNum:operator>>= : BN_rshift failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
CBigNum& CBigNum::operator++()
|
||||
{
|
||||
// prefix operator
|
||||
if (!BN_add(this, this, BN_value_one()))
|
||||
throw bignum_error("CBigNum::operator++ : BN_add failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CBigNum CBigNum::operator++(int)
|
||||
{
|
||||
// postfix operator
|
||||
const CBigNum ret = *this;
|
||||
++(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CBigNum& CBigNum::operator--()
|
||||
{
|
||||
// prefix operator
|
||||
CBigNum r;
|
||||
if (!BN_sub(&r, this, BN_value_one()))
|
||||
throw bignum_error("CBigNum::operator-- : BN_sub failed");
|
||||
*this = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CBigNum CBigNum::operator--(int)
|
||||
{
|
||||
// postfix operator
|
||||
const CBigNum ret = *this;
|
||||
--(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CBigNum::setulong(unsigned long n)
|
||||
{
|
||||
if (!BN_set_word(this, n))
|
||||
throw bignum_error("CBigNum conversion from unsigned long : BN_set_word failed");
|
||||
}
|
||||
|
||||
unsigned long CBigNum::getulong() const
|
||||
{
|
||||
return BN_get_word(this);
|
||||
}
|
||||
|
||||
const CBigNum operator+(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_add(&r, &a, &b))
|
||||
throw bignum_error("CBigNum::operator+ : BN_add failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
const CBigNum operator-(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_sub(&r, &a, &b))
|
||||
throw bignum_error("CBigNum::operator- : BN_sub failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
const CBigNum operator-(const CBigNum& a)
|
||||
{
|
||||
CBigNum r(a);
|
||||
BN_set_negative(&r, !BN_is_negative(&r));
|
||||
return r;
|
||||
}
|
||||
|
||||
const CBigNum operator*(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_mul(&r, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator* : BN_mul failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
const CBigNum operator/(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_div(&r, NULL, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator/ : BN_div failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
const CBigNum operator%(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_mod(&r, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator% : BN_div failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
const CBigNum operator<<(const CBigNum& a, unsigned int shift)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_lshift(&r, &a, shift))
|
||||
throw bignum_error("CBigNum:operator<< : BN_lshift failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
const CBigNum operator>>(const CBigNum& a, unsigned int shift)
|
||||
{
|
||||
CBigNum r = a;
|
||||
r >>= shift;
|
||||
return r;
|
||||
}
|
||||
|
||||
bool operator== (const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
return (BN_cmp(&a, &b) == 0);
|
||||
}
|
||||
|
||||
bool operator!= (const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
return (BN_cmp(&a, &b) != 0);
|
||||
}
|
||||
|
||||
bool operator<= (const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
return (BN_cmp(&a, &b) <= 0);
|
||||
}
|
||||
|
||||
bool operator>= (const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
return (BN_cmp(&a, &b) >= 0);
|
||||
}
|
||||
|
||||
bool operator< (const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
return (BN_cmp(&a, &b) < 0);
|
||||
}
|
||||
|
||||
bool operator> (const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
return (BN_cmp(&a, &b) > 0);
|
||||
}
|
||||
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
|
||||
int BN_add_word64 (BIGNUM* bn, uint64 word)
|
||||
{
|
||||
return BN_add_word(bn, word);
|
||||
}
|
||||
|
||||
int BN_sub_word64 (BIGNUM* bn, uint64 word)
|
||||
{
|
||||
return BN_sub_word(bn, word);
|
||||
}
|
||||
|
||||
int BN_mul_word64 (BIGNUM* bn, uint64 word)
|
||||
{
|
||||
return BN_mul_word(bn, word);
|
||||
}
|
||||
|
||||
uint64 BN_div_word64 (BIGNUM* bn, uint64 word)
|
||||
{
|
||||
return BN_div_word(bn, word);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int BN_add_word64 (BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
return BN_add(a, &bn, a);
|
||||
}
|
||||
|
||||
int BN_sub_word64 (BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
return BN_sub(a, &bn, a);
|
||||
}
|
||||
|
||||
int BN_mul_word64 (BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
CAutoBN_CTX ctx;
|
||||
return BN_mul(a, &bn, a, ctx);
|
||||
}
|
||||
|
||||
uint64 BN_div_word64 (BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
CAutoBN_CTX ctx;
|
||||
return (BN_div(a, NULL, a, &bn, ctx) == 1) ? 0 : ((uint64)-1);
|
||||
}
|
||||
|
||||
#endif
|
||||
151
modules/ripple_data/crypto/ripple_CBigNum.h
Normal file
151
modules/ripple_data/crypto/ripple_CBigNum.h
Normal file
@@ -0,0 +1,151 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_CBIGNUM_H
|
||||
#define RIPPLE_CBIGNUM_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class bignum_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bignum_error(const std::string& str) : std::runtime_error(str) {}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class CAutoBN_CTX
|
||||
{
|
||||
private:
|
||||
CAutoBN_CTX(const CAutoBN_CTX&); // no implementation
|
||||
CAutoBN_CTX& operator=(const CAutoBN_CTX&); // no implementation
|
||||
|
||||
protected:
|
||||
BN_CTX* pctx;
|
||||
CAutoBN_CTX& operator=(BN_CTX* pnew) { pctx = pnew; return *this; }
|
||||
|
||||
public:
|
||||
CAutoBN_CTX()
|
||||
{
|
||||
pctx = BN_CTX_new();
|
||||
if (pctx == NULL)
|
||||
throw bignum_error("CAutoBN_CTX : BN_CTX_new() returned NULL");
|
||||
}
|
||||
|
||||
~CAutoBN_CTX()
|
||||
{
|
||||
if (pctx != NULL)
|
||||
BN_CTX_free(pctx);
|
||||
}
|
||||
|
||||
operator BN_CTX*() { return pctx; }
|
||||
BN_CTX& operator*() { return *pctx; }
|
||||
BN_CTX** operator&() { return &pctx; }
|
||||
bool operator!() { return (pctx == NULL); }
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO: TODO figure out a way to remove the dependency on openssl in the
|
||||
// header. Maybe rewrite this to use cryptopp.
|
||||
|
||||
class CBigNum : public BIGNUM
|
||||
{
|
||||
public:
|
||||
CBigNum();
|
||||
CBigNum(const CBigNum& b);
|
||||
CBigNum& operator=(const CBigNum& b);
|
||||
CBigNum(char n);
|
||||
CBigNum(short n);
|
||||
CBigNum(int n);
|
||||
CBigNum(long n);
|
||||
CBigNum(int64 n);
|
||||
CBigNum(unsigned char n);
|
||||
CBigNum(unsigned short n);
|
||||
CBigNum(unsigned int n);
|
||||
CBigNum(uint64 n);
|
||||
explicit CBigNum(uint256 n);
|
||||
explicit CBigNum(const std::vector<unsigned char>& vch);
|
||||
~CBigNum();
|
||||
|
||||
void setuint(unsigned int n);
|
||||
unsigned int getuint() const;
|
||||
int getint() const;
|
||||
void setint64(int64 n);
|
||||
uint64 getuint64() const;
|
||||
void setuint64(uint64 n);
|
||||
void setuint256(const uint256& n);
|
||||
uint256 getuint256();
|
||||
void setvch(const std::vector<unsigned char>& vch);
|
||||
std::vector<unsigned char> getvch() const;
|
||||
CBigNum& SetCompact(unsigned int nCompact);
|
||||
unsigned int GetCompact() const;
|
||||
void SetHex(const std::string& str);
|
||||
std::string ToString(int nBase=10) const;
|
||||
std::string GetHex() const;
|
||||
bool operator!() const;
|
||||
CBigNum& operator+=(const CBigNum& b);
|
||||
CBigNum& operator-=(const CBigNum& b);
|
||||
CBigNum& operator*=(const CBigNum& b);
|
||||
CBigNum& operator/=(const CBigNum& b);
|
||||
CBigNum& operator%=(const CBigNum& b);
|
||||
CBigNum& operator<<=(unsigned int shift);
|
||||
CBigNum& operator>>=(unsigned int shift);
|
||||
CBigNum& operator++();
|
||||
CBigNum& operator--();
|
||||
const CBigNum operator++(int);
|
||||
const CBigNum operator--(int);
|
||||
|
||||
friend inline const CBigNum operator-(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator/(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator%(const CBigNum& a, const CBigNum& b);
|
||||
|
||||
private:
|
||||
// private because the size of an unsigned long varies by platform
|
||||
|
||||
void setulong(unsigned long n);
|
||||
unsigned long getulong() const;
|
||||
};
|
||||
|
||||
const CBigNum operator+(const CBigNum& a, const CBigNum& b);
|
||||
const CBigNum operator-(const CBigNum& a, const CBigNum& b);
|
||||
const CBigNum operator-(const CBigNum& a);
|
||||
const CBigNum operator*(const CBigNum& a, const CBigNum& b);
|
||||
const CBigNum operator/(const CBigNum& a, const CBigNum& b);
|
||||
const CBigNum operator%(const CBigNum& a, const CBigNum& b);
|
||||
const CBigNum operator<<(const CBigNum& a, unsigned int shift);
|
||||
const CBigNum operator>>(const CBigNum& a, unsigned int shift);
|
||||
|
||||
bool operator==(const CBigNum& a, const CBigNum& b);
|
||||
bool operator!=(const CBigNum& a, const CBigNum& b);
|
||||
bool operator<=(const CBigNum& a, const CBigNum& b);
|
||||
bool operator>=(const CBigNum& a, const CBigNum& b);
|
||||
bool operator<(const CBigNum& a, const CBigNum& b);
|
||||
bool operator>(const CBigNum& a, const CBigNum& b);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO: NOTE, this seems as good a place as any for this.
|
||||
|
||||
// Here's the old implementation using macros, in case something broke
|
||||
//#if (ULONG_MAX > UINT_MAX)
|
||||
//#define BN_add_word64(bn, word) BN_add_word(bn, word)
|
||||
//#define BN_sub_word64(bn, word) BN_sub_word(bn, word)
|
||||
//#define BN_mul_word64(bn, word) BN_mul_word(bn, word)
|
||||
//#define BN_div_word64(bn, word) BN_div_word(bn, word)
|
||||
//#endif
|
||||
|
||||
// VFALCO: I believe only STAmount uses these
|
||||
extern int BN_add_word64 (BIGNUM *a, uint64 w);
|
||||
extern int BN_sub_word64 (BIGNUM *a, uint64 w);
|
||||
extern int BN_mul_word64 (BIGNUM *a, uint64 w);
|
||||
extern uint64 BN_div_word64 (BIGNUM *a, uint64 w);
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
7
modules/ripple_data/crypto/ripple_CKey.cpp
Normal file
7
modules/ripple_data/crypto/ripple_CKey.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
// VFALCO: TODO, move inlined stuff from CKey into here
|
||||
@@ -1,21 +1,27 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
#ifndef BITCOIN_KEY_H
|
||||
#define BITCOIN_KEY_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "RippleAddress.h"
|
||||
#ifndef RIPPLE_CKEY_H
|
||||
#define RIPPLE_CKEY_H
|
||||
|
||||
// secp256k1:
|
||||
// const unsigned int PRIVATE_KEY_SIZE = 279;
|
||||
@@ -26,6 +32,8 @@
|
||||
// see www.keylength.com
|
||||
// script supports up to 75 for single byte push
|
||||
|
||||
// VFALCO: NOTE, this is unused
|
||||
/*
|
||||
int static inline EC_KEY_regenerate_key(EC_KEY *eckey, BIGNUM *priv_key)
|
||||
{
|
||||
int okay = 0;
|
||||
@@ -62,7 +70,7 @@ err:
|
||||
|
||||
return (okay);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
class key_error : public std::runtime_error
|
||||
{
|
||||
@@ -70,11 +78,6 @@ public:
|
||||
explicit key_error(const std::string& str) : std::runtime_error(str) {}
|
||||
};
|
||||
|
||||
//JED: typedef std::vector<unsigned char, secure_allocator<unsigned char> > CPrivKey;
|
||||
//typedef std::vector<unsigned char, secure_allocator<unsigned char> > CSecret;
|
||||
|
||||
typedef std::vector<unsigned char> CPrivKey;
|
||||
typedef std::vector<unsigned char> CSecret;
|
||||
class CKey
|
||||
{
|
||||
protected:
|
||||
@@ -1,18 +1,8 @@
|
||||
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
// #define EC_DEBUG
|
||||
|
||||
// Functions to add CKey support for deterministic EC keys
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "Serializer.h"
|
||||
|
||||
// <-- seed
|
||||
uint128 CKey::PassPhraseToKey(const std::string& passPhrase)
|
||||
{
|
||||
@@ -1,14 +1,3 @@
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
#include "key.h"
|
||||
|
||||
// ECIES uses elliptic curve keys to send an encrypted message.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// RFC 1751 code converted to C++/Boost.
|
||||
//
|
||||
|
||||
// VFALCO: TODO, move these
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@@ -11,7 +12,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
static const char* pcDict[2048] = {
|
||||
char const* RFC1751::s_dictionary [2048] = {
|
||||
"A", "ABE", "ACE", "ACT", "AD", "ADA", "ADD",
|
||||
"AGO", "AID", "AIM", "AIR", "ALL", "ALP", "AM", "AMY", "AN", "ANA",
|
||||
"AND", "ANN", "ANT", "ANY", "APE", "APS", "APT", "ARC", "ARE", "ARK",
|
||||
@@ -238,7 +239,7 @@ static const char* pcDict[2048] = {
|
||||
|
||||
/* Extract 'length' bits from the char array 's'
|
||||
starting with bit 'start' */
|
||||
static unsigned long extract(char *s, int start, int length)
|
||||
unsigned long RFC1751::extract(char *s, int start, int length)
|
||||
{
|
||||
unsigned char cl;
|
||||
unsigned char cc;
|
||||
@@ -263,7 +264,7 @@ static unsigned long extract(char *s, int start, int length)
|
||||
|
||||
// Encode 8 bytes in 'c' as a string of English words.
|
||||
// Returns a pointer to a static buffer
|
||||
static void btoe(std::string& strHuman, const std::string& strData)
|
||||
void RFC1751::btoe(std::string& strHuman, const std::string& strData)
|
||||
{
|
||||
char caBuffer[9]; /* add in room for the parity 2 bits*/
|
||||
int p, i;
|
||||
@@ -277,15 +278,15 @@ static void btoe(std::string& strHuman, const std::string& strData)
|
||||
caBuffer[8] = char(p) << 6;
|
||||
|
||||
strHuman = std::string()
|
||||
+ pcDict[extract(caBuffer, 0, 11)] + " "
|
||||
+ pcDict[extract(caBuffer, 11, 11)] + " "
|
||||
+ pcDict[extract(caBuffer, 22, 11)] + " "
|
||||
+ pcDict[extract(caBuffer, 33, 11)] + " "
|
||||
+ pcDict[extract(caBuffer, 44, 11)] + " "
|
||||
+ pcDict[extract(caBuffer, 55, 11)];
|
||||
+ s_dictionary[extract(caBuffer, 0, 11)] + " "
|
||||
+ s_dictionary[extract(caBuffer, 11, 11)] + " "
|
||||
+ s_dictionary[extract(caBuffer, 22, 11)] + " "
|
||||
+ s_dictionary[extract(caBuffer, 33, 11)] + " "
|
||||
+ s_dictionary[extract(caBuffer, 44, 11)] + " "
|
||||
+ s_dictionary[extract(caBuffer, 55, 11)];
|
||||
}
|
||||
|
||||
static void insert(char *s, int x, int start, int length)
|
||||
void RFC1751::insert(char *s, int x, int start, int length)
|
||||
{
|
||||
unsigned char cl;
|
||||
unsigned char cc;
|
||||
@@ -315,7 +316,7 @@ static void insert(char *s, int x, int start, int length)
|
||||
}
|
||||
}
|
||||
|
||||
static void standard(std::string& strWord)
|
||||
void RFC1751::standard(std::string& strWord)
|
||||
{
|
||||
BOOST_FOREACH(char cLetter, strWord)
|
||||
{
|
||||
@@ -343,7 +344,7 @@ static void standard(std::string& strWord)
|
||||
}
|
||||
|
||||
// Binary search of dictionary.
|
||||
static int wsrch(const std::string& strWord, int iMin, int iMax)
|
||||
int RFC1751::wsrch (const std::string& strWord, int iMin, int iMax)
|
||||
{
|
||||
int iResult = -1;
|
||||
|
||||
@@ -351,7 +352,7 @@ static int wsrch(const std::string& strWord, int iMin, int iMax)
|
||||
{
|
||||
// Have a range to search.
|
||||
int iMid = iMin+(iMax-iMin)/2;
|
||||
int iDir = strWord.compare(pcDict[iMid]);
|
||||
int iDir = strWord.compare(s_dictionary[iMid]);
|
||||
|
||||
if (!iDir)
|
||||
{
|
||||
@@ -376,7 +377,7 @@ static int wsrch(const std::string& strWord, int iMin, int iMax)
|
||||
// 0 word not in data base
|
||||
// -1 badly formed in put ie > 4 char word
|
||||
// -2 words OK but parity is wrong
|
||||
static int etob(std::string& strData, std::vector<std::string> vsHuman)
|
||||
int RFC1751::etob (std::string& strData, std::vector<std::string> vsHuman)
|
||||
{
|
||||
int i, p, v,l;
|
||||
char b[9];
|
||||
@@ -393,7 +394,7 @@ static int etob(std::string& strData, std::vector<std::string> vsHuman)
|
||||
if(l > 4 || l < 1)
|
||||
return -1;
|
||||
|
||||
standard(strWord);
|
||||
standard (strWord);
|
||||
|
||||
v = wsrch(strWord,
|
||||
l < 4 ? 0 : 571,
|
||||
@@ -418,13 +419,15 @@ static int etob(std::string& strData, std::vector<std::string> vsHuman)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// eng2key() convert words seperated by spaces into a 128 bit key in big-endian format.
|
||||
// eng2key() returns
|
||||
// 1 if succeeded
|
||||
// 0 if word not in dictionary
|
||||
// -1 if badly formed string
|
||||
// -2 if words are okay but parity is wrong.
|
||||
int eng2key(std::string& strKey, const std::string& strHuman)
|
||||
/** Convert words seperated by spaces into a 128 bit key in big-endian format.
|
||||
|
||||
@return
|
||||
1 if succeeded
|
||||
0 if word not in dictionary
|
||||
-1 if badly formed string
|
||||
-2 if words are okay but parity is wrong.
|
||||
*/
|
||||
int RFC1751::getKeyFromEnglish (std::string& strKey, const std::string& strHuman)
|
||||
{
|
||||
std::vector<std::string> vWords;
|
||||
std::string strFirst, strSecond;
|
||||
@@ -451,8 +454,9 @@ int eng2key(std::string& strKey, const std::string& strHuman)
|
||||
return rc;
|
||||
}
|
||||
|
||||
// key2eng() given a 128 bit key in big-endian format, convert to human.
|
||||
void key2eng(std::string& strHuman, const std::string& strKey)
|
||||
/** Convert to human from a 128 bit key in big-endian format
|
||||
*/
|
||||
void RFC1751::getEnglishFromKey (std::string& strHuman, const std::string& strKey)
|
||||
{
|
||||
std::string strFirst, strSecond;
|
||||
|
||||
22
modules/ripple_data/crypto/ripple_RFC1751.h
Normal file
22
modules/ripple_data/crypto/ripple_RFC1751.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef RIPPLE_RFC1751_H
|
||||
#define RIPPLE_RFC1751_H
|
||||
|
||||
class RFC1751
|
||||
{
|
||||
public:
|
||||
static int getKeyFromEnglish (std::string& strKey, const std::string& strHuman);
|
||||
|
||||
static void getEnglishFromKey (std::string& strHuman, const std::string& strKey);
|
||||
|
||||
private:
|
||||
static unsigned long extract (char *s, int start, int length);
|
||||
static void btoe (std::string& strHuman, const std::string& strData);
|
||||
static void insert (char *s, int x, int start, int length);
|
||||
static void standard (std::string& strWord);
|
||||
static int wsrch (const std::string& strWord, int iMin, int iMax);
|
||||
static int etob (std::string& strData, std::vector<std::string> vsHuman);
|
||||
|
||||
static char const* s_dictionary [];
|
||||
};
|
||||
|
||||
#endif
|
||||
90
modules/ripple_data/ripple_data.cpp
Normal file
90
modules/ripple_data/ripple_data.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
/** Add this to get the @ref ripple_data module.
|
||||
|
||||
@file ripple_data.cpp
|
||||
@ingroup ripple_data
|
||||
*/
|
||||
|
||||
// RippleAddress
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
// FieldNames
|
||||
#include <map>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
// CKeyECIES, CKeyDeterministic
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
// CKeyDeterministic
|
||||
#include <openssl/err.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
#include "ripple_data.h"
|
||||
|
||||
|
||||
|
||||
#include "crypto/ripple_Base58.h" // for RippleAddress
|
||||
#include "crypto/ripple_CKey.h" // needs RippleAddress VFALCO: TODO, remove this dependency cycle
|
||||
#include "crypto/ripple_RFC1751.h"
|
||||
|
||||
// VFALCO: TODO, fix these warnings!
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
|
||||
#pragma warning (disable: 4018) // signed/unsigned mismatch
|
||||
//#pragma warning (disable: 4244) // conversion, possible loss of data
|
||||
#endif
|
||||
|
||||
#include "crypto/ripple_CBigNum.cpp"
|
||||
#include "crypto/ripple_CKey.cpp"
|
||||
#include "crypto/ripple_CKeyDeterministic.cpp"
|
||||
#include "crypto/ripple_CKeyECIES.cpp"
|
||||
#include "crypto/ripple_Base58.cpp"
|
||||
#include "crypto/ripple_Base58Data.cpp"
|
||||
#include "crypto/ripple_RFC1751.cpp"
|
||||
|
||||
#include "types/ripple_FieldNames.cpp"
|
||||
#include "types/ripple_RippleAddress.cpp"
|
||||
#include "types/ripple_Serializer.cpp"
|
||||
|
||||
// VFALCO: TODO Fix this for SConstruct
|
||||
#ifdef _MSC_VER
|
||||
#include "ripple.pb.cc" // BROKEN because of SConstruct
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (pop)
|
||||
#endif
|
||||
74
modules/ripple_data/ripple_data.h
Normal file
74
modules/ripple_data/ripple_data.h
Normal file
@@ -0,0 +1,74 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
/** Include this to get the @ref ripple_data module.
|
||||
|
||||
@file ripple_data.h
|
||||
@ingroup ripple_data
|
||||
*/
|
||||
|
||||
/** Ripple specific data representation and manipulation.
|
||||
|
||||
These form the building blocks of Ripple data.
|
||||
|
||||
@defgroup ripple_data
|
||||
*/
|
||||
|
||||
#ifndef RIPPLE_DATA_H
|
||||
#define RIPPLE_DATA_H
|
||||
|
||||
// Base58Data
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
// CBigNum
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
// CKey
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// Serializer
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
// VFALCO: TODO, try to reduce these dependencies
|
||||
#include "../ripple_basics/ripple_basics.h"
|
||||
|
||||
#include "crypto/ripple_CBigNum.h"
|
||||
#include "crypto/ripple_Base58.h" // VFALCO: TODO, Can be moved to .cpp if we clean up setAlphabet stuff
|
||||
#include "crypto/ripple_Base58Data.h"
|
||||
|
||||
#include "types/ripple_FieldNames.h"
|
||||
#include "types/ripple_RippleAddress.h"
|
||||
#include "types/ripple_Serializer.h" // needs CKey
|
||||
|
||||
// VFALCO: TODO, resolve the location of this file
|
||||
#include "ripple.pb.h"
|
||||
|
||||
#endif
|
||||
@@ -1,12 +1,4 @@
|
||||
|
||||
#include "FieldNames.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
||||
// These must stay at the top of this file
|
||||
std::map<int, SField::ptr> SField::codeToField;
|
||||
@@ -22,7 +14,7 @@ SField sfIndex(STI_HASH256, 258, "index");
|
||||
|
||||
#define FIELD(name, type, index) SField sf##name(FIELD_CODE(STI_##type, index), STI_##type, index, #name);
|
||||
#define TYPE(name, type, index)
|
||||
#include "SerializeProto.h"
|
||||
#include "modules/ripple_data/types/ripple_SerializeDeclarations.h"
|
||||
#undef FIELD
|
||||
#undef TYPE
|
||||
|
||||
@@ -73,7 +65,7 @@ SField::ref SField::getField(int code)
|
||||
|
||||
#define FIELD(name, type, index)
|
||||
#define TYPE(name, type, index) case STI_##type:
|
||||
#include "SerializeProto.h"
|
||||
#include "modules/ripple_data/types/ripple_SerializeDeclarations.h"
|
||||
#undef FIELD
|
||||
#undef TYPE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef __FIELDNAMES__
|
||||
#define __FIELDNAMES__
|
||||
#ifndef RIPPLE_FIELDNAMES_H
|
||||
#define RIPPLE_FIELDNAMES_H
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -16,7 +16,7 @@ enum SerializedTypeID
|
||||
|
||||
#define TYPE(name, field, value) STI_##field = value,
|
||||
#define FIELD(name, field, value)
|
||||
#include "SerializeProto.h"
|
||||
#include "modules/ripple_data/types/ripple_SerializeDeclarations.h"
|
||||
#undef TYPE
|
||||
#undef FIELD
|
||||
|
||||
@@ -126,7 +126,7 @@ extern SField sfInvalid, sfGeneric, sfLedgerEntry, sfTransaction, sfValidation;
|
||||
|
||||
#define FIELD(name, type, index) extern SField sf##name;
|
||||
#define TYPE(name, type, index)
|
||||
#include "SerializeProto.h"
|
||||
#include "modules/ripple_data/types/ripple_SerializeDeclarations.h"
|
||||
#undef FIELD
|
||||
#undef TYPE
|
||||
|
||||
@@ -1,33 +1,12 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include "RippleAddress.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include "key.h"
|
||||
#include "BitcoinUtil.h"
|
||||
#include "rfc1751.h"
|
||||
#include "Serializer.h"
|
||||
#include "Application.h"
|
||||
// VFALCO: TODO, remove this when it's safe to do so.
|
||||
#ifdef __APPLICATION__
|
||||
#error Including Application.h is disallowed!
|
||||
#endif
|
||||
|
||||
SETUP_LOG (RippleAddress)
|
||||
|
||||
std::size_t hash_value(const CBase58Data& b58)
|
||||
{
|
||||
std::size_t seed = theApp->getNonceST() + (b58.nVersion * 0x9e3779b9);
|
||||
boost::hash_combine(seed, b58.vchData);
|
||||
return seed;
|
||||
}
|
||||
|
||||
RippleAddress::RippleAddress() : mIsValid(false)
|
||||
{
|
||||
nVersion = VER_NONE;
|
||||
@@ -728,7 +707,7 @@ std::string RippleAddress::humanSeed1751() const
|
||||
|
||||
strBig.assign(strLittle.rbegin(), strLittle.rend());
|
||||
|
||||
key2eng(strHuman, strBig);
|
||||
RFC1751::getEnglishFromKey (strHuman, strBig);
|
||||
|
||||
return strHuman;
|
||||
}
|
||||
@@ -755,7 +734,7 @@ std::string RippleAddress::humanSeed() const
|
||||
int RippleAddress::setSeed1751(const std::string& strHuman1751)
|
||||
{
|
||||
std::string strKey;
|
||||
int iResult = eng2key(strKey, strHuman1751);
|
||||
int iResult = RFC1751::getKeyFromEnglish (strKey, strHuman1751);
|
||||
|
||||
if (1 == iResult)
|
||||
{
|
||||
@@ -775,8 +754,6 @@ bool RippleAddress::setSeed(const std::string& strSeed)
|
||||
return mIsValid;
|
||||
}
|
||||
|
||||
extern const char *ALPHABET;
|
||||
|
||||
bool RippleAddress::setSeedGeneric(const std::string& strText)
|
||||
{
|
||||
RippleAddress naTemp;
|
||||
@@ -1,7 +1,5 @@
|
||||
#ifndef __RIPPLE_ADDRESS__
|
||||
#define __RIPPLE_ADDRESS__
|
||||
|
||||
#include "base58.h"
|
||||
#ifndef RIPPLE_RIPPLEADDRESS_H
|
||||
#define RIPPLE_RIPPLEADDRESS_H
|
||||
|
||||
//
|
||||
// Used to hold addresses and parse and produce human formats.
|
||||
@@ -1,14 +1,7 @@
|
||||
#ifndef __SERIALIZER__
|
||||
#define __SERIALIZER__
|
||||
#ifndef RIPPLE_SERIALIZER_H
|
||||
#define RIPPLE_SERIALIZER_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "key.h"
|
||||
#include "FieldNames.h"
|
||||
class CKey; // forward declaration
|
||||
|
||||
class Serializer
|
||||
{
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "ripple_ledger.h"
|
||||
|
||||
#include "../ripple_data/ripple_data.h"
|
||||
|
||||
//#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <algorithm>
|
||||
@@ -45,7 +47,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
@@ -63,23 +64,16 @@
|
||||
|
||||
#include "src/cpp/database/SqliteDatabase.h"
|
||||
|
||||
// VFALCO: TODO, resolve the location of this file
|
||||
//#include "src/cpp/ripple/ripple.pb.h"
|
||||
#include "ripple.pb.h"
|
||||
|
||||
#include "src/cpp/ripple/AcceptedLedger.h"
|
||||
#include "src/cpp/ripple/AccountItems.h"
|
||||
#include "src/cpp/ripple/AccountSetTransactor.h"
|
||||
#include "src/cpp/ripple/AccountState.h"
|
||||
#include "src/cpp/ripple/Application.h"
|
||||
#include "src/cpp/ripple/BitcoinUtil.h"
|
||||
#include "src/cpp/ripple/CanonicalTXSet.h"
|
||||
#include "src/cpp/ripple/ChangeTransactor.h"
|
||||
#include "src/cpp/ripple/Config.h"
|
||||
#include "src/cpp/ripple/FeatureTable.h"
|
||||
#include "src/cpp/ripple/FieldNames.h"
|
||||
#include "src/cpp/ripple/HashPrefixes.h"
|
||||
#include "src/cpp/ripple/key.h"
|
||||
#include "src/cpp/ripple/Ledger.h"
|
||||
#include "src/cpp/ripple/LedgerAcquire.h"
|
||||
#include "src/cpp/ripple/LedgerConsensus.h"
|
||||
@@ -100,7 +94,6 @@
|
||||
#include "src/cpp/ripple/PaymentTransactor.h"
|
||||
#include "src/cpp/ripple/PFRequest.h"
|
||||
#include "src/cpp/ripple/RegularKeySetTransactor.h"
|
||||
#include "src/cpp/ripple/RippleAddress.h"
|
||||
#include "src/cpp/ripple/RippleCalc.h"
|
||||
#include "src/cpp/ripple/RippleState.h"
|
||||
#include "src/cpp/ripple/SerializedLedger.h"
|
||||
@@ -108,7 +101,6 @@
|
||||
#include "src/cpp/ripple/SerializedTransaction.h"
|
||||
#include "src/cpp/ripple/SerializedTypes.h"
|
||||
#include "src/cpp/ripple/SerializedValidation.h"
|
||||
#include "src/cpp/ripple/Serializer.h"
|
||||
#include "src/cpp/ripple/SHAMapSync.h"
|
||||
#include "src/cpp/ripple/Transaction.h"
|
||||
#include "src/cpp/ripple/TransactionEngine.h"
|
||||
@@ -166,7 +158,6 @@
|
||||
#include "src/cpp/ripple/SerializedTransaction.cpp"
|
||||
#include "src/cpp/ripple/SerializedTypes.cpp"
|
||||
#include "src/cpp/ripple/SerializedValidation.cpp"
|
||||
#include "src/cpp/ripple/Serializer.cpp"
|
||||
|
||||
// transactions
|
||||
#include "src/cpp/ripple/AccountSetTransactor.cpp"
|
||||
|
||||
38
modules/ripple_main/misc/ripple_HashValue.cpp
Normal file
38
modules/ripple_main/misc/ripple_HashValue.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
std::size_t hash_value(const uint256& u)
|
||||
{
|
||||
std::size_t seed = theApp->getNonceST();
|
||||
|
||||
return u.hash_combine(seed);
|
||||
}
|
||||
|
||||
std::size_t hash_value(const uint160& u)
|
||||
{
|
||||
std::size_t seed = theApp->getNonceST();
|
||||
|
||||
return u.hash_combine(seed);
|
||||
}
|
||||
|
||||
std::size_t hash_value(const CBase58Data& b58)
|
||||
{
|
||||
std::size_t seed = theApp->getNonceST() + (b58.nVersion * 0x9e3779b9);
|
||||
boost::hash_combine(seed, b58.vchData);
|
||||
return seed;
|
||||
}
|
||||
34
modules/ripple_main/misc/ripple_HashValue.h
Normal file
34
modules/ripple_main/misc/ripple_HashValue.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_HASH_VALUE_H
|
||||
#define RIPPLE_HASH_VALUE_H
|
||||
|
||||
// VFALCO: TODO, clean this up
|
||||
//
|
||||
// These are needed for boost::hash stuff. The implemnetations access
|
||||
// the Application object for the nonce, introducing a nasty dependency
|
||||
// so I have split them away from the relevant classes and put them here.
|
||||
|
||||
extern std::size_t hash_value(const uint160&);
|
||||
|
||||
extern std::size_t hash_value(const uint256&);
|
||||
|
||||
extern std::size_t hash_value(const CBase58Data& b58);
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "ripple_main.h"
|
||||
|
||||
#include "../ripple_data/ripple_data.h"
|
||||
|
||||
// VFALCO: TODO, fix these warnings!
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
|
||||
@@ -34,7 +36,6 @@
|
||||
|
||||
#include "src/cpp/ripple/Application.cpp"
|
||||
#include "src/cpp/ripple/Config.cpp" // no log
|
||||
#include "src/cpp/ripple/InstanceCounter.cpp" // no log
|
||||
#include "src/cpp/ripple/JobQueue.cpp"
|
||||
#include "src/cpp/ripple/LoadManager.cpp"
|
||||
#include "src/cpp/ripple/LoadMonitor.cpp"
|
||||
@@ -42,6 +43,8 @@
|
||||
#include "src/cpp/ripple/main.cpp"
|
||||
#include "src/cpp/ripple/ValidationCollection.cpp"
|
||||
|
||||
#include "misc/ripple_HashValue.cpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
@@ -24,17 +24,7 @@
|
||||
|
||||
#include "ripple_mess.h"
|
||||
|
||||
// VFALCO: TODO, clean this up
|
||||
// This is here for Amount*.cpp
|
||||
#include "src/cpp/ripple/bignum.h"
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
#define BN_add_word64(bn, word) BN_add_word(bn, word)
|
||||
#define BN_sub_word64(bn, word) BN_sub_word(bn, word)
|
||||
#define BN_mul_word64(bn, word) BN_mul_word(bn, word)
|
||||
#define BN_div_word64(bn, word) BN_div_word(bn, word)
|
||||
#else
|
||||
#include "src/cpp/ripple/BigNum64.h"
|
||||
#endif
|
||||
#include "../ripple_data/ripple_data.h"
|
||||
|
||||
static const uint64 tenTo14 = 100000000000000ull;
|
||||
static const uint64 tenTo14m1 = tenTo14 - 1;
|
||||
@@ -50,27 +40,16 @@ static const uint64 tenTo17m1 = tenTo17 - 1;
|
||||
|
||||
#include "src/cpp/ripple/Amount.cpp"
|
||||
#include "src/cpp/ripple/AmountRound.cpp"
|
||||
#include "src/cpp/ripple/BitcoinUtil.cpp" // no log
|
||||
#include "src/cpp/ripple/DeterministicKeys.cpp"
|
||||
#include "src/cpp/ripple/ECIES.cpp" // no log
|
||||
#include "src/cpp/ripple/FieldNames.cpp" // no log
|
||||
#include "src/cpp/ripple/HashedObject.cpp"
|
||||
#include "src/cpp/ripple/PackedMessage.cpp" // no log
|
||||
#include "src/cpp/ripple/ParameterTable.cpp" // no log
|
||||
#include "src/cpp/ripple/ParseSection.cpp"
|
||||
#include "src/cpp/ripple/ProofOfWork.cpp"
|
||||
#include "src/cpp/ripple/RippleAddress.cpp"
|
||||
#include "src/cpp/ripple/rfc1751.cpp" // no log
|
||||
#include "src/cpp/ripple/SHAMap.cpp"
|
||||
#include "src/cpp/ripple/SHAMapDiff.cpp" // no log
|
||||
#include "src/cpp/ripple/SHAMapNodes.cpp" // no log
|
||||
#include "src/cpp/ripple/SHAMapSync.cpp"
|
||||
|
||||
// VFALCO: TODO Fix this for SConstruct
|
||||
#ifdef _MSC_VER
|
||||
#include "ripple.pb.cc" // BROKEN because of SConstruct
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "ripple_net.h"
|
||||
|
||||
#include "../ripple_data/ripple_data.h"
|
||||
|
||||
#include "../websocketpp/src/logger/logger.hpp" // for ripple_LogWebSockets.cpp
|
||||
|
||||
// VFALCO: TODO, fix these warnings!
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
|
||||
// VFALCO: NOTE, this looks like some facility for giving websocket
|
||||
// a way to produce logging output.
|
||||
//
|
||||
namespace websocketpp
|
||||
{
|
||||
namespace log
|
||||
|
||||
155
newcoin.vcxproj
155
newcoin.vcxproj
@@ -179,12 +179,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\diagnostic\ripple_LogWebsockets.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\ripple_basics.cpp" />
|
||||
<ClCompile Include="modules\ripple_basics\utility\ripple_ByteOrder.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
@@ -198,6 +192,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\utility\ripple_InstanceCounter.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\utility\ripple_Log.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -241,6 +241,63 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_client\ripple_client.cpp" />
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_Base58.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_Base58Data.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CBigNum.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CKey.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CKeyDeterministic.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CKeyECIES.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_RFC1751.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\ripple_data.cpp" />
|
||||
<ClCompile Include="modules\ripple_data\types\ripple_FieldNames.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\types\ripple_RippleAddress.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\types\ripple_Serializer.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_db\ripple_db.cpp" />
|
||||
<ClCompile Include="modules\ripple_json\json\json_reader.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
@@ -262,9 +319,21 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_json\ripple_json.cpp" />
|
||||
<ClCompile Include="modules\ripple_ledger\ripple_ledger.cpp" />
|
||||
<ClCompile Include="modules\ripple_main\misc\ripple_HashValue.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_main\ripple_main.cpp" />
|
||||
<ClCompile Include="modules\ripple_mess\ripple_mess.cpp" />
|
||||
<ClCompile Include="modules\ripple_net\ripple_net.cpp" />
|
||||
<ClCompile Include="modules\ripple_net\sockets\ripple_LogWebsockets.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\database\database.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -639,12 +708,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\BitcoinUtil.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\CallRPC.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -687,30 +750,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\DeterministicKeys.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ECIES.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\FeatureTable.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\FieldNames.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\HashedObject.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -727,12 +772,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\InstanceCounter.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Interpreter.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -923,18 +962,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\rfc1751.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RippleAddress.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RippleCalc.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1019,12 +1046,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Serializer.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\SHAMap.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1213,16 +1234,29 @@
|
||||
<ClInclude Include="modules\ripple_basics\types\ripple_UInt256.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_ByteOrder.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_DiffieHellmanUtil.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_HashUtilities.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_InstanceCounter.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_IntegerTypes.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_Log.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_PlatformMacros.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_RandomNumbers.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_ScopedLock.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_StringUtilities.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_Sustain.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_ThreadName.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_Time.h" />
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_UptimeTimer.h" />
|
||||
<ClInclude Include="modules\ripple_client\ripple_client.h" />
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_Base58.h" />
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_Base58Data.h" />
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_CBigNum.h" />
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_CKey.h" />
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_RFC1751.h" />
|
||||
<ClInclude Include="modules\ripple_data\ripple_data.h" />
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_FieldNames.h" />
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_RippleAddress.h" />
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_SerializeDeclarations.h" />
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_Serializer.h" />
|
||||
<ClInclude Include="modules\ripple_db\ripple_db.h" />
|
||||
<ClInclude Include="modules\ripple_json\json\json.h" />
|
||||
<ClInclude Include="modules\ripple_json\json\json_autolink.h" />
|
||||
@@ -1235,6 +1269,7 @@
|
||||
<ClInclude Include="modules\ripple_json\json\json_writer.h" />
|
||||
<ClInclude Include="modules\ripple_json\ripple_json.h" />
|
||||
<ClInclude Include="modules\ripple_ledger\ripple_ledger.h" />
|
||||
<ClInclude Include="modules\ripple_main\misc\ripple_HashValue.h" />
|
||||
<ClInclude Include="modules\ripple_main\ripple_main.h" />
|
||||
<ClInclude Include="modules\ripple_mess\ripple_mess.h" />
|
||||
<ClInclude Include="modules\ripple_net\ripple_net.h" />
|
||||
@@ -1554,10 +1589,6 @@
|
||||
<ClInclude Include="src\cpp\ripple\AccountState.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Application.h" />
|
||||
<ClInclude Include="src\cpp\ripple\AutoSocket.h" />
|
||||
<ClInclude Include="src\cpp\ripple\base58.h" />
|
||||
<ClInclude Include="src\cpp\ripple\bignum.h" />
|
||||
<ClInclude Include="src\cpp\ripple\BigNum64.h" />
|
||||
<ClInclude Include="src\cpp\ripple\BitcoinUtil.h" />
|
||||
<ClInclude Include="src\cpp\ripple\CallRPC.h" />
|
||||
<ClInclude Include="src\cpp\ripple\CanonicalTXSet.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ChangeTransactor.h" />
|
||||
@@ -1565,15 +1596,12 @@
|
||||
<ClInclude Include="src\cpp\ripple\ConnectionPool.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Contract.h" />
|
||||
<ClInclude Include="src\cpp\ripple\FeatureTable.h" />
|
||||
<ClInclude Include="src\cpp\ripple\FieldNames.h" />
|
||||
<ClInclude Include="src\cpp\ripple\HashedObject.h" />
|
||||
<ClInclude Include="src\cpp\ripple\HashPrefixes.h" />
|
||||
<ClInclude Include="src\cpp\ripple\HTTPRequest.h" />
|
||||
<ClInclude Include="src\cpp\ripple\HttpsClient.h" />
|
||||
<ClInclude Include="src\cpp\ripple\InstanceCounter.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Interpreter.h" />
|
||||
<ClInclude Include="src\cpp\ripple\JobQueue.h" />
|
||||
<ClInclude Include="src\cpp\ripple\key.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Ledger.h" />
|
||||
<ClInclude Include="src\cpp\ripple\LedgerAcquire.h" />
|
||||
<ClInclude Include="src\cpp\ripple\LedgerConsensus.h" />
|
||||
@@ -1604,8 +1632,6 @@
|
||||
<ClInclude Include="src\cpp\ripple\PFRequest.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ProofOfWork.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RegularKeySetTransactor.h" />
|
||||
<ClInclude Include="src\cpp\ripple\rfc1751.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RippleAddress.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RippleCalc.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RippleState.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RPC.h" />
|
||||
@@ -1614,15 +1640,12 @@
|
||||
<ClInclude Include="src\cpp\ripple\RPCHandler.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RPCServer.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RPCSub.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ScopedLock.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ScriptData.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SerializedLedger.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SerializedObject.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SerializedTransaction.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SerializedTypes.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SerializedValidation.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SerializeProto.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Serializer.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SHAMap.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SHAMapSync.h" />
|
||||
<ClInclude Include="src\cpp\ripple\SNTPClient.h" />
|
||||
|
||||
@@ -82,21 +82,12 @@
|
||||
<Filter Include="1. Modules\ripple_db\storage">
|
||||
<UniqueIdentifier>{6097a179-ddad-4c69-9a34-2e3fc2c9fa1d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_main\core">
|
||||
<UniqueIdentifier>{ed7b05c1-13c1-417c-a0c7-fb93a8edc5c9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_client\http">
|
||||
<UniqueIdentifier>{29cd2103-d553-4d82-9e6a-224e3b1cb667}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_net\sockets">
|
||||
<UniqueIdentifier>{afd09812-59e2-45e2-bf7f-d561b23d7da2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_net\service">
|
||||
<UniqueIdentifier>{074b2e47-f34b-42f1-945e-7e8083bbfb43}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_net\overlay">
|
||||
<UniqueIdentifier>{1b44bca2-5d6b-45b6-815b-797059fb2c8e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_mess">
|
||||
<UniqueIdentifier>{becffa9b-61f7-42d4-815a-1ec822cad0e7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -121,15 +112,33 @@
|
||||
<Filter Include="1. Modules\ripple_json\json\DEPRECATED">
|
||||
<UniqueIdentifier>{e398b116-a7fa-4850-8b8e-6de95efdea4e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_net\sockets\_OLD">
|
||||
<UniqueIdentifier>{1194480b-fa6b-4d92-8656-2470f45f2753}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_basics\utility">
|
||||
<UniqueIdentifier>{c30623e7-e0ab-4a8e-a213-aeaceb4327e2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_basics\types">
|
||||
<UniqueIdentifier>{0d38ac4f-f094-4b17-9f4c-ac4011ea3bca}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_net\_unsorted">
|
||||
<UniqueIdentifier>{b78453cf-8932-43ad-9312-09e5a8ca3375}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_data">
|
||||
<UniqueIdentifier>{8d0241d2-071c-4d6c-a15e-980cc51b26ce}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_data\crypto">
|
||||
<UniqueIdentifier>{095d33d8-dbf7-44d0-a675-6722b02bb3be}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_main\_old">
|
||||
<UniqueIdentifier>{ed7b05c1-13c1-417c-a0c7-fb93a8edc5c9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_main\misc">
|
||||
<UniqueIdentifier>{a624c4e9-2c7b-4b98-9dff-f57d876999f0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_data\types">
|
||||
<UniqueIdentifier>{2f3572a9-2882-4656-ab93-82b7761c9e3d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_data\protobuf">
|
||||
<UniqueIdentifier>{9f8ed40a-9f16-42fe-82fd-caf72d3d6a2b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\cpp\database\sqlite3.c">
|
||||
@@ -474,27 +483,12 @@
|
||||
<ClCompile Include="src\cpp\ripple\SerializedValidation.cpp">
|
||||
<Filter>1. Modules\ripple_ledger\serialization</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Serializer.cpp">
|
||||
<Filter>1. Modules\ripple_ledger\serialization</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Amount.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\AmountRound.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\BitcoinUtil.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\DeterministicKeys.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ECIES.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\FieldNames.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\HashedObject.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
@@ -510,9 +504,6 @@
|
||||
<ClCompile Include="src\cpp\ripple\ProofOfWork.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\rfc1751.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\ripple_basics.cpp">
|
||||
<Filter>1. Modules\ripple_basics</Filter>
|
||||
</ClCompile>
|
||||
@@ -616,28 +607,25 @@
|
||||
<Filter>1. Modules\ripple_db\storage</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Application.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Config.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\InstanceCounter.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\JobQueue.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\LoadManager.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\LoadMonitor.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\main.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ValidationCollection.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_main\ripple_main.cpp">
|
||||
<Filter>1. Modules\ripple_main</Filter>
|
||||
@@ -657,18 +645,6 @@
|
||||
<ClCompile Include="src\cpp\ripple\ScriptData.cpp">
|
||||
<Filter>1. Modules\ripple_ledger\contracts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\SNTPClient.cpp">
|
||||
<Filter>1. Modules\ripple_net\service</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\UniqueNodeList.cpp">
|
||||
<Filter>1. Modules\ripple_net\overlay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Suppression.cpp">
|
||||
<Filter>1. Modules\ripple_net\overlay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RippleAddress.cpp">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\WalletAddTransactor.cpp">
|
||||
<Filter>1. Modules\ripple_ledger\transactions</Filter>
|
||||
</ClCompile>
|
||||
@@ -691,7 +667,7 @@
|
||||
<Filter>1. Modules\ripple_mess\containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\UpdateTables.cpp">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\PFRequest.cpp">
|
||||
<Filter>1. Modules\ripple_ledger\processing</Filter>
|
||||
@@ -699,9 +675,6 @@
|
||||
<ClCompile Include="src\cpp\ripple\Pathfinder.cpp">
|
||||
<Filter>1. Modules\ripple_ledger\processing</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="build\proto\ripple.pb.cc">
|
||||
<Filter>1. Modules\ripple_mess\protobuf</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_mess\ripple_mess.cpp">
|
||||
<Filter>1. Modules\ripple_mess</Filter>
|
||||
</ClCompile>
|
||||
@@ -717,24 +690,6 @@
|
||||
<ClCompile Include="modules\ripple_json\ripple_json.cpp">
|
||||
<Filter>1. Modules\ripple_json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ConnectionPool.cpp">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\NetworkOPs.cpp">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Peer.cpp">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\PeerDoor.cpp">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\WSDoor.cpp">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\diagnostic\ripple_LogWebsockets.cpp">
|
||||
<Filter>1. Modules\ripple_net\sockets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\containers\ripple_RangeSet.cpp">
|
||||
<Filter>1. Modules\ripple_basics\containers</Filter>
|
||||
</ClCompile>
|
||||
@@ -765,6 +720,75 @@
|
||||
<ClCompile Include="modules\ripple_basics\utility\ripple_DiffieHellmanUtil.cpp">
|
||||
<Filter>1. Modules\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_net\sockets\ripple_LogWebsockets.cpp">
|
||||
<Filter>1. Modules\ripple_net\sockets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ConnectionPool.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\NetworkOPs.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Peer.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\PeerDoor.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\WSDoor.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\Suppression.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\UniqueNodeList.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\SNTPClient.cpp">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\ripple_data.cpp">
|
||||
<Filter>1. Modules\ripple_data</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_main\misc\ripple_HashValue.cpp">
|
||||
<Filter>1. Modules\ripple_main\misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CBigNum.cpp">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_Base58.cpp">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_Base58Data.cpp">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_RFC1751.cpp">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\types\ripple_RippleAddress.cpp">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\types\ripple_FieldNames.cpp">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CKey.cpp">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\types\ripple_Serializer.cpp">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CKeyECIES.cpp">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_data\crypto\ripple_CKeyDeterministic.cpp">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_basics\utility\ripple_InstanceCounter.cpp">
|
||||
<Filter>1. Modules\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="build\proto\ripple.pb.cc">
|
||||
<Filter>1. Modules\ripple_data\protobuf</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="database\sqlite3ext.h">
|
||||
@@ -1100,33 +1124,12 @@
|
||||
<ClInclude Include="src\cpp\ripple\SerializedValidation.h">
|
||||
<Filter>1. Modules\ripple_ledger\serialization</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Serializer.h">
|
||||
<Filter>1. Modules\ripple_ledger\serialization</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\base58.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\bignum.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\BigNum64.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\BitcoinUtil.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\FieldNames.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\HashedObject.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\HashPrefixes.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\key.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\PackedMessage.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
@@ -1139,9 +1142,6 @@
|
||||
<ClInclude Include="src\cpp\ripple\ProofOfWork.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\rfc1751.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_basics\ripple_basics.h">
|
||||
<Filter>1. Modules\ripple_basics</Filter>
|
||||
</ClInclude>
|
||||
@@ -1245,25 +1245,22 @@
|
||||
<Filter>1. Modules\ripple_db\storage</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Application.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Config.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\InstanceCounter.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\JobQueue.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\LoadManager.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\LoadMonitor.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\ValidationCollection.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_main\ripple_main.h">
|
||||
<Filter>1. Modules\ripple_main</Filter>
|
||||
@@ -1283,18 +1280,6 @@
|
||||
<ClInclude Include="src\cpp\ripple\ScriptData.h">
|
||||
<Filter>1. Modules\ripple_ledger\contracts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\SNTPClient.h">
|
||||
<Filter>1. Modules\ripple_net\service</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\UniqueNodeList.h">
|
||||
<Filter>1. Modules\ripple_net\overlay</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Suppression.h">
|
||||
<Filter>1. Modules\ripple_net\overlay</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\RippleAddress.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\WalletAddTransactor.h">
|
||||
<Filter>1. Modules\ripple_ledger\transactions</Filter>
|
||||
</ClInclude>
|
||||
@@ -1310,11 +1295,8 @@
|
||||
<ClInclude Include="src\cpp\ripple\SHAMapSync.h">
|
||||
<Filter>1. Modules\ripple_mess\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\ScopedLock.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Version.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\PFRequest.h">
|
||||
<Filter>1. Modules\ripple_ledger\processing</Filter>
|
||||
@@ -1323,13 +1305,7 @@
|
||||
<Filter>1. Modules\ripple_ledger\processing</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\NetworkStatus.h">
|
||||
<Filter>1. Modules\ripple_main\core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="build\proto\ripple.pb.h">
|
||||
<Filter>1. Modules\ripple_mess\protobuf</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\SerializeProto.h">
|
||||
<Filter>1. Modules\ripple_mess\types</Filter>
|
||||
<Filter>1. Modules\ripple_main\_old</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_mess\ripple_mess.h">
|
||||
<Filter>1. Modules\ripple_mess</Filter>
|
||||
@@ -1367,27 +1343,6 @@
|
||||
<ClInclude Include="modules\ripple_json\json\json_features.h">
|
||||
<Filter>1. Modules\ripple_json\json</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\AutoSocket.h">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\ConnectionPool.h">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\NetworkOPs.h">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Peer.h">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\PeerDoor.h">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\WSConnection.h">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\WSDoor.h">
|
||||
<Filter>1. Modules\ripple_net\sockets\_OLD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_basics\containers\ripple_RangeSet.h">
|
||||
<Filter>1. Modules\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
@@ -1433,6 +1388,81 @@
|
||||
<ClInclude Include="modules\ripple_basics\types\ripple_UInt256.h">
|
||||
<Filter>1. Modules\ripple_basics\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\WSDoor.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\AutoSocket.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\ConnectionPool.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\NetworkOPs.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Peer.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\PeerDoor.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\WSConnection.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\Suppression.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\UniqueNodeList.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\SNTPClient.h">
|
||||
<Filter>1. Modules\ripple_net\_unsorted</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_HashUtilities.h">
|
||||
<Filter>1. Modules\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\ripple_data.h">
|
||||
<Filter>1. Modules\ripple_data</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_main\misc\ripple_HashValue.h">
|
||||
<Filter>1. Modules\ripple_main\misc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_CBigNum.h">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_Base58.h">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_Base58Data.h">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_RFC1751.h">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_RippleAddress.h">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_FieldNames.h">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_SerializeDeclarations.h">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\crypto\ripple_CKey.h">
|
||||
<Filter>1. Modules\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_data\types\ripple_Serializer.h">
|
||||
<Filter>1. Modules\ripple_data\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_ScopedLock.h">
|
||||
<Filter>1. Modules\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_basics\utility\ripple_InstanceCounter.h">
|
||||
<Filter>1. Modules\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="build\proto\ripple.pb.h">
|
||||
<Filter>1. Modules\ripple_data\protobuf</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SConstruct" />
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "RippleAddress.h"
|
||||
#include "SerializedLedger.h"
|
||||
|
||||
class AccountState
|
||||
|
||||
@@ -16,17 +16,6 @@ SETUP_LOG (STAmount)
|
||||
|
||||
uint64 STAmount::uRateOne = STAmount::getRate(STAmount(1), STAmount(1));
|
||||
|
||||
|
||||
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
#define BN_add_word64(bn, word) BN_add_word(bn, word)
|
||||
#define BN_sub_word64(bn, word) BN_sub_word(bn, word)
|
||||
#define BN_mul_word64(bn, word) BN_mul_word(bn, word)
|
||||
#define BN_div_word64(bn, word) BN_div_word(bn, word)
|
||||
#else
|
||||
#include "BigNum64.h"
|
||||
#endif
|
||||
|
||||
bool STAmount::issuerFromString(uint160& uDstIssuer, const std::string& sIssuer)
|
||||
{
|
||||
bool bSuccess = true;
|
||||
|
||||
@@ -3,15 +3,6 @@
|
||||
|
||||
#include "SerializedTypes.h"
|
||||
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
#define BN_add_word64(bn, word) BN_add_word(bn, word)
|
||||
#define BN_sub_word64(bn, word) BN_sub_word(bn, word)
|
||||
#define BN_mul_word64(bn, word) BN_mul_word(bn, word)
|
||||
#define BN_div_word64(bn, word) BN_div_word(bn, word)
|
||||
#else
|
||||
#include "BigNum64.h"
|
||||
#endif
|
||||
|
||||
// CAUTION: This is early code and is *NOT* ready for real use yet.
|
||||
|
||||
static void canonicalizeRound(bool isNative, uint64& value, int& offset, bool roundUp)
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "Config.h"
|
||||
#include "PeerDoor.h"
|
||||
#include "RPCDoor.h"
|
||||
#include "BitcoinUtil.h"
|
||||
#include "key.h"
|
||||
|
||||
#include "../database/SqliteDatabase.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "UniqueNodeList.h"
|
||||
#include "ConnectionPool.h"
|
||||
#include "FeatureTable.h"
|
||||
#include "ScopedLock.h"
|
||||
#include "LedgerAcquire.h"
|
||||
#include "TransactionMaster.h"
|
||||
#include "Wallet.h"
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
#ifndef BIGNUM64_H
|
||||
#define BIGNUM64_H
|
||||
|
||||
// Support 64-bit word operations on 32-bit platforms
|
||||
|
||||
static int BN_add_word64(BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
return BN_add(a, &bn, a);
|
||||
}
|
||||
|
||||
static int BN_sub_word64(BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
return BN_sub(a, &bn, a);
|
||||
}
|
||||
|
||||
static int BN_mul_word64(BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
CAutoBN_CTX ctx;
|
||||
return BN_mul(a, &bn, a, ctx);
|
||||
}
|
||||
|
||||
static uint64 BN_div_word64(BIGNUM *a, uint64 w)
|
||||
{
|
||||
CBigNum bn(w);
|
||||
CAutoBN_CTX ctx;
|
||||
return (BN_div(a, NULL, a, &bn, ctx) == 1) ? 0 : ((uint64)-1);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,107 +0,0 @@
|
||||
#include "BitcoinUtil.h"
|
||||
#include <cstdarg>
|
||||
#include <openssl/rand.h>
|
||||
#include <ctime>
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
std::string gFormatStr("v1");
|
||||
|
||||
std::string FormatFullVersion()
|
||||
{
|
||||
return(gFormatStr);
|
||||
}
|
||||
|
||||
|
||||
string strprintf(const char* format, ...)
|
||||
{
|
||||
char buffer[50000];
|
||||
char* p = buffer;
|
||||
int limit = sizeof(buffer);
|
||||
int ret;
|
||||
loop
|
||||
{
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, format);
|
||||
ret = _vsnprintf(p, limit, format, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
if (ret >= 0 && ret < limit)
|
||||
break;
|
||||
if (p != buffer)
|
||||
delete[] p;
|
||||
limit *= 2;
|
||||
p = new char[limit];
|
||||
if (p == NULL)
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
string str(p, p+ret);
|
||||
if (p != buffer)
|
||||
delete[] p;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
inline int64 GetPerformanceCounter()
|
||||
{
|
||||
int64 nCounter = 0;
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
|
||||
#else
|
||||
timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
nCounter = t.tv_sec * 1000000 + t.tv_usec;
|
||||
#endif
|
||||
return nCounter;
|
||||
}
|
||||
|
||||
void RandAddSeed()
|
||||
{
|
||||
// Seed with CPU performance counter
|
||||
int64 nCounter = GetPerformanceCounter();
|
||||
RAND_add(&nCounter, sizeof(nCounter), 1.5);
|
||||
memset(&nCounter, 0, sizeof(nCounter));
|
||||
}
|
||||
//
|
||||
// "Never go to sea with two chronometers; take one or three."
|
||||
// Our three time sources are:
|
||||
// - System clock
|
||||
// - Median of other nodes's clocks
|
||||
// - The user (asking the user to fix the system clock if the first two disagree)
|
||||
//
|
||||
int64 GetTime()
|
||||
{
|
||||
return time(NULL);
|
||||
}
|
||||
|
||||
void RandAddSeedPerfmon()
|
||||
{
|
||||
RandAddSeed();
|
||||
|
||||
// This can take up to 2 seconds, so only do it every 10 minutes
|
||||
static int64 nLastPerfmon;
|
||||
if (GetTime() < nLastPerfmon + 10 * 60)
|
||||
return;
|
||||
nLastPerfmon = GetTime();
|
||||
|
||||
#ifdef WIN32
|
||||
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
|
||||
// Seed with the entire set of perfmon data
|
||||
unsigned char pdata[250000];
|
||||
memset(pdata, 0, sizeof(pdata));
|
||||
unsigned long nSize = sizeof(pdata);
|
||||
long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize);
|
||||
RegCloseKey(HKEY_PERFORMANCE_DATA);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
RAND_add(pdata, nSize, nSize/100.0);
|
||||
memset(pdata, 0, nSize);
|
||||
//printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "RPC.h"
|
||||
#include "RPCErr.h"
|
||||
#include "Config.h"
|
||||
#include "BitcoinUtil.h"
|
||||
|
||||
#include "CallRPC.h"
|
||||
|
||||
|
||||
@@ -80,8 +80,6 @@
|
||||
#define DEFAULT_FEE_OPERATION 1
|
||||
|
||||
Config theConfig;
|
||||
const char* ALPHABET = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz";
|
||||
const char* ALPHABET_BITCOIN = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
|
||||
void Config::setup(const std::string& strConf, bool bTestNet, bool bQuiet)
|
||||
{
|
||||
@@ -112,7 +110,7 @@ void Config::setup(const std::string& strConf, bool bTestNet, bool bQuiet)
|
||||
SIGN_PROPOSAL = TESTNET ? sHP_TestNetProposal : sHP_Proposal;
|
||||
|
||||
if (TESTNET)
|
||||
ALPHABET = "RPShNAF39wBUDnEGHJKLM4pQrsT7VWXYZ2bcdeCg65jkm8ofqi1tuvaxyz";
|
||||
Base58::setCurrentAlphabet (Base58::getTestnetAlphabet ());
|
||||
|
||||
if (!strConf.empty())
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "RippleAddress.h"
|
||||
#include "ParseSection.h"
|
||||
#include "SerializedTypes.h"
|
||||
|
||||
@@ -202,8 +201,6 @@ public:
|
||||
|
||||
extern Config theConfig;
|
||||
|
||||
extern const char* ALPHABET;
|
||||
extern const char* ALPHABET_BITCOIN;
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "../database/SqliteDatabase.h"
|
||||
|
||||
#include "Serializer.h"
|
||||
#include "Application.h"
|
||||
|
||||
SETUP_LOG (HashedObject)
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
|
||||
#include "ScopedLock.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "modules/ripple_main/misc/ripple_HashValue.h"
|
||||
|
||||
|
||||
// VFALCO: TODO, Move this to someplace sensible!!
|
||||
|
||||
@@ -190,6 +190,11 @@ void Ledger::setAccepted()
|
||||
setImmutable();
|
||||
}
|
||||
|
||||
bool Ledger::hasAccount(const RippleAddress& accountID)
|
||||
{
|
||||
return mAccountStateMap->hasItem(Ledger::getAccountRootIndex(accountID));
|
||||
}
|
||||
|
||||
AccountState::pointer Ledger::getAccountState(const RippleAddress& accountID)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@@ -1015,6 +1020,31 @@ SLE::pointer Ledger::getSLEi(const uint256& uId)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Ledger::visitAccountItems(const uint160& accountID, FUNCTION_TYPE<void(SLE::ref)> func)
|
||||
{ // Visit each item in this account's owner directory
|
||||
uint256 rootIndex = Ledger::getOwnerDirIndex(accountID);
|
||||
uint256 currentIndex = rootIndex;
|
||||
|
||||
while (1)
|
||||
{
|
||||
SLE::pointer ownerDir = getSLEi(currentIndex);
|
||||
if (!ownerDir || (ownerDir->getType() != ltDIR_NODE))
|
||||
return;
|
||||
|
||||
BOOST_FOREACH(const uint256& uNode, ownerDir->getFieldV256(sfIndexes).peekValue())
|
||||
{
|
||||
func(getSLEi(uNode));
|
||||
}
|
||||
|
||||
uint64 uNodeNext = ownerDir->getFieldU64(sfIndexNext);
|
||||
if (!uNodeNext)
|
||||
return;
|
||||
|
||||
currentIndex = Ledger::getDirNodeIndex(rootIndex, uNodeNext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint256 Ledger::getFirstLedgerIndex()
|
||||
{
|
||||
SHAMapItem::pointer node = mAccountStateMap->peekFirstItem();
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
#include "TransactionMeta.h"
|
||||
#include "AccountState.h"
|
||||
#include "NicknameState.h"
|
||||
#include "BitcoinUtil.h"
|
||||
#include "SHAMap.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "LoadMonitor.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
@@ -185,11 +183,13 @@ public:
|
||||
TransactionMetaSet::pointer& txMeta);
|
||||
|
||||
// high-level functions
|
||||
bool hasAccount(const RippleAddress& acctID);
|
||||
AccountState::pointer getAccountState(const RippleAddress& acctID);
|
||||
LedgerStateParms writeBack(LedgerStateParms parms, SLE::ref);
|
||||
SLE::pointer getAccountRoot(const uint160& accountID);
|
||||
SLE::pointer getAccountRoot(const RippleAddress& naAccountID);
|
||||
void updateSkipList();
|
||||
void visitAccountItems(const uint160& acctID, FUNCTION_TYPE<void(SLE::ref)>);
|
||||
|
||||
// database functions (low-level)
|
||||
static Ledger::pointer loadByIndex(uint32 ledgerIndex);
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
#include "Ledger.h"
|
||||
#include "Peer.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "ripple.pb.h"
|
||||
|
||||
// How long before we try again to acquire the same ledger
|
||||
#ifndef LEDGER_REACQUIRE_INTERVAL
|
||||
|
||||
@@ -8,14 +8,12 @@
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include "key.h"
|
||||
#include "Transaction.h"
|
||||
#include "LedgerAcquire.h"
|
||||
#include "LedgerProposal.h"
|
||||
#include "Peer.h"
|
||||
#include "CanonicalTXSet.h"
|
||||
#include "TransactionEngine.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "LoadMonitor.h"
|
||||
|
||||
DEFINE_INSTANCE(LedgerConsensus);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "TransactionMeta.h"
|
||||
#include "Ledger.h"
|
||||
#include "TransactionErr.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
DEFINE_INSTANCE(LedgerEntrySetEntry);
|
||||
DEFINE_INSTANCE(LedgerEntrySet);
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "RippleAddress.h"
|
||||
#include "Serializer.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
DEFINE_INSTANCE(LedgerProposal);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "HashPrefixes.h"
|
||||
#include "LedgerConsensus.h"
|
||||
#include "LedgerTiming.h"
|
||||
#include "RippleAddress.h"
|
||||
|
||||
SETUP_LOG (NetworkOPs)
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
|
||||
#include "RippleAddress.h"
|
||||
#include "SerializedTypes.h"
|
||||
#include "Pathfinder.h"
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include "ripple.pb.h"
|
||||
|
||||
// The header size for packed messages
|
||||
// len(4)+type(2)
|
||||
const unsigned HEADER_SIZE = 6;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "SerializedTypes.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "RippleCalc.h"
|
||||
#include "OrderBookDB.h"
|
||||
#include "AccountItems.h"
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "ripple.pb.h"
|
||||
#include "PackedMessage.h"
|
||||
#include "Ledger.h"
|
||||
#include "Transaction.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "JobQueue.h"
|
||||
#include "ProofOfWork.h"
|
||||
#include "LoadManager.h"
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include "Serializer.h"
|
||||
|
||||
SETUP_LOG (ProofOfWork)
|
||||
|
||||
bool powResultInfo(POWResult powCode, std::string& strToken, std::string& strHuman)
|
||||
|
||||
@@ -14,12 +14,10 @@
|
||||
#include "Application.h"
|
||||
#include "AccountItems.h"
|
||||
#include "Wallet.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "RippleCalc.h"
|
||||
#include "RPCErr.h"
|
||||
#include "AccountState.h"
|
||||
#include "NicknameState.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "Offer.h"
|
||||
#include "PFRequest.h"
|
||||
#include "ProofOfWork.h"
|
||||
@@ -514,7 +512,7 @@ Json::Value RPCHandler::accountFromString(Ledger::ref lrLedger, RippleAddress& n
|
||||
}
|
||||
else if (bStrict)
|
||||
{
|
||||
return naAccount.setAccountID(strIdent, ALPHABET_BITCOIN)
|
||||
return naAccount.setAccountID(strIdent, Base58::getBitcoinAlphabet ())
|
||||
? rpcError(rpcACT_BITCOIN)
|
||||
: rpcError(rpcACT_MALFORMED);
|
||||
}
|
||||
@@ -1064,9 +1062,7 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest, int& cost, ScopedL
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
AccountState::pointer as = mNetOps->getAccountState(lpLedger, raAccount);
|
||||
|
||||
if (as)
|
||||
if (lpLedger->hasAccount(raAccount))
|
||||
{
|
||||
jvResult["account"] = raAccount.humanAccountID();
|
||||
|
||||
@@ -1105,6 +1101,17 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest, int& cost, ScopedL
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
static void offerAdder(Json::Value& jvLines, SLE::ref offer)
|
||||
{
|
||||
if (offer->getType() == ltOFFER)
|
||||
{
|
||||
Json::Value& obj = jvLines.append(Json::objectValue);
|
||||
offer->getFieldAmount(sfTakerPays).setJson(obj["taker_pays"]);
|
||||
offer->getFieldAmount(sfTakerGets).setJson(obj["taker_gets"]);
|
||||
obj["seq"] = offer->getFieldU32(sfSequence);
|
||||
}
|
||||
}
|
||||
|
||||
// {
|
||||
// account: <account>|<nickname>|<account_public_key>
|
||||
// account_index: <number> // optional, defaults to 0.
|
||||
@@ -1142,29 +1149,11 @@ Json::Value RPCHandler::doAccountOffers(Json::Value jvRequest, int& cost, Scoped
|
||||
if (bIndex)
|
||||
jvResult["account_index"] = iIndex;
|
||||
|
||||
AccountState::pointer as = mNetOps->getAccountState(lpLedger, raAccount);
|
||||
|
||||
if (as)
|
||||
{
|
||||
Json::Value& jsonLines = (jvResult["offers"] = Json::arrayValue);
|
||||
|
||||
AccountItems offers(raAccount.getAccountID(), lpLedger, AccountItem::pointer(new Offer()));
|
||||
BOOST_FOREACH(AccountItem::ref item, offers.getItems())
|
||||
{
|
||||
Offer* offer=(Offer*)item.get();
|
||||
|
||||
Json::Value& obj = jsonLines.append(Json::objectValue);
|
||||
|
||||
offer->getTakerPays().setJson(obj["taker_pays"]);
|
||||
offer->getTakerGets().setJson(obj["taker_gets"]);
|
||||
obj["seq"] = offer->getSeq();
|
||||
|
||||
}
|
||||
}
|
||||
if (lpLedger->hasAccount(raAccount))
|
||||
lpLedger->visitAccountItems(raAccount.getAccountID(),
|
||||
BIND_TYPE(&offerAdder, boost::ref(jvResult["offers"] = Json::arrayValue), P_1));
|
||||
else
|
||||
{
|
||||
jvResult = rpcError(rpcACT_NOT_FOUND);
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include "RippleAddress.h"
|
||||
#include "SerializedTypes.h"
|
||||
#include "Ledger.h"
|
||||
#include "NetworkOPs.h"
|
||||
#include "ScopedLock.h"
|
||||
|
||||
#define LEDGER_CURRENT -1
|
||||
#define LEDGER_CLOSED -2
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
#include "HTTPRequest.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "NetworkOPs.h"
|
||||
#include "SerializedLedger.h"
|
||||
#include "RPCHandler.h"
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "Serializer.h"
|
||||
#include "BitcoinUtil.h"
|
||||
#include "SHAMap.h"
|
||||
#include "Application.h"
|
||||
|
||||
@@ -38,20 +36,6 @@ std::size_t hash_value(const SHAMapNode& mn)
|
||||
return mn.getMHash();
|
||||
}
|
||||
|
||||
std::size_t hash_value(const uint256& u)
|
||||
{
|
||||
std::size_t seed = theApp->getNonceST();
|
||||
|
||||
return u.hash_combine(seed);
|
||||
}
|
||||
|
||||
std::size_t hash_value(const uint160& u)
|
||||
{
|
||||
std::size_t seed = theApp->getNonceST();
|
||||
|
||||
return u.hash_combine(seed);
|
||||
}
|
||||
|
||||
|
||||
SHAMap::SHAMap(SHAMapType t, uint32 seq) : mSeq(seq), mLedgerSeq(0), mState(smsModifying), mType(t)
|
||||
{
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include "ScopedLock.h"
|
||||
#include "Serializer.h"
|
||||
#include "HashedObject.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
DEFINE_INSTANCE(SHAMap);
|
||||
DEFINE_INSTANCE(SHAMapItem);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include "Serializer.h"
|
||||
#include "BitcoinUtil.h"
|
||||
#include "HashPrefixes.h"
|
||||
|
||||
SETUP_LOG (SHAMapNode)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include "SerializedObject.h"
|
||||
#include "LedgerFormats.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
DEFINE_INSTANCE(SerializedLedgerEntry);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include "SerializedTypes.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
DEFINE_INSTANCE(SerializedObject);
|
||||
DEFINE_INSTANCE(SerializedArray);
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
#include "SerializedObject.h"
|
||||
#include "TransactionFormats.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
#define TXN_SQL_NEW 'N'
|
||||
#define TXN_SQL_CONFLICT 'C'
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "Serializer.h"
|
||||
#include "FieldNames.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
// CAUTION: Do not create a vector (or similar container) of any object derived from
|
||||
// SerializedType. Use Boost ptr_* containers. The copy assignment operator of
|
||||
// SerializedType has semantics that will cause contained types to change their names
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#define __VALIDATION__
|
||||
|
||||
#include "SerializedObject.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
DEFINE_INSTANCE(SerializedValidation);
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
DEFINE_INSTANCE(Suppression);
|
||||
|
||||
#define SF_RELAYED 0x01 // Has already been relayed to other nodes
|
||||
|
||||
@@ -11,13 +11,9 @@
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include "key.h"
|
||||
#include "ripple.pb.h"
|
||||
#include "Serializer.h"
|
||||
#include "SHAMap.h"
|
||||
#include "SerializedTransaction.h"
|
||||
#include "TransactionErr.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
class Database;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "SerializedLedger.h"
|
||||
#include "LedgerEntrySet.h"
|
||||
#include "TransactionErr.h"
|
||||
#include "InstanceCounter.h"
|
||||
|
||||
|
||||
DEFINE_INSTANCE(TransactionEngine);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include "Serializer.h"
|
||||
#include "SerializedTypes.h"
|
||||
#include "SerializedObject.h"
|
||||
#include "SerializedLedger.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "Application.h"
|
||||
#include "HttpsClient.h"
|
||||
#include "ParseSection.h"
|
||||
#include "Serializer.h"
|
||||
|
||||
#define VALIDATORS_FETCH_SECONDS 30
|
||||
#define VALIDATORS_FILE_BYTES_MAX (50 << 10)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include "RippleAddress.h"
|
||||
#include "Config.h"
|
||||
#include "HttpsClient.h"
|
||||
#include "ParseSection.h"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "Application.h"
|
||||
#include "NetworkOPs.h"
|
||||
#include "CallRPC.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "LoadManager.h"
|
||||
#include "RPCErr.h"
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "openssl/ec.h"
|
||||
#include "openssl/dh.h"
|
||||
|
||||
#include "Serializer.h"
|
||||
|
||||
class Ledger;
|
||||
|
||||
class Wallet
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin Developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
//
|
||||
// Why base-58 instead of standard base-64 encoding?
|
||||
// - Don't want 0OIl characters that look the same in some fonts and
|
||||
// could be used to create visually identical looking account numbers.
|
||||
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
|
||||
// - E-mail usually won't line-break if there's no punctuation to break at.
|
||||
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
|
||||
//
|
||||
#ifndef BITCOIN_BASE58_H
|
||||
#define BITCOIN_BASE58_H
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include "bignum.h"
|
||||
#include "BitcoinUtil.h"
|
||||
|
||||
extern const char* ALPHABET;
|
||||
|
||||
inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum bn58 = 58;
|
||||
CBigNum bn0 = 0;
|
||||
|
||||
// Convert big endian data to little endian
|
||||
// Extra zero at the end make sure bignum will interpret as a positive number
|
||||
std::vector<unsigned char> vchTmp(pend-pbegin+1, 0);
|
||||
std::reverse_copy(pbegin, pend, vchTmp.begin());
|
||||
|
||||
// Convert little endian data to bignum
|
||||
CBigNum bn(vchTmp);
|
||||
|
||||
// Convert bignum to std::string
|
||||
std::string str;
|
||||
// Expected size increase from base58 conversion is approximately 137%
|
||||
// use 138% to be safe
|
||||
str.reserve((pend - pbegin) * 138 / 100 + 1);
|
||||
CBigNum dv;
|
||||
CBigNum rem;
|
||||
while (bn > bn0)
|
||||
{
|
||||
if (!BN_div(&dv, &rem, &bn, &bn58, pctx))
|
||||
throw bignum_error("EncodeBase58 : BN_div failed");
|
||||
bn = dv;
|
||||
unsigned int c = rem.getuint();
|
||||
str += ALPHABET[c];
|
||||
}
|
||||
|
||||
// Leading zeroes encoded as base58 zeros
|
||||
for (const unsigned char* p = pbegin; p < pend && *p == 0; p++)
|
||||
str += ALPHABET[0];
|
||||
|
||||
// Convert little endian std::string to big endian
|
||||
reverse(str.begin(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
inline std::string EncodeBase58(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
return EncodeBase58(&vch[0], &vch[0] + vch.size());
|
||||
}
|
||||
|
||||
inline bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet, const char* pAlphabet=0)
|
||||
{
|
||||
const char* pAlpha = pAlphabet ? pAlphabet : ALPHABET;
|
||||
|
||||
CAutoBN_CTX pctx;
|
||||
vchRet.clear();
|
||||
CBigNum bn58 = 58;
|
||||
CBigNum bn = 0;
|
||||
CBigNum bnChar;
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
|
||||
// Convert big endian string to bignum
|
||||
for (const char* p = psz; *p; p++)
|
||||
{
|
||||
const char* p1 = strchr(pAlpha, *p);
|
||||
if (p1 == NULL)
|
||||
{
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
if (*p != '\0')
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
bnChar.setuint(p1 - pAlpha);
|
||||
if (!BN_mul(&bn, &bn, &bn58, pctx))
|
||||
throw bignum_error("DecodeBase58 : BN_mul failed");
|
||||
bn += bnChar;
|
||||
}
|
||||
|
||||
// Get bignum as little endian data
|
||||
std::vector<unsigned char> vchTmp = bn.getvch();
|
||||
|
||||
// Trim off sign byte if present
|
||||
if (vchTmp.size() >= 2 && vchTmp.end()[-1] == 0 && vchTmp.end()[-2] >= 0x80)
|
||||
vchTmp.erase(vchTmp.end()-1);
|
||||
|
||||
// Restore leading zeros
|
||||
int nLeadingZeros = 0;
|
||||
for (const char* p = psz; *p == pAlpha[0]; p++)
|
||||
nLeadingZeros++;
|
||||
vchRet.assign(nLeadingZeros + vchTmp.size(), 0);
|
||||
|
||||
// Convert little endian data to big endian
|
||||
std::reverse_copy(vchTmp.begin(), vchTmp.end(), vchRet.end() - vchTmp.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet)
|
||||
{
|
||||
return DecodeBase58(str.c_str(), vchRet);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
|
||||
{
|
||||
// add 4-byte hash check to the end
|
||||
std::vector<unsigned char> vch(vchIn);
|
||||
uint256 hash = SHA256Hash(vch.begin(), vch.end());
|
||||
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
|
||||
return EncodeBase58(vch);
|
||||
}
|
||||
|
||||
inline bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet, const char* pAlphabet=0)
|
||||
{
|
||||
if (!DecodeBase58(psz, vchRet, pAlphabet))
|
||||
return false;
|
||||
if (vchRet.size() < 4)
|
||||
{
|
||||
vchRet.clear();
|
||||
return false;
|
||||
}
|
||||
uint256 hash = SHA256Hash(vchRet.begin(), vchRet.end()-4);
|
||||
if (memcmp(&hash, &vchRet.end()[-4], 4) != 0)
|
||||
{
|
||||
vchRet.clear();
|
||||
return false;
|
||||
}
|
||||
vchRet.resize(vchRet.size()-4);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet, const char* pAlphabet)
|
||||
{
|
||||
return DecodeBase58Check(str.c_str(), vchRet, pAlphabet);
|
||||
}
|
||||
|
||||
|
||||
class CBase58Data
|
||||
{
|
||||
protected:
|
||||
unsigned char nVersion;
|
||||
std::vector<unsigned char> vchData;
|
||||
|
||||
CBase58Data() : nVersion(1)
|
||||
{ ; }
|
||||
|
||||
~CBase58Data()
|
||||
{
|
||||
if (!vchData.empty())
|
||||
memset(&vchData[0], 0, vchData.size());
|
||||
}
|
||||
|
||||
void SetData(int nVersionIn, const std::vector<unsigned char>& vchDataIn)
|
||||
{
|
||||
nVersion = nVersionIn;
|
||||
vchData = vchDataIn;
|
||||
}
|
||||
|
||||
void SetData(int nVersionIn, const void* pdata, size_t nSize)
|
||||
{
|
||||
nVersion = nVersionIn;
|
||||
vchData.resize(nSize);
|
||||
if (nSize)
|
||||
memcpy(&vchData[0], pdata, nSize);
|
||||
}
|
||||
|
||||
void SetData(int nVersionIn, const unsigned char *pbegin, const unsigned char *pend)
|
||||
{
|
||||
SetData(nVersionIn, (void*)pbegin, pend - pbegin);
|
||||
}
|
||||
|
||||
public:
|
||||
bool SetString(const char* psz, unsigned char version, const char* pAlphabet = 0)
|
||||
{
|
||||
std::vector<unsigned char> vchTemp;
|
||||
DecodeBase58Check(psz, vchTemp, pAlphabet);
|
||||
if (vchTemp.empty() || vchTemp[0] != version)
|
||||
{
|
||||
vchData.clear();
|
||||
nVersion = 1;
|
||||
return false;
|
||||
}
|
||||
nVersion = vchTemp[0];
|
||||
vchData.resize(vchTemp.size() - 1);
|
||||
if (!vchData.empty())
|
||||
memcpy(&vchData[0], &vchTemp[1], vchData.size());
|
||||
memset(&vchTemp[0], 0, vchTemp.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetString(const std::string& str, unsigned char version)
|
||||
{
|
||||
return SetString(str.c_str(), version);
|
||||
}
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
std::vector<unsigned char> vch(1, nVersion);
|
||||
|
||||
vch.insert(vch.end(), vchData.begin(), vchData.end());
|
||||
|
||||
return EncodeBase58Check(vch);
|
||||
}
|
||||
|
||||
int CompareTo(const CBase58Data& b58) const
|
||||
{
|
||||
if (nVersion < b58.nVersion) return -1;
|
||||
if (nVersion > b58.nVersion) return 1;
|
||||
if (vchData < b58.vchData) return -1;
|
||||
if (vchData > b58.vchData) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool operator==(const CBase58Data& b58) const { return CompareTo(b58) == 0; }
|
||||
bool operator!=(const CBase58Data& b58) const { return CompareTo(b58) != 0; }
|
||||
bool operator<=(const CBase58Data& b58) const { return CompareTo(b58) <= 0; }
|
||||
bool operator>=(const CBase58Data& b58) const { return CompareTo(b58) >= 0; }
|
||||
bool operator< (const CBase58Data& b58) const { return CompareTo(b58) < 0; }
|
||||
bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
|
||||
|
||||
friend std::size_t hash_value(const CBase58Data& b58);
|
||||
};
|
||||
|
||||
extern std::size_t hash_value(const CBase58Data& b58);
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
@@ -1,536 +0,0 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
#ifndef BITCOIN_BIGNUM_H
|
||||
#define BITCOIN_BIGNUM_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
#include "BitcoinUtil.h"
|
||||
|
||||
class bignum_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bignum_error(const std::string& str) : std::runtime_error(str) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CAutoBN_CTX
|
||||
{
|
||||
private:
|
||||
CAutoBN_CTX(const CAutoBN_CTX&); // no implementation
|
||||
CAutoBN_CTX& operator=(const CAutoBN_CTX&); // no implementation
|
||||
|
||||
protected:
|
||||
BN_CTX* pctx;
|
||||
CAutoBN_CTX& operator=(BN_CTX* pnew) { pctx = pnew; return *this; }
|
||||
|
||||
public:
|
||||
CAutoBN_CTX()
|
||||
{
|
||||
pctx = BN_CTX_new();
|
||||
if (pctx == NULL)
|
||||
throw bignum_error("CAutoBN_CTX : BN_CTX_new() returned NULL");
|
||||
}
|
||||
|
||||
~CAutoBN_CTX()
|
||||
{
|
||||
if (pctx != NULL)
|
||||
BN_CTX_free(pctx);
|
||||
}
|
||||
|
||||
operator BN_CTX*() { return pctx; }
|
||||
BN_CTX& operator*() { return *pctx; }
|
||||
BN_CTX** operator&() { return &pctx; }
|
||||
bool operator!() { return (pctx == NULL); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CBigNum : public BIGNUM
|
||||
{
|
||||
public:
|
||||
CBigNum()
|
||||
{
|
||||
BN_init(this);
|
||||
}
|
||||
|
||||
CBigNum(const CBigNum& b)
|
||||
{
|
||||
BN_init(this);
|
||||
if (!BN_copy(this, &b))
|
||||
{
|
||||
BN_clear_free(this);
|
||||
throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_copy failed");
|
||||
}
|
||||
}
|
||||
|
||||
CBigNum& operator=(const CBigNum& b)
|
||||
{
|
||||
if (!BN_copy(this, &b))
|
||||
throw bignum_error("CBigNum::operator= : BN_copy failed");
|
||||
return (*this);
|
||||
}
|
||||
|
||||
~CBigNum()
|
||||
{
|
||||
BN_clear_free(this);
|
||||
}
|
||||
|
||||
CBigNum(char n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(short n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(int n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(long n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(int64 n) { BN_init(this); setint64(n); }
|
||||
CBigNum(unsigned char n) { BN_init(this); setulong(n); }
|
||||
CBigNum(unsigned short n) { BN_init(this); setulong(n); }
|
||||
CBigNum(unsigned int n) { BN_init(this); setulong(n); }
|
||||
CBigNum(uint64 n) { BN_init(this); setuint64(n); }
|
||||
explicit CBigNum(uint256 n) { BN_init(this); setuint256(n); }
|
||||
|
||||
explicit CBigNum(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
BN_init(this);
|
||||
setvch(vch);
|
||||
}
|
||||
|
||||
void setuint(unsigned int n)
|
||||
{
|
||||
setulong(static_cast<unsigned long>(n));
|
||||
}
|
||||
|
||||
unsigned int getuint() const
|
||||
{
|
||||
return BN_get_word(this);
|
||||
}
|
||||
|
||||
int getint() const
|
||||
{
|
||||
unsigned long n = BN_get_word(this);
|
||||
if (!BN_is_negative(this))
|
||||
return (n > INT_MAX ? INT_MAX : n);
|
||||
else
|
||||
return (n > INT_MAX ? INT_MIN : -(int)n);
|
||||
}
|
||||
|
||||
void setint64(int64 n)
|
||||
{
|
||||
unsigned char pch[sizeof(n) + 6];
|
||||
unsigned char* p = pch + 4;
|
||||
bool fNegative = false;
|
||||
if (n < (int64)0)
|
||||
{
|
||||
n = -n;
|
||||
fNegative = true;
|
||||
}
|
||||
bool fLeadingZeroes = true;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char c = (n >> 56) & 0xff;
|
||||
n <<= 8;
|
||||
if (fLeadingZeroes)
|
||||
{
|
||||
if (c == 0)
|
||||
continue;
|
||||
if (c & 0x80)
|
||||
*p++ = (fNegative ? 0x80 : 0);
|
||||
else if (fNegative)
|
||||
c |= 0x80;
|
||||
fLeadingZeroes = false;
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
unsigned int nSize = p - (pch + 4);
|
||||
pch[0] = (nSize >> 24) & 0xff;
|
||||
pch[1] = (nSize >> 16) & 0xff;
|
||||
pch[2] = (nSize >> 8) & 0xff;
|
||||
pch[3] = (nSize) & 0xff;
|
||||
BN_mpi2bn(pch, p - pch, this);
|
||||
}
|
||||
|
||||
uint64 getuint64() const
|
||||
{
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
return static_cast<uint64>(getulong());
|
||||
#else
|
||||
int len = BN_num_bytes(this);
|
||||
if (len > 8)
|
||||
throw std::runtime_error("BN getuint64 overflow");
|
||||
|
||||
unsigned char buf[8];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
BN_bn2bin(this, buf + 8 - len);
|
||||
return
|
||||
static_cast<uint64>(buf[0]) << 56 | static_cast<uint64>(buf[1]) << 48 |
|
||||
static_cast<uint64>(buf[2]) << 40 | static_cast<uint64>(buf[3]) << 32 |
|
||||
static_cast<uint64>(buf[4]) << 24 | static_cast<uint64>(buf[5]) << 16 |
|
||||
static_cast<uint64>(buf[6]) << 8 | static_cast<uint64>(buf[7]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void setuint64(uint64 n)
|
||||
{
|
||||
#if (ULONG_MAX > UINT_MAX)
|
||||
setulong(static_cast<unsigned long>(n));
|
||||
#else
|
||||
unsigned char buf[8];
|
||||
buf[0] = static_cast<unsigned char>((n >> 56) & 0xff);
|
||||
buf[1] = static_cast<unsigned char>((n >> 48) & 0xff);
|
||||
buf[2] = static_cast<unsigned char>((n >> 40) & 0xff);
|
||||
buf[3] = static_cast<unsigned char>((n >> 32) & 0xff);
|
||||
buf[4] = static_cast<unsigned char>((n >> 24) & 0xff);
|
||||
buf[5] = static_cast<unsigned char>((n >> 16) & 0xff);
|
||||
buf[6] = static_cast<unsigned char>((n >> 8) & 0xff);
|
||||
buf[7] = static_cast<unsigned char>((n) & 0xff);
|
||||
BN_bin2bn(buf, 8, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void setuint256(const uint256& n)
|
||||
{
|
||||
BN_bin2bn(n.begin(), n.size(), NULL);
|
||||
}
|
||||
|
||||
uint256 getuint256()
|
||||
{
|
||||
uint256 ret;
|
||||
unsigned int size = BN_num_bytes(this);
|
||||
if (size > ret.size())
|
||||
return ret;
|
||||
BN_bn2bin(this, ret.begin() + (ret.size() - BN_num_bytes(this)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void setvch(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
std::vector<unsigned char> vch2(vch.size() + 4);
|
||||
unsigned int nSize = vch.size();
|
||||
// BIGNUM's byte stream format expects 4 bytes of
|
||||
// big endian size data info at the front
|
||||
vch2[0] = (nSize >> 24) & 0xff;
|
||||
vch2[1] = (nSize >> 16) & 0xff;
|
||||
vch2[2] = (nSize >> 8) & 0xff;
|
||||
vch2[3] = (nSize >> 0) & 0xff;
|
||||
// swap data to big endian
|
||||
std::reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
|
||||
BN_mpi2bn(&vch2[0], vch2.size(), this);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> getvch() const
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
if (nSize < 4)
|
||||
return std::vector<unsigned char>();
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
vch.erase(vch.begin(), vch.begin() + 4);
|
||||
reverse(vch.begin(), vch.end());
|
||||
return vch;
|
||||
}
|
||||
|
||||
CBigNum& SetCompact(unsigned int nCompact)
|
||||
{
|
||||
unsigned int nSize = nCompact >> 24;
|
||||
std::vector<unsigned char> vch(4 + nSize);
|
||||
vch[3] = nSize;
|
||||
if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff;
|
||||
if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff;
|
||||
if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff;
|
||||
BN_mpi2bn(&vch[0], vch.size(), this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned int GetCompact() const
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
nSize -= 4;
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
unsigned int nCompact = nSize << 24;
|
||||
if (nSize >= 1) nCompact |= (vch[4] << 16);
|
||||
if (nSize >= 2) nCompact |= (vch[5] << 8);
|
||||
if (nSize >= 3) nCompact |= (vch[6] << 0);
|
||||
return nCompact;
|
||||
}
|
||||
|
||||
void SetHex(const std::string& str)
|
||||
{
|
||||
// skip 0x
|
||||
const char* psz = str.c_str();
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
bool fNegative = false;
|
||||
if (*psz == '-')
|
||||
{
|
||||
fNegative = true;
|
||||
psz++;
|
||||
}
|
||||
if (psz[0] == '0' && tolower(psz[1]) == 'x')
|
||||
psz += 2;
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
|
||||
// hex string to bignum
|
||||
static char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
|
||||
*this = 0;
|
||||
while (isxdigit(*psz))
|
||||
{
|
||||
*this <<= 4;
|
||||
int n = phexdigit[(int) *psz++];
|
||||
*this += n;
|
||||
}
|
||||
if (fNegative)
|
||||
*this = 0 - *this;
|
||||
}
|
||||
|
||||
std::string ToString(int nBase=10) const
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum bnBase = nBase;
|
||||
CBigNum bn0 = 0;
|
||||
std::string str;
|
||||
CBigNum bn = *this;
|
||||
BN_set_negative(&bn, false);
|
||||
CBigNum dv;
|
||||
CBigNum rem;
|
||||
if (BN_cmp(&bn, &bn0) == 0)
|
||||
return "0";
|
||||
while (BN_cmp(&bn, &bn0) > 0)
|
||||
{
|
||||
if (!BN_div(&dv, &rem, &bn, &bnBase, pctx))
|
||||
throw bignum_error("CBigNum::ToString() : BN_div failed");
|
||||
bn = dv;
|
||||
unsigned int c = rem.getuint();
|
||||
str += "0123456789abcdef"[c];
|
||||
}
|
||||
if (BN_is_negative(this))
|
||||
str += "-";
|
||||
reverse(str.begin(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string GetHex() const
|
||||
{
|
||||
return ToString(16);
|
||||
}
|
||||
/* JED
|
||||
unsigned int GetSerializeSize(int nType=0, int nVersion=VERSION) const
|
||||
{
|
||||
return ::GetSerializeSize(getvch(), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType=0, int nVersion=VERSION) const
|
||||
{
|
||||
::Serialize(s, getvch(), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType=0, int nVersion=VERSION)
|
||||
{
|
||||
std::vector<unsigned char> vch;
|
||||
::Unserialize(s, vch, nType, nVersion);
|
||||
setvch(vch);
|
||||
}*/
|
||||
|
||||
|
||||
bool operator!() const
|
||||
{
|
||||
return BN_is_zero(this);
|
||||
}
|
||||
|
||||
CBigNum& operator+=(const CBigNum& b)
|
||||
{
|
||||
if (!BN_add(this, this, &b))
|
||||
throw bignum_error("CBigNum::operator+= : BN_add failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator-=(const CBigNum& b)
|
||||
{
|
||||
*this = *this - b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator*=(const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
if (!BN_mul(this, this, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator*= : BN_mul failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator/=(const CBigNum& b)
|
||||
{
|
||||
*this = *this / b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator%=(const CBigNum& b)
|
||||
{
|
||||
*this = *this % b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator<<=(unsigned int shift)
|
||||
{
|
||||
if (!BN_lshift(this, this, shift))
|
||||
throw bignum_error("CBigNum:operator<<= : BN_lshift failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator>>=(unsigned int shift)
|
||||
{
|
||||
// Note: BN_rshift segfaults on 64-bit if 2^shift is greater than the number
|
||||
// if built on ubuntu 9.04 or 9.10, probably depends on version of openssl
|
||||
CBigNum a = 1;
|
||||
a <<= shift;
|
||||
if (BN_cmp(&a, this) > 0)
|
||||
{
|
||||
*this = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (!BN_rshift(this, this, shift))
|
||||
throw bignum_error("CBigNum:operator>>= : BN_rshift failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
CBigNum& operator++()
|
||||
{
|
||||
// prefix operator
|
||||
if (!BN_add(this, this, BN_value_one()))
|
||||
throw bignum_error("CBigNum::operator++ : BN_add failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CBigNum operator++(int)
|
||||
{
|
||||
// postfix operator
|
||||
const CBigNum ret = *this;
|
||||
++(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CBigNum& operator--()
|
||||
{
|
||||
// prefix operator
|
||||
CBigNum r;
|
||||
if (!BN_sub(&r, this, BN_value_one()))
|
||||
throw bignum_error("CBigNum::operator-- : BN_sub failed");
|
||||
*this = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CBigNum operator--(int)
|
||||
{
|
||||
// postfix operator
|
||||
const CBigNum ret = *this;
|
||||
--(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
friend inline const CBigNum operator-(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator/(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator%(const CBigNum& a, const CBigNum& b);
|
||||
|
||||
private:
|
||||
|
||||
// private because the size of an unsigned long varies by platform
|
||||
|
||||
void setulong(unsigned long n)
|
||||
{
|
||||
if (!BN_set_word(this, n))
|
||||
throw bignum_error("CBigNum conversion from unsigned long : BN_set_word failed");
|
||||
}
|
||||
|
||||
unsigned long getulong() const
|
||||
{
|
||||
return BN_get_word(this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline const CBigNum operator+(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_add(&r, &a, &b))
|
||||
throw bignum_error("CBigNum::operator+ : BN_add failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator-(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_sub(&r, &a, &b))
|
||||
throw bignum_error("CBigNum::operator- : BN_sub failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator-(const CBigNum& a)
|
||||
{
|
||||
CBigNum r(a);
|
||||
BN_set_negative(&r, !BN_is_negative(&r));
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator*(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_mul(&r, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator* : BN_mul failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator/(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_div(&r, NULL, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator/ : BN_div failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator%(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_mod(&r, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator% : BN_div failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator<<(const CBigNum& a, unsigned int shift)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_lshift(&r, &a, shift))
|
||||
throw bignum_error("CBigNum:operator<< : BN_lshift failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator>>(const CBigNum& a, unsigned int shift)
|
||||
{
|
||||
CBigNum r = a;
|
||||
r >>= shift;
|
||||
return r;
|
||||
}
|
||||
|
||||
inline bool operator==(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) == 0); }
|
||||
inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) != 0); }
|
||||
inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) <= 0); }
|
||||
inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) >= 0); }
|
||||
inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) < 0); }
|
||||
inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) > 0); }
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef _RFC_1751_
|
||||
#define _RFC_1751_
|
||||
|
||||
int eng2key(std::string& strKey, const std::string& strHuman);
|
||||
void key2eng(std::string& strHuman, const std::string& strKey);
|
||||
|
||||
#endif
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#include "RPC.h"
|
||||
#include "BitcoinUtil.h"
|
||||
#include "Config.h"
|
||||
#include "Version.h"
|
||||
|
||||
@@ -25,6 +24,15 @@ using namespace boost::asio;
|
||||
|
||||
unsigned int const gMaxHTTPHeaderSize = 0x02000000;
|
||||
|
||||
std::string gFormatStr("v1");
|
||||
|
||||
// VFALCO: TODO, clean up this nonsense
|
||||
std::string FormatFullVersion()
|
||||
{
|
||||
return(gFormatStr);
|
||||
}
|
||||
|
||||
|
||||
Json::Value JSONRPCError(int code, const std::string& message)
|
||||
{
|
||||
Json::Value error(Json::objectValue);
|
||||
@@ -142,7 +150,7 @@ int ReadHTTPStatus(std::basic_istream<char>& stream)
|
||||
int ReadHTTPHeader(std::basic_istream<char>& stream, std::map<std::string, std::string>& mapHeadersRet)
|
||||
{
|
||||
int nLen = 0;
|
||||
loop
|
||||
for (;;)
|
||||
{
|
||||
std::string str;
|
||||
std::getline(stream, str);
|
||||
|
||||
Reference in New Issue
Block a user