Browse Source

Multiple changes for critical update, including random locks and activation at 12800. Test for utxos.

pull/4/head
Michael Toutonghi 6 years ago
parent
commit
74329e19f8
  1. 8
      src/base58.cpp
  2. 1
      src/base58.h
  3. 4
      src/chainparams.cpp
  4. 13
      src/coins.h
  5. 2
      src/komodo_bitcoind.h
  6. 19
      src/komodo_utils.h
  7. 2
      src/main.cpp
  8. 36
      src/veruslaunch.cpp
  9. 16
      src/veruslaunch.h

8
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);

1
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;
};

4
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<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
fMiningRequiresPeers = true;
//fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = true;
fMineBlocksOnDemand = false;

13
src/coins.h

@ -24,6 +24,7 @@
#include <boost/foreach.hpp>
#include <boost/unordered_map.hpp>
#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<std::string, CScript> 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<unsigned char> adr = std::vector<unsigned char>(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;
}

2
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;
}

19
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);
}

2
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");

36
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 <string>
#include <cstring>
#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"};

16
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 <string>
#define WHITELIST_COUNT 13
extern const char *whitelist_ids[WHITELIST_COUNT];
extern const char *whitelist_addrs[WHITELIST_COUNT];
#endif
Loading…
Cancel
Save