Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e7069b0
CDBEnv bitdb -> std::shared_ptr<CDBEnv> bitdb(new CDBEnv())
DeckerSU Sep 6, 2022
c7646f0
initial backport of Komodo #559 into our codebase
DeckerSU Sep 8, 2022
8a5c4de
remove REQUIRES(cs_main) thread safety attribute from CChain methods
DeckerSU Sep 9, 2022
58fd905
fix build, correct syntax and other errors after applying #559 changes
DeckerSU Sep 9, 2022
04e44f2
komodo_gateway.cpp: move log into debug.log, instead of console
DeckerSU Sep 9, 2022
6acc6a4
komodo_hardfork: avoid build error with CXXFLAGS='-g -O0'
DeckerSU Sep 9, 2022
7f93ad8
qt/komodo.cpp -> qt/komodoapp.cpp to avoid conflict with names in gdb
DeckerSU Sep 9, 2022
32f43bb
fix tests build (--enable-tests=yes)
DeckerSU Sep 9, 2022
16b5f5c
report about komodostate parse error in messagebox, instead of console
DeckerSU Sep 9, 2022
8ca9794
Qt: fix komodo units display, disable interest display for ACs
DeckerSU Sep 9, 2022
30c14f2
configure libgmp on Linux with --with-pic=yes
DeckerSU Sep 12, 2022
d9e8902
remove unused sources from repo (after #559)
DeckerSU Sep 12, 2022
68b0545
get rid of LibTomCrypt derived hash implementations
DeckerSU Sep 13, 2022
74ba7f4
remove cryptoconditions-config.h.in generated by autoheader
DeckerSU Sep 13, 2022
dd6f484
fix function(s) invokations after inaccurate merge branches
DeckerSU Sep 15, 2022
3269d5b
fix treating std as a label, name it's a variable of std::string type
DeckerSU Sep 15, 2022
ba3a059
more pegs, hush, marmara code removed
DeckerSU Sep 16, 2022
d2f32d6
add komodo_interest_validate, komodo_interest unit tests by dimxy
DeckerSU Sep 26, 2022
ece67ac
add interest calculations via CCoinsViewCache::GetValueIn test
DeckerSU Sep 26, 2022
3113cf4
Update Qt 5.12.11 download path (official_releases -> archive)
DeckerSU Oct 1, 2022
68f8d3e
Fix AC_CHECK_LIB for gmp
DeckerSU Oct 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ CXXFLAGS="${save_CXXFLAGS}"
# platforms, so we use older autoconf detection mechanisms:
if test x$TARGET_OS = xdarwin; then
AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
AC_CHECK_LIB([gmp],[__gmpn_sub_n],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])

AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/libgmp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(package)_download_path=https://ftp.gnu.org/gnu/gmp
$(package)_file_name=gmp-$($(package)_version).tar.bz2
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
$(package)_dependencies=
$(package)_config_opts=--enable-cxx --disable-shared
$(package)_config_opts=--enable-cxx --disable-shared --with-pic
endif

define $(package)_config_cmds
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/qt.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PACKAGE=qt
$(package)_version=5.12.11
$(package)_download_path=https://download.qt.io/official_releases/qt/5.12/$($(package)_version)/submodules
$(package)_download_path=https://download.qt.io/archive/qt/5.12/$($(package)_version)/submodules
$(package)_suffix=everywhere-src-$($(package)_version).tar.xz
$(package)_file_name=qtbase-$($(package)_suffix)
$(package)_sha256_hash=1c1b4e33137ca77881074c140d54c3c9747e845a31338cfe8680f171f0bc3a39
Expand Down
6 changes: 1 addition & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ libbitcoin_server_a_SOURCES = \
cc/fsm.cpp \
cc/heir.cpp \
cc/oracles.cpp \
cc/prices.cpp \
cc/pegs.cpp \
cc/payments.cpp \
cc/gateways.cpp \
cc/channels.cpp \
Expand All @@ -304,7 +302,6 @@ libbitcoin_server_a_SOURCES = \
checkpoints.cpp \
fs.cpp \
crosschain.cpp \
crosschain_authority.cpp \
deprecation.cpp \
httprpc.cpp \
httpserver.cpp \
Expand Down Expand Up @@ -465,11 +462,10 @@ libbitcoin_common_a_SOURCES = \
komodo_events.cpp \
komodo_gateway.cpp \
komodo_globals.cpp \
komodo_hardfork.cpp \
komodo_interest.cpp \
komodo_jumblr.cpp \
komodo_kv.cpp \
komodo_notary.cpp \
komodo_pax.cpp \
komodo_utils.cpp \
netbase.cpp \
metrics.cpp \
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.ktest.include
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ komodo_test_SOURCES = \
test-komodo/test_events.cpp \
test-komodo/test_hex.cpp \
test-komodo/test_haraka_removal.cpp \
test-komodo/test_miner.cpp
test-komodo/test_oldhash_removal.cpp \
test-komodo/test_kmd_feat.cpp

