Masternodes should have no wallet enabled (#3084)

This commit is contained in:
PastaPastaPasta 2019-09-15 15:08:21 -05:00 committed by UdjinM6
parent 6b5b70fab8
commit 68d575dc0d
3 changed files with 19 additions and 8 deletions

View File

@ -908,6 +908,11 @@ void InitParameterInteraction()
// masternodes MUST accept connections from outside
gArgs.ForceSetArg("-listen", "1");
LogPrintf("%s: parameter interaction: -masternode=1 -> setting -listen=1\n", __func__);
#ifdef ENABLE_WALLET
// masternode should not have wallet enabled
gArgs.ForceSetArg("-disablewallet", "1");
LogPrintf("%s: parameter interaction: -masternode=1 -> setting -disablewallet=1\n", __func__);
#endif // ENABLE_WALLET
if (gArgs.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS) < DEFAULT_MAX_PEER_CONNECTIONS) {
// masternodes MUST be able to handle at least DEFAULT_MAX_PEER_CONNECTIONS connections
gArgs.ForceSetArg("-maxconnections", itostr(DEFAULT_MAX_PEER_CONNECTIONS));
@ -1900,13 +1905,18 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 10a: Prepare Masternode related stuff
fMasternodeMode = gArgs.GetBoolArg("-masternode", false);
// TODO: masternode should have no wallet
if(fLiteMode && fMasternodeMode) {
return InitError(_("You can not start a masternode in lite mode."));
}
if(fMasternodeMode) {
#ifdef ENABLE_WALLET
if (!vpwallets.empty()) {
return InitError(_("You can not start a masternode with wallet enabled."));
}
#endif //ENABLE_WALLET
LogPrintf("MASTERNODE:\n");
std::string strMasterNodeBLSPrivKey = gArgs.GetArg("-masternodeblsprivkey", "");

View File

@ -143,7 +143,7 @@ class DIP3Test(BitcoinTestFramework):
for i in range(20):
node = self.nodes[i % len(self.nodes)]
self.test_invalid_mn_payment(node)
node.generate(1)
self.nodes[0].generate(1)
self.sync_all()
self.log.info("testing ProUpServTx")
@ -378,7 +378,7 @@ class DIP3Test(BitcoinTestFramework):
coinbasevalue = bt['coinbasevalue']
if miner_address is None:
miner_address = node.getnewaddress()
miner_address = self.nodes[0].getnewaddress()
if mn_payee is None:
if isinstance(bt['masternode'], list):
mn_payee = bt['masternode'][0]['payee']

View File

@ -48,23 +48,24 @@ class LLMQChainLocksTest(DashTestFramework):
# Isolate node, mine on another, and reconnect
isolate_node(self.nodes[0])
node0_mining_addr = self.nodes[0].getnewaddress()
node0_tip = self.nodes[0].getbestblockhash()
self.nodes[1].generate(5)
self.nodes[1].generatetoaddress(5, node0_mining_addr)
self.wait_for_chainlock_tip(self.nodes[1])
assert(self.nodes[0].getbestblockhash() == node0_tip)
reconnect_isolated_node(self.nodes[0], 1)
self.nodes[1].generate(1)
self.nodes[1].generatetoaddress(1, node0_mining_addr)
self.wait_for_chainlock(self.nodes[0], self.nodes[1].getbestblockhash())
# Isolate node, mine on both parts of the network, and reconnect
isolate_node(self.nodes[0])
self.nodes[0].generate(5)
self.nodes[1].generate(1)
self.nodes[1].generatetoaddress(1, node0_mining_addr)
good_tip = self.nodes[1].getbestblockhash()
self.wait_for_chainlock_tip(self.nodes[1])
assert(not self.nodes[0].getblock(self.nodes[0].getbestblockhash())["chainlock"])
reconnect_isolated_node(self.nodes[0], 1)
self.nodes[1].generate(1)
self.nodes[1].generatetoaddress(1, node0_mining_addr)
self.wait_for_chainlock(self.nodes[0], self.nodes[1].getbestblockhash())
assert(self.nodes[0].getblock(self.nodes[0].getbestblockhash())["previousblockhash"] == good_tip)
assert(self.nodes[1].getblock(self.nodes[1].getbestblockhash())["previousblockhash"] == good_tip)
@ -87,7 +88,7 @@ class LLMQChainLocksTest(DashTestFramework):
# Now let the node which is on the wrong chain reorg back to the locked chain
self.nodes[0].reconsiderblock(good_tip)
assert(self.nodes[0].getbestblockhash() != good_tip)
self.nodes[1].generate(1)
self.nodes[1].generatetoaddress(1, node0_mining_addr)
self.wait_for_chainlock(self.nodes[0], self.nodes[1].getbestblockhash())
assert(self.nodes[0].getbestblockhash() == self.nodes[1].getbestblockhash())