diff --git a/src/base58.cpp b/src/base58.cpp index c086cc854..b85803569 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -302,6 +302,14 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const return true; } +bool CBitcoinAddress::GetKeyID_NoCheck(CKeyID& keyID) const +{ + uint160 id; + memcpy(&id, &vchData[0], 20); + keyID = CKeyID(id); + return true; +} + bool CBitcoinAddress::IsScript() const { return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS); diff --git a/src/base58.h b/src/base58.h index 73e1c4d94..4e8b2c3ce 100644 --- a/src/base58.h +++ b/src/base58.h @@ -163,6 +163,7 @@ public: CTxDestination Get() const; bool GetKeyID(CKeyID &keyID) const; + bool GetKeyID_NoCheck(CKeyID& keyID) const; bool GetIndexKey(uint160& hashBytes, int& type) const; bool IsScript() const; }; diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 5decd0e5d..cc6f11ea2 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -92,7 +92,7 @@ public: { strNetworkID = "main"; strCurrencyUnits = "KMD"; - consensus.fCoinbaseMustBeProtected = true; // this is only enforced after block 10080 on Verus + consensus.fCoinbaseMustBeProtected = true; // this is only enforced after block 12800 on Verus consensus.nSubsidySlowStartInterval = 20000; consensus.nSubsidyHalvingInterval = 840000; consensus.nMajorityEnforceBlockUpgrade = 750; @@ -181,7 +181,7 @@ public: vFixedSeeds = std::vector(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); - fMiningRequiresPeers = true; + //fMiningRequiresPeers = true; fDefaultConsistencyChecks = false; fRequireStandard = true; fMineBlocksOnDemand = false; diff --git a/src/coins.h b/src/coins.h index f010af198..14cfbfee8 100644 --- a/src/coins.h +++ b/src/coins.h @@ -24,6 +24,7 @@ #include #include #include "zcash/IncrementalMerkleTree.hpp" +#include "veruslaunch.h" /** * Pruned version of CTransaction: only retains metadata and unspent transaction outputs @@ -444,17 +445,17 @@ class CLaunchMap { public: std::unordered_map lmap; - CLaunchMap() : lmap() { } - CLaunchMap(std::string *whiteList, std::string *pkh, int count) : lmap() + CLaunchMap() : lmap() { - for (int i = 0; i < count; i++) + for (int i = 0; i < WHITELIST_COUNT; i++) { - CBitcoinAddress address(pkh[i].c_str()); + printf("txid: %s -> addr: %s", whitelist_ids[i], whitelist_addrs[i]); + CBitcoinAddress address(whitelist_addrs[i]); CKeyID key; - if (address.IsValid() && address.GetKeyID(key)) + if (address.GetKeyID_NoCheck(key)) { std::vector adr = std::vector(key.begin(), key.end()); - std::string hash = uint256S(whiteList[i]).ToString(); + std::string hash = uint256S(whitelist_ids[i]).ToString(); lmap[hash] = CScript(); lmap[hash] << OP_DUP << OP_HASH160 << adr << OP_EQUALVERIFY << OP_CHECKSIG; } diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 3bff063ad..e87bf3727 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1330,7 +1330,7 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height) strcpy(voutaddr, CBitcoinAddress(voutaddress).ToString().c_str()); strcpy(destaddr, CBitcoinAddress(destaddress).ToString().c_str()); strcpy(cbaddr, CBitcoinAddress(cbaddress).ToString().c_str()); - if ( !strcmp(destaddr,voutaddr) && ( !strcmp(destaddr,cbaddr) || (height < 10080)) ) + if ( !strcmp(destaddr,voutaddr) && ( !strcmp(destaddr,cbaddr) || (height < 12800)) ) { isPOS = true; } diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 2fa46819a..62f178bf1 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1052,11 +1052,20 @@ int64_t komodo_block_unlocktime(uint32_t nHeight) unlocktime = ASSETCHAINS_TIMEUNLOCKTO; else { - unlocktime = komodo_block_prg(nHeight) / (0xffffffffffffffff / ((ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM) + 1)); - // boundary and power of 2 can make it exceed to time by 1 - unlocktime = unlocktime + ASSETCHAINS_TIMEUNLOCKFROM; - if (unlocktime > ASSETCHAINS_TIMEUNLOCKTO) - unlocktime--; + if (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || nHeight >= 12800) + { + unlocktime = komodo_block_prg(nHeight) % (ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM); + // boundary and power of 2 can make it exceed to time by 1 + unlocktime = unlocktime + ASSETCHAINS_TIMEUNLOCKFROM; + } + else + { + unlocktime = komodo_block_prg(nHeight) / (0xffffffffffffffff / ((ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM) + 1)); + // boundary and power of 2 can make it exceed to time by 1 + unlocktime = unlocktime + ASSETCHAINS_TIMEUNLOCKFROM; + if (unlocktime > ASSETCHAINS_TIMEUNLOCKTO) + unlocktime--; + } } return ((int64_t)unlocktime); } diff --git a/src/main.cpp b/src/main.cpp index d8d30ec20..1ec144326 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2069,7 +2069,7 @@ namespace Consensus { if (fCoinbaseEnforcedProtectionEnabled && consensusParams.fCoinbaseMustBeProtected && !tx.vout.empty() && - (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || (nSpendHeight >= 10080 && coins->nHeight >= 10080))) { + (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || (nSpendHeight >= 12800 && coins->nHeight >= 12800))) { return state.Invalid( error("CheckInputs(): tried to spend coinbase with transparent outputs"), REJECT_INVALID, "bad-txns-coinbase-spend-has-transparent-outputs"); diff --git a/src/veruslaunch.cpp b/src/veruslaunch.cpp new file mode 100644 index 000000000..d5fa76700 --- /dev/null +++ b/src/veruslaunch.cpp @@ -0,0 +1,36 @@ +// Copyright (c) 2018 The Verus developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include +#include "veruslaunch.h" + + +const char *whitelist_ids[WHITELIST_COUNT] = {"1e4b6bf2306c4eb2e6be032176a749797facd387937b132c0d2ffd6dc8ec0c7b", + "21681d1cacbdc8ba403bc66b129cce4ca72a61adf0ef12504b4fbb07a613f735", + "2dc18aac1a8f97b991d1a2b67fa606f29c27b721e939c7b08a52da789900627c", + "41beb053cf1e516033316a69ab883584cd42546d1d7613181cf3d948eeaf1e6a", + "45fae92ebc1cdaf9187b92f0feb5e262b3dcadc37f3cde48a9b9da88f01b9195", + "5e7b24d571d7b21c1a2077ec8dc1b479d16c490d51ef11cc7c81af5dcb36b56f", + "6e1338aaf678121296d7a0ba26e2feead3f609cc928add8bd4798bb1af6ef70a", + "75150d61723081dd13259a88e75968e7b3ac2f8ae7293fc73624d9f188dcc091", + "b58418bdf076bf44d42552b426a5ab79cdabd08212a59d44779933df53b77ef3", + "c1d9c633ec3be4a06a27b84aa31a9571841f8583a23fd100e90c2e7b80b7641e", + "d73d18497cc888713655ee65b3525a502b9758196b0d6d3f81509f1c78f3d347", + "e8a56cfa01f4dc10160f22c8a843875b3b6e31d323db4293967363ed10258970", + "fe9fad13f69365496962dc8e02d2aa58c5ec605a2156ab40f24f6b9ea82d58b5"}; + +const char *whitelist_addrs[WHITELIST_COUNT] = {"RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9", + "RNK1PPPFzzT4rBFE2CtKHjJNa7qkPRE3U9"}; diff --git a/src/veruslaunch.h b/src/veruslaunch.h new file mode 100644 index 000000000..ce33b9e3d --- /dev/null +++ b/src/veruslaunch.h @@ -0,0 +1,16 @@ + +// Copyright (c) 2018 The Verus developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef VERUS_LAUNCH_H +#define VERUS_LAUNCH_H + +#include + +#define WHITELIST_COUNT 13 + +extern const char *whitelist_ids[WHITELIST_COUNT]; +extern const char *whitelist_addrs[WHITELIST_COUNT]; + +#endif