Skip to content

Commit

Permalink
Merge pull request #8 from DeckerSU/static-dev
Browse files Browse the repository at this point in the history
latest changes static-dev -> static
  • Loading branch information
DeckerSU authored Mar 1, 2020
2 parents 2d7fe5c + 547c754 commit 27f2631
Show file tree
Hide file tree
Showing 22 changed files with 140 additions and 84 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,6 @@ src/config/komodo-config.h.in
src/komodod
src/qt/komodo-qt

# chain files for iguana
src/qt/*_7776

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# KomodoOcean (komodo-qt) #

![](./doc/images/komodo-qt-promo-10.png)
![Downloads](https://img.shields.io/github/downloads/DeckerSU/KomodoOcean/total)

Komodo-Qt (KomodoOcean) is a world-first Qt native wallet for KMD ([Komodo](https://komodoplatform.com/)) and all of assetchains. It's available for three OS platforms - Windows, Linux, MacOS.
![](./doc/images/komodo-qt-promo-2020-01.jpg)

Komodo-Qt (KomodoOcean) is a world-first Qt native wallet for KMD ([Komodo](https://komodoplatform.com/)) and smartchains (assetchains). It's available for three OS platforms - Windows, Linux, MacOS.

**NB!** Earlier (till 23.05.2019) we had three branches:

Expand All @@ -19,7 +21,7 @@ Use the following scripts to build:
- Windows: `build-win.sh` (cross-compilation for Win)
- MacOS: `build-mac.sh` (native build)

`master` branch still can be used to build Windows version of Komodo-Qt with MSVC compiler.
`master` branch **can't** be used anymore to build actual wallet version, but it still can be used as an example of build with MSVC compiler. To build actual version plz use `static` branch.

Visit [#wallet-ocean-qt](https://discord.gg/U5WWaJR) channel in Komodo Discord for more information.

Expand Down Expand Up @@ -95,5 +97,5 @@ cd komodo

## Developers of Qt wallet ##

- Main developer: [@Ocean](https://komodo-platform.slack.com/team/U8BRG09EV)
- IT Expert / Sysengineer: [@Decker](https://komodo-platform.slack.com/messages/D5UHJMCJ3)
- Main developer: **Ocean**
- IT Expert / Sysengineer: **Decker**
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define(_CLIENT_VERSION_BUILD, 1)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
define(_COPYRIGHT_YEAR, 2020)
define(_COPYRIGHT_HOLDERS, "The %s developers")
define(_COPYRIGHT_HOLDERS_SUBSTITUTION, "Ocean and Decker")

Expand Down
2 changes: 1 addition & 1 deletion depends/packages/boost.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package=boost

$(package)_version=1_72_0
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.72.0/source
$(package)_download_path=https://github.com/KomodoPlatform/boost/releases/download/boost-1.72.0-kmd
$(package)_sha256_hash=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722
$(package)_file_name=$(package)_$($(package)_version).tar.bz2

Expand Down
Binary file removed doc/images/komodo-qt-promo-10.png
Binary file not shown.
Binary file added doc/images/komodo-qt-promo-2020-01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace Checkpoints {
fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
}

return fWorkBefore / (fWorkBefore + fWorkAfter);
return std::min(fWorkBefore / (fWorkBefore + fWorkAfter), 1.0);
}

int GetTotalBlocksEstimate(const CChainParams::CCheckpointData& data)
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* Copyright year (2009-this)
* Todo: update this when changing our copyright comments in the source
*/
#define COPYRIGHT_YEAR 2019
#define COPYRIGHT_YEAR 2020

#endif //HAVE_CONFIG_H

Expand Down
40 changes: 34 additions & 6 deletions src/httpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "rpc/protocol.h" // For HTTP status codes
#include "sync.h"
#include "ui_interface.h"
#include "utilstrencodings.h"

#include <stdio.h>
#include <stdlib.h>
Expand All @@ -24,6 +25,7 @@
#include <event2/http.h>
#include <event2/thread.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/util.h>
#include <event2/keyvalq_struct.h>

