Disable PAK loading from configuration on init, disable pak test

This commit is contained in:
Gregory Sanders 2019-05-31 12:09:58 -04:00
parent 918896d6ff
commit 16b87ba951
2 changed files with 3 additions and 69 deletions

View file

@ -67,7 +67,6 @@
#include <boost/thread.hpp>
#include <openssl/crypto.h>
#include <primitives/pak.h> // CPAKList
#include <assetsdir.h> // InitGlobalAssetDir
#include <pegins.h>
@ -1870,72 +1869,7 @@ bool AppInitMain(InitInterfaces& interfaces)
return false;
}
// ********************************************************* Step 13: Load PAK List
// First, make sure -enforce_pak and -acceptnonstdtxn aren't conflicting
if (Params().GetEnforcePak() && gArgs.GetBoolArg("-acceptnonstdtxn", !Params().RequireStandard())) {
return InitError("-enforce_pak can not be true if the network accepts non-standard transactions for relay.");
}
//Entire list of PAK entries from conf must be of valid format
std::vector<std::string> pak_list_str = gArgs.GetArgs("-pak");
bool valid_paklist = true;
bool is_reject = false;
std::vector<std::vector<unsigned char> > offline_keys;
std::vector<std::vector<unsigned char> > online_keys;
for (unsigned int i = 0; i < pak_list_str.size(); i++) {
if (pak_list_str[i] == "reject") {
is_reject = true;
continue;
}
size_t colon_index = pak_list_str[i].find(":");
if (colon_index == std::string::npos) {
valid_paklist = false;
break;
}
std::string offline = pak_list_str[i].substr(0, colon_index);
std::string online = pak_list_str[i].substr(colon_index + 1);
if (!IsHex(offline) || !IsHex(online) || offline.size() != 66 || online.size() != 66) {
valid_paklist = false;
break;
}
online_keys.push_back(ParseHex(online));
offline_keys.push_back(ParseHex(offline));
}
// pak=reject must be alone
if (is_reject && offline_keys.size() > 0)
valid_paklist = false;
if (!valid_paklist)
return InitError(_("ERROR: Invalid PAK entries given in conf file."));
if (is_reject || offline_keys.size() > 0) {
CPAKList paklist;
if(CPAKList::FromBytes(paklist, offline_keys, online_keys, is_reject)) {
g_paklist_config = paklist;
} else {
return InitError(_("ERROR: Invalid PAK entries given in conf file."));
}
} else {
g_paklist_config = boost::none;
}
// Read and parse committed pak list from disk
CPAKList paklist;
offline_keys.resize(0);
online_keys.resize(0);
bool reject;
if (pblocktree->ReadPAKList(offline_keys, online_keys, reject)) {
if (CPAKList::FromBytes(paklist, offline_keys, online_keys, reject)) {
g_paklist_blockchain = paklist;
} else {
return InitError(_("ERROR: Read invalid PAK list."));
}
}
// ********************************************************* Step 14: Check fedpeg
// ********************************************************* Step 13: Check fedpeg
// ELEMENTS:
if (chainparams.GetConsensus().has_parent_chain) {
// Will assert if not properly formatted
@ -1949,7 +1883,7 @@ bool AppInitMain(InitInterfaces& interfaces)
}
}
// ********************************************************* Step 15: finished
// ********************************************************* Step 14: finished
SetRPCWarmupFinished();

View file

@ -74,7 +74,7 @@ BASE_SCRIPTS = [
'feature_block_subsidy.py',
'feature_connect_genesis_outputs.py',
'feature_block_v4.py',
'feature_pak.py',
#TODO re-enable 'feature_pak.py',
'feature_blocksign.py',
'rpc_calcfastmerkleroot.py',
'feature_txwitness.py',