Skip to content

Commit 506f1f5

Browse files
committed
feat: remove code forbidding register Evo nodes before v19 activation
It's activated long time ago and this check has no meaning anymore
1 parent 24a0fdd commit 506f1f5

File tree

3 files changed

+4
-55
lines changed

3 files changed

+4
-55
lines changed

src/evo/deterministicmns.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ CDeterministicMNCPtr CDeterministicMNList::GetMNPayee(gsl::not_null<const CBlock
180180
return nullptr;
181181
}
182182

183+
// The flag is-v19-activate is used for optimization; we don't need to go over all masternodes every pre-v19 block
183184
const bool isv19Active{DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
184185
const bool isMNRewardReallocation{DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR)};
185186
// EvoNodes are rewarded 4 blocks in a row until MNRewardReallocation (Platform release)
@@ -737,7 +738,6 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
737738

738739
newList.DecreaseScores();
739740

740-
const bool isV19Active{DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
741741
const bool isMNRewardReallocation{DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR)};
742742

743743
// we skip the coinbase
@@ -756,10 +756,6 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
756756
}
757757
auto& proTx = *opt_proTx;
758758

759-
if (proTx.nType == MnType::Evo && !isV19Active) {
760-
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-protx-payload");
761-
}
762-
763759
auto dmn = std::make_shared<CDeterministicMN>(newList.GetTotalRegisteredCount(), proTx.nType);
764760
dmn->proTxHash = tx.GetHash();
765761

@@ -819,10 +815,6 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
819815
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-protx-payload");
820816
}
821817

822-
if (opt_proTx->nType == MnType::Evo && !DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)) {
823-
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-protx-payload");
824-
}
825-
826818
if (newList.HasUniqueProperty(opt_proTx->addr) && newList.GetUniquePropertyMN(opt_proTx->addr)->proTxHash != opt_proTx->proTxHash) {
827819
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-protx-dup-addr");
828820
}

src/rpc/evo.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,6 @@ static UniValue protx_register_common_wrapper(const JSONRPCRequest& request,
643643
EnsureWalletIsUnlocked(*pwallet);
644644
}
645645

646-
const bool isV19active{DeploymentActiveAfter(WITH_LOCK(cs_main, return chainman.ActiveChain().Tip();), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
647-
if (isEvoRequested && !isV19active) {
648-
throw JSONRPCError(RPC_INVALID_REQUEST, "EvoNodes aren't allowed yet");
649-
}
650-
651646
size_t paramIdx = 0;
652647

653648
CMutableTransaction tx;
@@ -965,11 +960,6 @@ static UniValue protx_update_service_common_wrapper(const JSONRPCRequest& reques
965960

966961
EnsureWalletIsUnlocked(*wallet);
967962

968-
const bool isV19active{DeploymentActiveAfter(WITH_LOCK(cs_main, return chainman.ActiveChain().Tip();), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)};
969-
if (isEvoRequested && !isV19active) {
970-
throw JSONRPCError(RPC_INVALID_REQUEST, "EvoNodes aren't allowed yet");
971-
}
972-
973963
CProUpServTx ptx;
974964
ptx.nType = mnType;
975965
ptx.proTxHash = ParseHashV(request.params[0], "proTxHash");
@@ -1055,6 +1045,8 @@ static UniValue protx_update_service_common_wrapper(const JSONRPCRequest& reques
10551045

10561046
FundSpecialTx(*wallet, tx, ptx, feeSource);
10571047

1048+
const bool isV19active = DeploymentActiveAfter(WITH_LOCK(cs_main, return chainman.ActiveChain().Tip();),
1049+
Params().GetConsensus(), Consensus::DEPLOYMENT_V19);
10581050
SignSpecialTxPayloadByHash(tx, ptx, keyOperator, !isV19active);
10591051
SetTxPayload(tx, ptx);
10601052

test/functional/feature_llmq_evo.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
Checks EvoNodes
1010
1111
'''
12-
from _decimal import Decimal
1312
from io import BytesIO
1413

1514
from test_framework.p2p import P2PInterface
1615
from test_framework.messages import CBlock, CBlockHeader, CCbTx, CMerkleBlock, from_hex, hash256, msg_getmnlistd, \
1716
QuorumId, ser_uint256
1817
from test_framework.test_framework import DashTestFramework
1918
from test_framework.util import (
20-
assert_equal, assert_greater_than_or_equal, p2p_port
19+
assert_equal, assert_greater_than_or_equal,
2120
)
2221

2322

@@ -65,9 +64,6 @@ def run_test(self):
6564
b_0 = self.nodes[0].getbestblockhash()
6665
self.test_getmnlistdiff(null_hash, b_0, {}, [], expectedUpdated)
6766

68-
self.log.info("Test that EvoNodes registration is rejected before v19")
69-
self.test_evo_is_rejected_before_v19()
70-
7167
self.test_masternode_count(expected_mns_count=4, expected_evo_count=0)
7268

7369
self.activate_v19(expected_activation_height=900)
@@ -193,37 +189,6 @@ def test_evo_protx_are_in_mnlist(self, evo_protx_list):
193189
assert_equal(mn_list.get(mn)['type'], "Evo")
194190
assert_equal(found, True)
195191

196-
def test_evo_is_rejected_before_v19(self):
197-
bls = self.nodes[0].bls('generate')
198-
collateral_address = self.nodes[0].getnewaddress()
199-
funds_address = self.nodes[0].getnewaddress()
200-
owner_address = self.nodes[0].getnewaddress()
201-
voting_address = self.nodes[0].getnewaddress()
202-
reward_address = self.nodes[0].getnewaddress()
203-
204-
collateral_amount = 4000
205-
outputs = {collateral_address: collateral_amount, funds_address: 1}
206-
collateral_txid = self.nodes[0].sendmany("", outputs)
207-
self.generate(self.nodes[0], 8)
208-
209-
rawtx = self.nodes[0].getrawtransaction(collateral_txid, 1)
210-
collateral_vout = 0
211-
for txout in rawtx['vout']:
212-
if txout['value'] == Decimal(collateral_amount):
213-
collateral_vout = txout['n']
214-
break
215-
assert collateral_vout is not None
216-
217-
ipAndPort = '127.0.0.1:%d' % p2p_port(len(self.nodes))
218-
operatorReward = len(self.nodes)
219-
220-
try:
221-
self.nodes[0].protx('register_evo', collateral_txid, collateral_vout, ipAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, funds_address, True)
222-
# this should never succeed
223-
assert False
224-
except:
225-
self.log.info("protx_evo rejected")
226-
227192
def test_masternode_count(self, expected_mns_count, expected_evo_count):
228193
mn_count = self.nodes[0].masternode('count')
229194
assert_equal(mn_count['total'], expected_mns_count + expected_evo_count)

0 commit comments

Comments
 (0)