Expand Down Expand Up @@ -249,23 +251,37 @@ static std::string RequestMethodString(HTTPRequest::RequestMethod m)
/** HTTP request callback */
static void http_request_cb(struct evhttp_request* req, void* arg)
{
// Disable reading to work around a libevent bug, fixed in 2.2.0.
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
evhttp_connection* conn = evhttp_request_get_connection(req);
if (conn) {
bufferevent* bev = evhttp_connection_get_bufferevent(conn);
if (bev) {
bufferevent_disable(bev, EV_READ);
}
}
}
std::unique_ptr<HTTPRequest> hreq(new HTTPRequest(req));

LogPrint("http", "Received a %s request for %s from %s\n",
RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), hreq->GetPeer().ToString());

// Early address-based allow check
if (!ClientAllowed(hreq->GetPeer())) {
LogPrint("http", "HTTP request from %s rejected: Client network is not allowed RPC access\n",
hreq->GetPeer().ToString());
hreq->WriteReply(HTTP_FORBIDDEN);
return;
}

// Early reject unknown HTTP methods
if (hreq->GetRequestMethod() == HTTPRequest::UNKNOWN) {
LogPrint("http", "HTTP request from %s rejected: Unknown HTTP request method\n",
hreq->GetPeer().ToString());
hreq->WriteReply(HTTP_BADMETHOD);
return;
}

LogPrint("http", "Received a %s request for %s from %s\n",
RequestMethodString(hreq->GetRequestMethod()), SanitizeString(hreq->GetURI(), SAFE_CHARS_URI).substr(0, 100), hreq->GetPeer().ToString());

// Find registered handler for prefix
std::string strURI = hreq->GetURI();
std::string path;
Expand Down Expand Up @@ -599,8 +615,21 @@ void HTTPRequest::WriteReply(int nStatus, const std::string& strReply)
struct evbuffer* evb = evhttp_request_get_output_buffer(req);
assert(evb);
evbuffer_add(evb, strReply.data(), strReply.size());
HTTPEvent* ev = new HTTPEvent(eventBase, true,
boost::bind(evhttp_send_reply, req, nStatus, (const char*)NULL, (struct evbuffer *)NULL));
auto req_copy = req;
HTTPEvent* ev = new HTTPEvent(eventBase, true, [req_copy, nStatus]{
evhttp_send_reply(req_copy, nStatus, (const char*)NULL, (struct evbuffer *)NULL);
// Re-enable reading from the socket. This is the second part of the libevent
// workaround above.
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
evhttp_connection* conn = evhttp_request_get_connection(req_copy);
if (conn) {
bufferevent* bev = evhttp_connection_get_bufferevent(conn);
if (bev) {
bufferevent_enable(bev, EV_READ | EV_WRITE);
}
}
}
});
ev->trigger(0);
replySent = true;
req = 0; // transferred back to main thread
Expand Down Expand Up @@ -665,4 +694,3 @@ void UnregisterHTTPHandler(const std::string &prefix, bool exactMatch)
pathHandlers.erase(i);
}
}

27 changes: 1 addition & 26 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,32 +1539,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)

fReindex = GetBoolArg("-reindex", false);

// Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
boost::filesystem::path blocksDir = GetDataDir() / "blocks";
if (!boost::filesystem::exists(blocksDir))
{
boost::filesystem::create_directories(blocksDir);
bool linked = false;
for (unsigned int i = 1; i < 10000; i++) {
boost::filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i);
if (!boost::filesystem::exists(source)) break;
boost::filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1);
try {
boost::filesystem::create_hard_link(source, dest);
LogPrintf("Hardlinked %s -> %s\n", source.string(), dest.string());
linked = true;
} catch (const boost::filesystem::filesystem_error& e) {
// Note: hardlink creation failing is not a disaster, it just means
// blocks will get re-downloaded from peers.
LogPrintf("Error hardlinking blk%04u.dat: %s\n", i, e.what());
break;
}
}
if (linked)
{
fReindex = true;
}
}
boost::filesystem::create_directories(GetDataDir() / "blocks");

