fix: Allow triggers with p2sh after DIP0024 (#4973)

This commit is contained in:
UdjinM6 2022-08-17 16:45:04 +03:00 committed by pasta
parent 269fba2819
commit 6f40461bb7
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 14 additions and 12 deletions

View File

@ -527,6 +527,9 @@ void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, c
AMOUNTS = [AMOUNT1|2|3|4|5|6] AMOUNTS = [AMOUNT1|2|3|4|5|6]
*/ */
// TODO: script addresses limit here and cs_main lock in
// CGovernanceManager::InitOnLoad()once DIP0024 is active
bool fAllowScript = (VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024) == ThresholdState::ACTIVE);
for (int i = 0; i < (int)vecParsed1.size(); i++) { for (int i = 0; i < (int)vecParsed1.size(); i++) {
CTxDestination dest = DecodeDestination(vecParsed1[i]); CTxDestination dest = DecodeDestination(vecParsed1[i]);
if (!IsValidDestination(dest)) { if (!IsValidDestination(dest)) {
@ -535,18 +538,15 @@ void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, c
LogPrintf("%s\n", ostr.str()); LogPrintf("%s\n", ostr.str());
throw std::runtime_error(ostr.str()); throw std::runtime_error(ostr.str());
} }
/*
TODO
- There might be an issue with multisig in the coinbase on mainnet, we will add support for it in a future release. if (!fAllowScript) {
- Post 12.3+ (test multisig coinbase transaction) const CScriptID *scriptID = boost::get<CScriptID>(&dest);
*/ if (scriptID) {
const CScriptID *scriptID = boost::get<CScriptID>(&dest); std::ostringstream ostr;
if (scriptID) { ostr << "CSuperblock::ParsePaymentSchedule -- Script addresses are not supported yet : " << vecParsed1[i];
std::ostringstream ostr; LogPrintf("%s\n", ostr.str());
ostr << "CSuperblock::ParsePaymentSchedule -- Script addresses are not supported yet : " << vecParsed1[i]; throw std::runtime_error(ostr.str());
LogPrintf("%s\n", ostr.str()); }
throw std::runtime_error(ostr.str());
} }
CAmount nAmount = ParsePaymentAmount(vecParsed2[i]); CAmount nAmount = ParsePaymentAmount(vecParsed2[i]);

View File

@ -1094,7 +1094,9 @@ void CGovernanceManager::AddCachedTriggers()
void CGovernanceManager::InitOnLoad() void CGovernanceManager::InitOnLoad()
{ {
LOCK(cs); // TODO: drop cs_main here and script addresses limit in
// CSuperblock::ParsePaymentSchedule() once DIP0024 is active
LOCK2(cs_main, cs);
int64_t nStart = GetTimeMillis(); int64_t nStart = GetTimeMillis();
LogPrintf("Preparing masternode indexes and governance triggers...\n"); LogPrintf("Preparing masternode indexes and governance triggers...\n");
RebuildIndexes(); RebuildIndexes();