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

This commit is contained in:
UdjinM6 2022-08-17 16:45:04 +03:00 committed by GitHub
parent 8773a21b30
commit af085cd528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,12 +538,8 @@ 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); const CScriptID *scriptID = boost::get<CScriptID>(&dest);
if (scriptID) { if (scriptID) {
std::ostringstream ostr; std::ostringstream ostr;
@ -548,6 +547,7 @@ 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());
} }
}
CAmount nAmount = ParsePaymentAmount(vecParsed2[i]); CAmount nAmount = ParsePaymentAmount(vecParsed2[i]);

View File

@ -1098,7 +1098,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();