// block tree db settings
int dbMaxOpenFiles = GetArg("-dbmaxopenfiles", DEFAULT_DB_MAX_OPEN_FILES);
Expand Down
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority");
}

// std::cerr << __func__ << ": " << tx.GetHash().ToString() << " nFees = " << nFees << " ::minRelayTxFee.GetFee(" << nSize << ") = " << ::minRelayTxFee.GetFee(nSize) << " nTotal = " << tx.GetValueOut() << std::endl;

// Continuously rate-limit free (really, very-low-fee) transactions
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
// be annoying or make others' transactions take longer to confirm.
Expand All @@ -2040,7 +2042,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
{
LogPrintf("accept failure.7\n");
return state.DoS(0, error("AcceptToMemoryPool: free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "rate limited free transaction");
//return state.DoS(0, error("AcceptToMemoryPool: free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "rate limited free transaction");
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "rate limited free transaction");
}
LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
dFreeCount += nSize;
Expand Down
38 changes: 36 additions & 2 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
if (!mempool.mapTx.count(txin.prevout.hash))
{
LogPrintf("ERROR: mempool transaction missing input\n");
if (fDebug) assert("mempool transaction missing input" == 0);
// if (fDebug) assert("mempool transaction missing input" == 0);
fMissingInputs = true;
if (porphan)
vOrphan.pop_back();
Expand Down Expand Up @@ -502,6 +502,40 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32

// Size limits
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);

// Opret spam limits
if (mapArgs.count("-opretmintxfee"))
{
CAmount n = 0;
CFeeRate opretMinFeeRate;
if (ParseMoney(mapArgs["-opretmintxfee"], n) && n > 0)
opretMinFeeRate = CFeeRate(n);
else
opretMinFeeRate = CFeeRate(400000); // default opretMinFeeRate (1 KMD per 250 Kb = 0.004 per 1 Kb = 400000 sat per 1 Kb)

bool fSpamTx = false;
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
unsigned int nTxOpretSize = 0;

// calc total oprets size
BOOST_FOREACH(const CTxOut& txout, tx.vout) {
if (txout.scriptPubKey.IsOpReturn()) {
CScript::const_iterator it = txout.scriptPubKey.begin() + 1;
opcodetype op;
std::vector<uint8_t> opretData;
if (txout.scriptPubKey.GetOp(it, op, opretData)) {
//std::cerr << HexStr(opretData.begin(), opretData.end()) << std::endl;
nTxOpretSize += opretData.size();
}
}
}

if ((nTxOpretSize > 256) && (feeRate < opretMinFeeRate)) fSpamTx = true;
// std::cerr << tx.GetHash().ToString() << " nTxSize." << nTxSize << " nTxOpretSize." << nTxOpretSize << " feeRate." << feeRate.ToString() << " opretMinFeeRate." << opretMinFeeRate.ToString() << " fSpamTx." << fSpamTx << std::endl;
if (fSpamTx) continue;
// std::cerr << tx.GetHash().ToString() << " vecPriority.size() = " << vecPriority.size() << std::endl;
}

if (nBlockSize + nTxSize >= nBlockMaxSize-512) // room for extra autotx
{
//LogPrintf("nBlockSize %d + %d nTxSize >= %d nBlockMaxSize\n",(int32_t)nBlockSize,(int32_t)nTxSize,(int32_t)nBlockMaxSize);
Expand Down Expand Up @@ -1939,7 +1973,7 @@ void static BitcoinMiner()
//LogPrintf("gotinvalid.%d\n",gotinvalid);
if ( gotinvalid != 0 )
break;
komodo_longestchain();
// komodo_longestchain();
// Hash state
KOMODO_CHOSEN_ONE = 0;

Expand Down
8 changes: 7 additions & 1 deletion src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

/******************************************************************************
* Copyright 2014-2019 The SuperNET Developers. *
* Copyright © 2014-2019 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
Expand Down Expand Up @@ -107,6 +107,11 @@ double GetNetworkDifficulty(const CBlockIndex* blockindex)
return GetDifficultyINTERNAL(blockindex, true);
}

UniValue letsdebug(const UniValue& params, bool fHelp, const CPubKey& mypk) {
// here should be a code for letsdebug test RPC
return NullUniValue;
}

static UniValue ValuePoolDesc(
const std::string &name,
const boost::optional<CAmount> chainValue,
Expand Down Expand Up @@ -2112,6 +2117,7 @@ static const CRPCCommand commands[] =
/* Not shown in help */
{ "hidden", "invalidateblock", &invalidateblock, true },
{ "hidden", "reconsiderblock", &reconsiderblock, true },
{ "hidden", "letsdebug", &letsdebug, true },
};

void RegisterBlockchainRPCCommands(CRPCTable &tableRPC)
Expand Down
1 change: 1 addition & 0 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "height_MoM", 1},
{ "calc_MoM", 2},
{ "migrate_completeimporttransaction", 1},
{ "letsdebug", 1 }
};