komodo_test_CPPFLAGS = $(komodod_CPPFLAGS)

Expand Down
6 changes: 3 additions & 3 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ KOMODO_MM = qt/macdockiconhandler.mm
# qt/macnotificationhandler.mm

QT_MOC = \
qt/komodo.moc \
qt/komodoapp.moc \
qt/komodoamountfield.moc \
qt/callback.moc \
qt/intro.moc \
Expand Down Expand Up @@ -438,7 +438,7 @@ qt_komodo_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(KOMODO_QT_INCLUDES)
$(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
qt_komodo_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)

qt_komodo_qt_SOURCES = qt/komodo.cpp
qt_komodo_qt_SOURCES = qt/komodoapp.cpp
if TARGET_DARWIN
qt_komodo_qt_SOURCES += $(KOMODO_MM)
endif
Expand Down Expand Up @@ -526,7 +526,7 @@ $(srcdir)/qt/komodostrings.cpp: $(libkomodo_server_a_SOURCES) $(libkomodo_wallet
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" COPYRIGHT_HOLDERS_SUBSTITUTION="$(COPYRIGHT_HOLDERS_SUBSTITUTION)" $(PYTHON) ../share/qt/extract_strings_qt.py $^

translate: $(srcdir)/qt/komodostrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(KOMODO_QT_BASE_CPP) qt/komodo.cpp $(KOMODO_QT_WINDOWS_CPP) $(KOMODO_QT_WALLET_CPP) $(KOMODO_QT_H) $(KOMODO_MM)
translate: $(srcdir)/qt/komodostrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(KOMODO_QT_BASE_CPP) qt/komodoapp.cpp $(KOMODO_QT_WINDOWS_CPP) $(KOMODO_QT_WALLET_CPP) $(KOMODO_QT_H) $(KOMODO_MM)
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts $(srcdir)/qt/locale/komodo_en.ts

Expand Down
48 changes: 29 additions & 19 deletions src/addrman.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,33 @@ friend class CAddrManTest;
//! Wraps GetRandInt to allow tests to override RandomInt and make it deterministic.
virtual int RandomInt(int nMax);

/***
* @brief Clears the internal collections and fills them again
* @note the mutex should be held before this method is called
* @note the constructor calls this directly with no lock
*/
void Clear_()
{
std::vector<int>().swap(vRandom);
nKey = GetRandHash();
for (size_t bucket = 0; bucket < ADDRMAN_NEW_BUCKET_COUNT; bucket++) {
for (size_t entry = 0; entry < ADDRMAN_BUCKET_SIZE; entry++) {
vvNew[bucket][entry] = -1;
}
}
for (size_t bucket = 0; bucket < ADDRMAN_TRIED_BUCKET_COUNT; bucket++) {
for (size_t entry = 0; entry < ADDRMAN_BUCKET_SIZE; entry++) {
vvTried[bucket][entry] = -1;
}
}

nIdCount = 0;
nTried = 0;
nNew = 0;
mapInfo.clear();
mapAddr.clear();
}

#ifdef DEBUG_ADDRMAN
//! Perform consistency check. Returns an error code or zero.
int Check_();
Expand Down Expand Up @@ -502,29 +529,12 @@ friend class CAddrManTest;
void Clear()
{
LOCK(cs);
std::vector<int>().swap(vRandom);
nKey = GetRandHash();
for (size_t bucket = 0; bucket < ADDRMAN_NEW_BUCKET_COUNT; bucket++) {
for (size_t entry = 0; entry < ADDRMAN_BUCKET_SIZE; entry++) {
vvNew[bucket][entry] = -1;
}
}
for (size_t bucket = 0; bucket < ADDRMAN_TRIED_BUCKET_COUNT; bucket++) {
for (size_t entry = 0; entry < ADDRMAN_BUCKET_SIZE; entry++) {
vvTried[bucket][entry] = -1;
}
}

nIdCount = 0;
nTried = 0;
nNew = 0;
mapInfo.clear();
mapAddr.clear();
Clear_();
}

CAddrMan()
{
Clear();
Clear_();
}

~CAddrMan()
Expand Down
3 changes: 1 addition & 2 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ bool CAlert::ProcessAlert(const std::vector<unsigned char>& alertKey, bool fThre
return true;
}

void
CAlert::Notify(const std::string& strMessage, bool fThread)
void CAlert::Notify(const std::string& strMessage, bool fThread)
{
std::string strCmd = GetArg("-alertnotify", "");
if (strCmd.empty()) return;
Expand Down
10 changes: 5 additions & 5 deletions src/alert.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
#include <stdint.h>
#include <string>

class CAlert;
class CNode;
class uint256;

extern std::map<uint256, CAlert> mapAlerts;
extern CCriticalSection cs_mapAlerts;

/** Alerts are for notifying old versions if they become too obsolete and
Expand Down Expand Up @@ -86,6 +81,9 @@ class CUnsignedAlert
std::string ToString() const;
};

class CNode;
class uint256;

/** An alert is a combination of a serialized CUnsignedAlert and a signature. */
class CAlert : public CUnsignedAlert
{
Expand Down Expand Up @@ -124,4 +122,6 @@ class CAlert : public CUnsignedAlert
static CAlert getAlertByHash(const uint256 &hash);
};

extern std::map<uint256, CAlert> mapAlerts;

#endif // BITCOIN_ALERT_H
14 changes: 2 additions & 12 deletions src/amount.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,18 @@
#ifndef BITCOIN_AMOUNT_H
#define BITCOIN_AMOUNT_H

#include "serialize.h"

#include "serialize.h"
#include <stdlib.h>
#include <string>
#include <cstdint>

typedef int64_t CAmount;

static const CAmount COIN = 100000000;
static const CAmount CENT = 1000000;

extern const std::string CURRENCY_UNIT;

/** No amount larger than this (in satoshi) is valid.
*
* Note that this constant is *not* the total money supply, which in Bitcoin
* currently happens to be less than 21,000,000 BTC for various reasons, but
* rather a sanity check. As this sanity check is used by consensus-critical
* validation code, the exact value of the MAX_MONEY constant is consensus
* critical; in unusual circumstances like a(nother) overflow bug that allowed
* for the creation of coins out of thin air modification could lead to a fork.
* */
//static const CAmount MAX_MONEY = 21000000 * COIN;
extern int64_t MAX_MONEY;

inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
Expand Down
58 changes: 38 additions & 20 deletions src/cc/CCPegs.h → src/assetchain.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
Expand All @@ -12,25 +13,42 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#include <string>

class assetchain
{
public:
assetchain() : symbol_("") {}
assetchain(const std::string& symbol) : symbol_(symbol)
{
if (symbol_.size() > 64)
symbol_ = symbol_.substr(0, 64);
}
/*****
* @returns true if the chain is Komodo
*/
bool isKMD() { return symbol_.empty(); }
/****
* @param in the symbol to compare
* @returns true if this chain's symbol matches
*/
bool isSymbol(const std::string& in) { return in == symbol_; }
/****
* @returns this chain's symbol (will be empty for KMD)
*/
std::string symbol() { return symbol_; }
/****
* @returns this chain's symbol, "KMD" in the case of Komodo
*/
std::string ToString()
{
if (symbol_.empty())
return "KMD";
return symbol_;
}
bool SymbolStartsWith(const std::string& in) { return symbol_.find(in) == 0; }
private:
std::string symbol_;
};

#ifndef CC_PEGS_H
#define CC_PEGS_H

#include "CCinclude.h"

bool PegsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);

// CCcustom
UniValue PegsCreate(const CPubKey& pk,uint64_t txfee,int64_t amount,std::vector<uint256> bindtxids);
UniValue PegsFund(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
UniValue PegsGet(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
UniValue PegsRedeem(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid);
UniValue PegsLiquidate(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint256 liquidatetxid);
UniValue PegsExchange(const CPubKey& pk,uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t amount);
UniValue PegsAccountHistory(const CPubKey& pk,uint256 pegstxid);
UniValue PegsAccountInfo(const CPubKey& pk,uint256 pegstxid);
UniValue PegsWorstAccounts(uint256 pegstxid);
UniValue PegsInfo(uint256 pegstxid);

#endif
extern assetchain chainName;
9 changes: 5 additions & 4 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
#include <event2/buffer.h>
#include <event2/keyvalq_struct.h>
#include "support/events.h"
#include "assetchain.h"

uint16_t BITCOIND_RPCPORT = 7771;
char ASSETCHAINS_SYMBOL[65];
assetchain chainName;

#include <univalue.h>

Expand Down Expand Up @@ -95,10 +97,9 @@ static int AppInitRPC(int argc, char* argv[])
// Parameters
//
ParseParameters(argc, argv);
std:string name;
name = GetArg("-ac_name","");
std::string name = GetArg("-ac_name","");
if ( !name.empty() )
strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1);
chainName = assetchain(name);

if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo();
Expand Down
Loading