Skip to content

Commit

Permalink
Merged in update-testnet-20200401 (pull request dashpay#43)
Browse files Browse the repository at this point in the history
Update testnet 20200401

Approved-by: Cevap
  • Loading branch information
FornaxA authored and Cevap committed Apr 2, 2020
2 parents a3ad4dc + d1e7ece commit 0ed567a
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ BITCOIN_CORE_H = \
httpserver.h \
indirectmap.h \
init.h \
invalid.h \
invalid_scripts.h \
ionaddrenc.h \
key.h \
keepass.h \
Expand Down Expand Up @@ -606,6 +608,7 @@ libion_common_a_SOURCES = \
dstencode.cpp \
hdchain.cpp \
ionaddrenc.cpp \
invalid.cpp \
key.cpp \
keystore.cpp \
netaddress.cpp \
Expand Down
11 changes: 6 additions & 5 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ class CTestNetParams : public CChainParams {
consensus.POSPOWStartHeight = 117000;

// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000001088a59861293dfc3"); // 126142
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000106cee2b2baf64cba"); // 119800

// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S("0x0000000005ae4db9746d6cad8e0ccebdef1e05afec9c40809f31457fdaf7d843"); // 95930
Expand Down Expand Up @@ -593,15 +593,16 @@ class CTestNetParams : public CChainParams {
{1, uint256S("0x16ac2683f6ccab2f095a6270d485087e5c441f39a18fd32e00c7bfa996cdf696")},
{5530, uint256S("0xa7332c2034d501bb11f686ae6c224dbcbdf5332c2522204a63224a8ca670c18b")},
{117000, uint256S("0x4c092ef6ad08622df9be8b5287ea29a1e9bfbe6756fd3056b9caebed61c697ca")},
{126142, uint256S("0x0000002e138642509d8417111990895d1b625d58366002d2172aef97e9a97ba9")},
{119254, uint256S("0x65442ee4e4b0116ca7f85fdce633c21cc9e0fafdc7710505adfa21e30c291f84")},
{119800, uint256S("0x445c9f1f85fc15cdadc04f5f9d58de3edfcc8419a0ec8a691e5b235f38a97bc7")},
}
};

chainTxData = ChainTxData{
1583851321, // * UNIX timestamp of last known number of transactions (Block 155400)
251524, // * total number of transactions between genesis and that timestamp
1585764678, // * UNIX timestamp of last known number of transactions (Block 119800)
239608, // * total number of transactions between genesis and that timestamp
// (the tx=... number in the SetBestChain debug.log lines)
0.999999 // * estimated number of transactions per second after that timestamp
0.029999 // * estimated number of transactions per second after that timestamp (2 per minute)
};

}
Expand Down
7 changes: 7 additions & 0 deletions src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "chainparams.h"
#include "consensus.h"
#include "invalid.h"
#include "primitives/transaction.h"
#include "script/interpreter.h"
#include "tokens/groups.h"
Expand Down Expand Up @@ -251,6 +252,12 @@ bool Consensus::CheckTxInputs(const CTransaction& tx, CValidationState& state, c
}
}

if (nSpendHeight >= params.POSPOWStartHeight && invalid_out::ContainsScript(coin.out.scriptPubKey)) {
return state.Invalid(false,
REJECT_INVALID, "bad-txns-inputs-invalid-script",
strprintf("tried to spend invalid script"));
}

// Check for negative or overflow input values
nValueIn += coin.out.nValue;
if (!MoneyRange(coin.out.nValue) || !MoneyRange(nValueIn)) {
Expand Down
3 changes: 3 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "fs.h"
#include "httpserver.h"
#include "httprpc.h"
#include "invalid.h"
#include "key.h"
#include "validation.h"
#include "miner.h"
Expand Down Expand Up @@ -1762,6 +1763,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}

invalid_out::LoadScripts();

// ********************************************************* Step 7b: load block chain

fReindex = gArgs.GetBoolArg("-reindex", false);
Expand Down
29 changes: 29 additions & 0 deletions src/invalid.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2018 The ION Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "invalid.h"
#include "invalid_scripts.h"

#include "utilstrencodings.h"
#include "util.h"

namespace invalid_out
{
std::set<CScript> setInvalidScripts;

bool LoadScripts()
{
for (std::string i : setInvalidScriptStrings) {
std::vector<unsigned char> vch = ParseHex(i);
setInvalidScripts.insert(CScript(vch.begin(), vch.end()));
}
return true;
}

bool ContainsScript(const CScript& out)
{
return static_cast<bool>(setInvalidScripts.count(out));
}
}