class CRPCConvertTable
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int8_t StakedNotaryID(std::string &notaryname, char *Raddress);
uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount);
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);

#define KOMODO_VERSION "0.5.1"
#define KOMODO_VERSION "0.5.2"
#define VERUS_VERSION "0.4.0g"
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
extern uint32_t ASSETCHAINS_CC;
Expand Down
1 change: 1 addition & 0 deletions src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ static const CRPCCommand vRPCCommands[] =
{ "blockchain", "minerids", &minerids, true },
{ "blockchain", "kvsearch", &kvsearch, true },
{ "blockchain", "kvupdate", &kvupdate, true },
{ "blockchain", "letsdebug", &letsdebug, true },

/* Cross chain utilities */
{ "crosschain", "MoMoMdata", &MoMoMdata, true },
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,6 @@ extern UniValue pricesaddfunding(const UniValue& params, bool fHelp, const CPubK
extern UniValue pricesgetorderbook(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue pricesrefillfund(const UniValue& params, bool fHelp, const CPubKey& mypk);


extern UniValue letsdebug(const UniValue& params, bool fHelp, const CPubKey& mypk);

#endif // BITCOIN_RPCSERVER_H
3 changes: 2 additions & 1 deletion src/utilstrencodings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ static const string CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO
static const string SAFE_CHARS[] =
{
CHARS_ALPHA_NUM + " .,;_/:?@()", // SAFE_CHARS_DEFAULT
CHARS_ALPHA_NUM + " .,;_?@" // SAFE_CHARS_UA_COMMENT
CHARS_ALPHA_NUM + " .,;_?@", // SAFE_CHARS_UA_COMMENT
CHARS_ALPHA_NUM + "!*'();:@&=+$,/?#[]-_.~%" // SAFE_CHARS_URI
};

string SanitizeString(const string& str, int rule)
Expand Down
3 changes: 2 additions & 1 deletion src/utilstrencodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
enum SafeChars
{
SAFE_CHARS_DEFAULT, //!< The full set of allowed chars
SAFE_CHARS_UA_COMMENT //!< BIP-0014 subset
SAFE_CHARS_UA_COMMENT, //!< BIP-0014 subset
SAFE_CHARS_URI //!< Chars allowed in URIs (RFC 3986)
};

std::string SanitizeFilename(const std::string& str);
Expand Down
4 changes: 2 additions & 2 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

/******************************************************************************
* Copyright 2014-2019 The SuperNET Developers. *
* Copyright © 2014-2019 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
Expand All @@ -24,7 +24,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 170008;
static const int PROTOCOL_VERSION = 170009;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down
Loading

0 comments on commit 27f2631

Please sign in to comment.