Skip to content

Commit 9a8e485

Browse files
committed
evo: utilize NetInfoEntry::IsTriviallyValid() in ProTx trivial checks
Also, ProRegTx allows an empty netInfo, ProUpServTx does not, so we should check that ProUpServTx::netInfo isn't empty.
1 parent 4a64950 commit 9a8e485

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/evo/providertx.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ bool CProRegTx::IsTriviallyValid(bool is_basic_scheme_active, TxValidationState&
3636
if (!scriptPayout.IsPayToPublicKeyHash() && !scriptPayout.IsPayToScriptHash()) {
3737
return state.Invalid(TxValidationResult::TX_BAD_SPECIAL, "bad-protx-payee");
3838
}
39+
for (const NetInfoEntry& entry : netInfo.GetEntries()) {
40+
if (!entry.IsTriviallyValid()) {
41+
return state.Invalid(TxValidationResult::TX_BAD_SPECIAL, "bad-protx-netinfo-bad");
42+
}
43+
}
3944

4045
CTxDestination payoutDest;
4146
if (!ExtractDestination(scriptPayout, payoutDest)) {
@@ -105,6 +110,14 @@ bool CProUpServTx::IsTriviallyValid(bool is_basic_scheme_active, TxValidationSta
105110
if (nVersion < ProTxVersion::BasicBLS && nType == MnType::Evo) {
106111
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-protx-evo-version");
107112
}
113+
if (netInfo.IsEmpty()) {
114+
return state.Invalid(TxValidationResult::TX_BAD_SPECIAL, "bad-protx-netinfo-empty");
115+
}
116+
for (const NetInfoEntry& entry : netInfo.GetEntries()) {
117+
if (!entry.IsTriviallyValid()) {
118+
return state.Invalid(TxValidationResult::TX_BAD_SPECIAL, "bad-protx-netinfo-bad");
119+
}
120+
}
108121

109122
return true;
110123
}

0 commit comments

Comments
 (0)