Skip to content

Commit

Permalink
feat: drop SPORK 24 (EHF) so far as this feature works on testnet / m…
Browse files Browse the repository at this point in the history
…ainnet
  • Loading branch information
knst committed Sep 30, 2024
1 parent da0dc06 commit 9a9d0d5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/llmq/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis
llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(*llmq::chainLocksHandler, chainstate, connman, *qman, *sigman, *shareman, sporkman, mempool, mn_sync, peerman, is_masternode, unit_tests, wipe);
return llmq::quorumInstantSendManager.get();
}()},
ehfSignalsHandler{std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool,
*qman, sporkman, peerman)}
ehfSignalsHandler{
std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool, *qman, peerman)}
{
}

Expand Down
6 changes: 2 additions & 4 deletions src/llmq/ehf_signals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <index/txindex.h> // g_txindex
#include <net_processing.h>
#include <primitives/transaction.h>
#include <spork.h>
#include <txmempool.h>
#include <validation.h>

Expand All @@ -25,14 +24,13 @@ namespace llmq {

CEHFSignalsHandler::CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman,
const CSporkManager& sporkman, const std::unique_ptr<PeerManager>& peerman) :
const std::unique_ptr<PeerManager>& peerman) :
chainstate(chainstate),
mnhfman(mnhfman),
sigman(sigman),
shareman(shareman),
mempool(mempool),
qman(qman),
sporkman(sporkman),
m_peerman(peerman)
{
sigman.RegisterRecoveredSigsListener(this);
Expand All @@ -48,7 +46,7 @@ void CEHFSignalsHandler::UpdatedBlockTip(const CBlockIndex* const pindexNew, boo
{
if (!DeploymentActiveAfter(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_V20)) return;

if (!is_masternode || (Params().IsTestChain() && !sporkman.IsSporkActive(SPORK_24_TEST_EHF))) {
if (!is_masternode) {
return;
}

Expand Down
4 changes: 1 addition & 3 deletions src/llmq/ehf_signals.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
class CBlockIndex;
class CChainState;
class CMNHFManager;
class CSporkManager;
class CTxMemPool;
class PeerManager;

Expand All @@ -31,7 +30,6 @@ class CEHFSignalsHandler : public CRecoveredSigsListener
CSigSharesManager& shareman;
CTxMemPool& mempool;
const CQuorumManager& qman;
const CSporkManager& sporkman;
const std::unique_ptr<PeerManager>& m_peerman;

/**
Expand All @@ -42,7 +40,7 @@ class CEHFSignalsHandler : public CRecoveredSigsListener
public:
explicit CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman,
const CSporkManager& sporkman, const std::unique_ptr<PeerManager>& peerman);
const std::unique_ptr<PeerManager>& peerman);
~CEHFSignalsHandler();


Expand Down
3 changes: 1 addition & 2 deletions src/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ enum SporkId : int32_t {
SPORK_19_CHAINLOCKS_ENABLED = 10018,
SPORK_21_QUORUM_ALL_CONNECTED = 10020,
SPORK_23_QUORUM_POSE = 10022,
SPORK_24_TEST_EHF = 10023,
// SPORK_24_DEPRECATED = 10023,

SPORK_INVALID = -1,
};
Expand Down Expand Up @@ -76,7 +76,6 @@ struct CSporkDef
MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_23_QUORUM_POSE, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_24_TEST_EHF, 4070908800ULL), // OFF
};
#undef MAKE_SPORK_DEF

Expand Down
34 changes: 9 additions & 25 deletions test/functional/feature_mnehf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

import struct
import time
from io import BytesIO

from test_framework.authproxy import JSONRPCException
Expand Down Expand Up @@ -45,15 +46,6 @@ def restart_all_nodes(self, params=None):
for i in range(1, self.num_nodes):
self.connect_nodes(i, 0)

def slowly_generate_batch(self, amount):
self.log.info(f"Slowly generate {amount} blocks")
while amount > 0:
self.log.info(f"Generating batch of blocks {amount} left")
next = min(10, amount)
amount -= next
self.bump_mocktime(next)
self.nodes[1].generate(next)
self.sync_all()

def create_mnehf(self, versionBit, pubkey=None):
# request ID = sha256("mnhf", versionBit)
Expand Down Expand Up @@ -241,26 +233,18 @@ def run_test(self):
node.generate(1)
self.sync_blocks()
self.restart_all_nodes(params=[self.mocktime, self.mocktime + 1000000])
self.mine_quorum()

ehf_tx_new_start = self.create_mnehf(28, pubkey)

self.log.info("Test spork 24 (EHF)")
self.check_fork('defined')
self.nodes[0].sporkupdate("SPORK_24_TEST_EHF", 0)
self.wait_for_sporks_same()

self.mine_quorum()
self.check_fork('defined')

self.log.info("Mine one block and ensure EHF tx for the new deployment is mined")
ehf_tx_sent = self.send_tx(ehf_tx_new_start)
tip_blockhash = node.generate(1)[0]
self.sync_all()
block = node.getblock(tip_blockhash)
assert ehf_tx_sent in block['tx']

self.check_fork('defined')
self.slowly_generate_batch(4 * 4)
self.log.info("Waiting a bit to make EHF activating...")
self.mine_quorum()
for _ in range(4 * 4):
time.sleep(1)
self.bump_mocktime(1)
self.nodes[1].generate(1)
self.sync_all()
self.check_fork('active')


Expand Down

0 comments on commit 9a9d0d5

Please sign in to comment.