Skip to content

Commit 2f21e55

Browse files
codablockUdjinM6
authored andcommitted
Remove legacy InstantSend code (#3020)
* Remove ppszTypeName from protocol.cpp and reimplement GetCommand This removes the need to carefully maintain ppszTypeName, which required correct order and also did not allow to permanently remove old message types. To get the command name for an INV type, GetCommandInternal uses a switch which needs to be maintained from now on. The way this is implemented also resembles the way it is implemented in Bitcoin today, but it's not identical. The original PR that introduced the switch case in Bitcoin was part of the Segwit changes and thus never got backported. I decided to implement it in a slightly different way that avoids throwing exceptions when an unknown INV type is encountered. IsKnownType will now also leverage GetCommandInternal() to figure out if the INV type is known locally. This has the side effect of old/legacy message types to return false from now on. We will depend on this side effect in later commits when we remove legacy InstantSend code. * Stop handling/relaying legacy IX messages When we receive an IX message, we simply treat it as a regular TX and relay it as such. We'll however still request IX messages when they are announced to us. We can't simply revert to requesting TX messages in this case as it might result in the other peer not answering due to the TX not being in mapRelay yet. We should at some point in the future completely drop handling of IX messages instead. * Remove IsNewInstantSendEnabled() and only use IsInstantSendEnabled() * Remove legacy InstantSend from GUI * Remove InstantSend from Bitcoin/Dash URIs * Remove legacy InstantSend from RPC commands * Remove legacy InstantSend from wallet * Remove legacy instantsend.h include * Remove legacy InstantSend from validation code * Completely remove remaining legacy InstantSend code * Remove now unused spork * Fix InstantSend related test failures * Remove now obsolete auto IS tests * Make spork2 and spork3 disabled by default This should have no influence on mainnet as these sporks are actually set there. This will however affect regtest, which shouldn't have LLMQ based InstantSend enabled by default. * Remove instantsend tests from dip3-deterministicmns.py These were only testing legacy InstantSend * Fix .QCheckBox#checkUsePrivateSend styling a bit * s/TXLEGACYLOCKREQUEST/LEGACYTXLOCKREQUEST/ * Revert "verified via InstantSend" back to "verified via LLMQ based InstantSend" * Use cmd == nullptr instead of !cmd * Remove last parameter from AvailableCoins call This was for fUseInstantSend which is not present anymore since rebase
1 parent 7a440d6 commit 2f21e55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+159
-2775
lines changed

doc/files.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
* evodb/*: special txes and quorums database
1313
* fee_estimates.dat: stores statistics used to estimate minimum transaction fees and priorities required for confirmation
1414
* governance.dat: stores data for governance obgects
15-
* instantsend.dat: stores data for instantsend locks
1615
* llmq/*: quorum signatures database
1716
* mempool.dat: dump of the mempool's transactions
1817
* mncache.dat: stores data for masternode list

src/Makefile.am

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ BITCOIN_CORE_H = \
153153
httpserver.h \
154154
indirectmap.h \
155155
init.h \
156-
instantsend.h \
157156
key.h \
158157
keepass.h \
159158
keystore.h \
@@ -273,7 +272,6 @@ libdash_server_a_SOURCES = \
273272
httprpc.cpp \
274273
httpserver.cpp \
275274
init.cpp \
276-
instantsend.cpp \
277275
dbwrapper.cpp \
278276
governance/governance.cpp \
279277
governance/governance-classes.cpp \

src/chainparams.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ class CMainParams : public CChainParams {
227227
consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value
228228
consensus.nInstantSendConfirmationsRequired = 6;
229229
consensus.nInstantSendKeepLock = 24;
230-
consensus.nInstantSendSigsRequired = 6;
231-
consensus.nInstantSendSigsTotal = 10;
232230
consensus.nBudgetPaymentsStartBlock = 328008; // actual historical value
233231
consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
234232
consensus.nBudgetPaymentsWindowBlocks = 100;
@@ -409,8 +407,6 @@ class CTestNetParams : public CChainParams {
409407
consensus.nMasternodePaymentsIncreasePeriod = 10;
410408
consensus.nInstantSendConfirmationsRequired = 2;
411409
consensus.nInstantSendKeepLock = 6;
412-
consensus.nInstantSendSigsRequired = 6;
413-
consensus.nInstantSendSigsTotal = 10;
414410
consensus.nBudgetPaymentsStartBlock = 4100;
415411
consensus.nBudgetPaymentsCycleBlocks = 50;
416412
consensus.nBudgetPaymentsWindowBlocks = 10;
@@ -568,8 +564,6 @@ class CDevNetParams : public CChainParams {
568564
consensus.nMasternodePaymentsIncreasePeriod = 10;
569565
consensus.nInstantSendConfirmationsRequired = 2;
570566
consensus.nInstantSendKeepLock = 6;
571-
consensus.nInstantSendSigsRequired = 6;
572-
consensus.nInstantSendSigsTotal = 10;
573567
consensus.nBudgetPaymentsStartBlock = 4100;
574568
consensus.nBudgetPaymentsCycleBlocks = 50;
575569
consensus.nBudgetPaymentsWindowBlocks = 10;
@@ -734,8 +728,6 @@ class CRegTestParams : public CChainParams {
734728
consensus.nMasternodePaymentsIncreasePeriod = 10;
735729
consensus.nInstantSendConfirmationsRequired = 2;
736730
consensus.nInstantSendKeepLock = 6;
737-
consensus.nInstantSendSigsRequired = 3;
738-
consensus.nInstantSendSigsTotal = 5;
739731
consensus.nBudgetPaymentsStartBlock = 1000;
740732
consensus.nBudgetPaymentsCycleBlocks = 50;
741733
consensus.nBudgetPaymentsWindowBlocks = 10;

src/consensus/params.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ struct Params {
125125
int nMasternodePaymentsIncreasePeriod; // in blocks
126126
int nInstantSendConfirmationsRequired; // in blocks
127127
int nInstantSendKeepLock; // in blocks
128-
int nInstantSendSigsRequired;
129-
int nInstantSendSigsTotal;
130128
int nBudgetPaymentsStartBlock;
131129
int nBudgetPaymentsCycleBlocks;
132130
int nBudgetPaymentsWindowBlocks;

src/dsnotificationinterface.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "chainparams.h"
66
#include "dsnotificationinterface.h"
7-
#include "instantsend.h"
87
#include "governance/governance.h"
98
#include "masternode/masternode-payments.h"
109
#include "masternode/masternode-sync.h"
@@ -50,8 +49,6 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
5049

5150
// Update global DIP0001 activation status
5251
fDIP0001ActiveAtTip = pindexNew->nHeight >= Params().GetConsensus().DIP0001Height;
53-
// update instantsend autolock activation flag (we reuse the DIP3 deployment)
54-
instantsend.isAutoLockBip9Active = pindexNew->nHeight + 1 >= Params().GetConsensus().DIP0003Height;
5552

5653
if (fInitialDownload)
5754
return;
@@ -67,7 +64,6 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
6764
llmq::quorumInstantSendManager->UpdatedBlockTip(pindexNew);
6865
llmq::chainLocksHandler->UpdatedBlockTip(pindexNew);
6966

70-
instantsend.UpdatedBlockTip(pindexNew);
7167
governance.UpdatedBlockTip(pindexNew, connman);
7268
llmq::quorumManager->UpdatedBlockTip(pindexNew, fInitialDownload);
7369
llmq::quorumDKGSessionManager->UpdatedBlockTip(pindexNew, fInitialDownload);
@@ -78,7 +74,6 @@ void CDSNotificationInterface::TransactionAddedToMempool(const CTransactionRef&
7874
llmq::quorumInstantSendManager->TransactionAddedToMempool(ptx);
7975
llmq::chainLocksHandler->TransactionAddedToMempool(ptx);
8076
CPrivateSend::TransactionAddedToMempool(ptx);
81-
instantsend.SyncTransaction(ptx);
8277
}
8378

8479
void CDSNotificationInterface::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted)
@@ -94,24 +89,13 @@ void CDSNotificationInterface::BlockConnected(const std::shared_ptr<const CBlock
9489
llmq::quorumInstantSendManager->BlockConnected(pblock, pindex, vtxConflicted);
9590
llmq::chainLocksHandler->BlockConnected(pblock, pindex, vtxConflicted);
9691
CPrivateSend::BlockConnected(pblock, pindex, vtxConflicted);
97-
98-
for (const CTransactionRef& ptx : vtxConflicted) {
99-
instantsend.SyncTransaction(ptx);
100-
}
101-
for (size_t i = 0; i < pblock->vtx.size(); i++) {
102-
instantsend.SyncTransaction(pblock->vtx[i], pindex, i);
103-
}
10492
}
10593

10694
void CDSNotificationInterface::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected)
10795
{
10896
llmq::quorumInstantSendManager->BlockDisconnected(pblock, pindexDisconnected);
10997
llmq::chainLocksHandler->BlockDisconnected(pblock, pindexDisconnected);
11098
CPrivateSend::BlockDisconnected(pblock, pindexDisconnected);
111-
112-
for (const CTransactionRef& ptx : pblock->vtx) {
113-
instantsend.SyncTransaction(ptx, pindexDisconnected->pprev, -1);
114-
}
11599
}
116100

117101
void CDSNotificationInterface::NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff)

src/init.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#include "dsnotificationinterface.h"
5353
#include "flat-database.h"
5454
#include "governance/governance.h"
55-
#include "instantsend.h"
5655
#ifdef ENABLE_WALLET
5756
#include "keepass.h"
5857
#endif
@@ -267,11 +266,6 @@ void PrepareShutdown()
267266
flatdb3.Dump(governance);
268267
CFlatDB<CNetFulfilledRequestManager> flatdb4("netfulfilled.dat", "magicFulfilledCache");
269268
flatdb4.Dump(netfulfilledman);
270-
if(fEnableInstantSend)
271-
{
272-
CFlatDB<CInstantSend> flatdb5("instantsend.dat", "magicInstantSendCache");
273-
flatdb5.Dump(instantsend);
274-
}
275269
CFlatDB<CSporkManager> flatdb6("sporks.dat", "magicSporkCache");
276270
flatdb6.Dump(sporkManager);
277271
}
@@ -616,7 +610,6 @@ std::string HelpMessage(HelpMessageMode mode)
616610
#endif // ENABLE_WALLET
617611

618612
strUsage += HelpMessageGroup(_("InstantSend options:"));
619-
strUsage += HelpMessageOpt("-enableinstantsend", strprintf(_("Enable InstantSend, show confirmations for locked transactions (0-1, default: %u)"), 1));
620613
strUsage += HelpMessageOpt("-instantsendnotify=<cmd>", _("Execute command when a wallet InstantSend transaction is successfully locked (%s in cmd is replaced by TxID)"));
621614

622615

@@ -2029,11 +2022,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
20292022

20302023
CPrivateSend::InitStandardDenominations();
20312024

2032-
// ********************************************************* Step 10b: setup InstantSend
2033-
2034-
fEnableInstantSend = gArgs.GetBoolArg("-enableinstantsend", 1);
2035-
2036-
// ********************************************************* Step 10c: Load cache data
2025+
// ********************************************************* Step 10b: Load cache data
20372026

20382027
// LOAD SERIALIZED DAT FILES INTO DATA CACHES FOR INTERNAL USE
20392028

@@ -2063,27 +2052,15 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
20632052
if(!flatdb4.Load(netfulfilledman)) {
20642053
return InitError(_("Failed to load fulfilled requests cache from") + "\n" + (pathDB / strDBName).string());
20652054
}
2066-
2067-
if(fEnableInstantSend)
2068-
{
2069-
strDBName = "instantsend.dat";
2070-
uiInterface.InitMessage(_("Loading InstantSend data cache..."));
2071-
CFlatDB<CInstantSend> flatdb5(strDBName, "magicInstantSendCache");
2072-
if(!flatdb5.Load(instantsend)) {
2073-
return InitError(_("Failed to load InstantSend data cache from") + "\n" + (pathDB / strDBName).string());
2074-
}
2075-
}
20762055
}
20772056

2078-
// ********************************************************* Step 10d: schedule Dash-specific tasks
2057+
// ********************************************************* Step 10c: schedule Dash-specific tasks
20792058

20802059
if (!fLiteMode) {
20812060
scheduler.scheduleEvery(boost::bind(&CNetFulfilledRequestManager::DoMaintenance, boost::ref(netfulfilledman)), 60 * 1000);
20822061
scheduler.scheduleEvery(boost::bind(&CMasternodeSync::DoMaintenance, boost::ref(masternodeSync), boost::ref(*g_connman)), 1 * 1000);
20832062

20842063
scheduler.scheduleEvery(boost::bind(&CGovernanceManager::DoMaintenance, boost::ref(governance), boost::ref(*g_connman)), 60 * 5 * 1000);
2085-
2086-
scheduler.scheduleEvery(boost::bind(&CInstantSend::DoMaintenance, boost::ref(instantsend)), 60 * 1000);
20872064
}
20882065

20892066
scheduler.scheduleEvery(boost::bind(&CMasternodeUtils::DoMaintenance, boost::ref(*g_connman)), 1 * 1000);

0 commit comments

Comments
 (0)