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]
*/
// 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++) {
CTxDestination dest = DecodeDestination(vecParsed1[i]);
if (!IsValidDestination(dest)) {
@ -535,12 +538,8 @@ void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, c
LogPrintf("%s\n", 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.
- Post 12.3+ (test multisig coinbase transaction)
*/
if (!fAllowScript) {
const CScriptID *scriptID = boost::get<CScriptID>(&dest);
if (scriptID) {
std::ostringstream ostr;
@ -548,6 +547,7 @@ void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, c
LogPrintf("%s\n", ostr.str());
throw std::runtime_error(ostr.str());
}
}
CAmount nAmount = ParsePaymentAmount(vecParsed2[i]);

View File

@ -1094,7 +1094,9 @@ void CGovernanceManager::AddCachedTriggers()
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();
LogPrintf("Preparing masternode indexes and governance triggers...\n");
RebuildIndexes();