19 changes: 19 additions & 0 deletions src/invalid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2018 The ION Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef ION_INVALID_H
#define ION_INVALID_H

#include <univalue/include/univalue.h>
#include "script/script.h"

namespace invalid_out
{
extern std::set<CScript> setInvalidScripts;

bool ContainsScript(const CScript& out);
bool LoadScripts();
}

#endif //ION_INVALID_H
44 changes: 44 additions & 0 deletions src/invalid_scripts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) 2020 The ION Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef ION_INVALID_SCRITPS_H
#define ION_INVALID_SCRIPTS_H

#include <string>

std::set<std::string> setInvalidScriptStrings {
"21027175a4fbfc605d38d677b1a12d57601e12a397d9afecd981f9b4bca3fcb87883ac",
"2103a552cb68d733cc6d4800b1b40a236b70a30985c7c15ea30dc302e8b641610d2cac",
"2103223b429fa067d9dc4ea7b1b9c9e1b7e4f70ebce74cf5bde7e320178f5fed7a3dac",
"210227b8d922a60c41b84a9e04286b0d9dbb07581d724d9f172b16956a341efa0e36ac",
"21032783db97d39960d5ebc2b5eff8a016c6cc179796b863bed12fcbaac8604b62beac",
"210213854d8eb583ec2bbfdc3a44548d26dfc4044203aadf67839f79274ed7a76c38ac",
"2102d5ef80e1b55664f0a3098dddea562886a1ee3b0387c812cd4186da283c647145ac",
"21035fcd15a6248876a15e44d74c196a53907d321bb3c2716470a4a5cb6647cf0e4fac",
"210274cc91782544f01d34e93de0f36d5589064dd49de20ff100e363aa24a98d2908ac",
"2103feadcda4466222b61825de50a8a949d5a2d1e6f9fad809c632230e99f4f855a1ac",
"21022cf5de36cd2d517d7fc52ae1e8e728dd79d61b20514ba8ffe186e016590a473fac",
"210315b4d93eedf16f4133e251444a6d4348b576dccd57c566e994babca75f109582ac",
"2102dc1eb69efaf8bbce679a3489958ad78c5d6660e4a56e38fb2920d071f6c2f6beac",
"210382b7d753aa18e8aa010f79d6b470a4a93ed8a03a5620cffc70dc29165c3a6c02ac",
"2103b01840f03c1bacc89c653a5dc69cabc7bbf99eaefdebe8f822e4631b35c636baac",
"210271f8d111832b55e4e1fa56ddc07c6b985fe832a7536cb9634d555c7a93de4020ac",
"2102fbee5a835f90338af45b348d8e569c6fa21eb68cfdc52916a195dc6f65b58c3cac",
"2103216dd3b355bb344b687b1915adec152347247d1e6398b7ab77ddd540d1d8237fac",
"21038ce56d4b24f80bf9046ceca0c83a8966f20a33617800140dc851597c6b534f37ac",
"2102dacd991aba82b262a2093d6b2808aa05f90dbc7998df8167e9ebc08ca5501e38ac",
"2102c9b2a1b9975e7a9cb8245e6377eed854d9126b5b7e259105db07f02be5d415a3ac",
"2103d3c90bb9118e28b693060e2c7c72cff07e7518bb5e75495520e497f20fa1cb90ac",
"2102b69d00e4305d99bdcddeb3bc015a93b600863e76ea9dbe6f3ad88caed8126c82ac",
"210293b2eaaec56c83b9fe94e52ddbadde7e6583b1868558d0f90ff9a4c1ddc9c61bac",
"210261c950f2d5009f4ce1f7f75c4a523e84e01686762b81ec13a6ec917d3b7963c0ac",
"210242b578ef1b58435b1c840885ac29372e818577dffb7774cabbb1e63c2867f604ac",
"21033b3364b8ec1ad974e7f7c12e6239d2e2c462cef4941c985d115d33b58d22538fac",
"21025b94433c76c6dbc115fbd5deb0d4634ce5ca7222657290de63530c988ba446f8ac",
"2103967d479e13a8fb47380edd0d0bf2eb935adb2509029fd4b155ca73c2ac84f158ac",
"21024f2b47e14859507be3b382332b167be16effa4029fd5a30b33c6d539437e6f00ac",
"2102f664fbde8db7a35f8be96e8a67d55f318581d86682f398268b1bb8afc182d85cac"
};

#endif //ION_INVALID_SCRIPTS_H

0 comments on commit 0ed567a

Please sign in to comment.