From 71fbecfbba73568ba8be54d1068c615127f331a6 Mon Sep 17 00:00:00 2001 From: barrystyle Date: Fri, 18 Oct 2019 04:53:58 +0800 Subject: [PATCH] Amend overaggressive rebrand, will cause future porting headaches. --- src/batchedlogger.h | 4 +- src/bip39.h | 4 +- src/bls/bls.h | 4 +- src/bls/bls_batchverifier.h | 4 +- src/bls/bls_ies.h | 4 +- src/bls/bls_worker.h | 4 +- src/chainparams.cpp | 32 +-- src/chainparamsseeds.h | 4 +- src/consensus/params.h | 8 +- src/dsnotificationinterface.cpp | 6 +- src/evo/cbtx.h | 4 +- src/evo/deterministicmns.h | 4 +- src/evo/evodb.h | 4 +- src/evo/mnauth.h | 4 +- src/evo/providertx.h | 4 +- src/evo/simplifiedmns.h | 4 +- src/evo/specialtx.h | 4 +- src/hdchain.h | 4 +- src/httpserver.cpp | 4 +- src/init.cpp | 18 +- src/instantx.cpp | 236 ++++++++--------- src/instantx.h | 10 +- src/llmq/quorums.cpp | 2 +- src/llmq/quorums.h | 4 +- src/llmq/quorums_blockprocessor.h | 4 +- src/llmq/quorums_chainlocks.cpp | 8 +- src/llmq/quorums_chainlocks.h | 4 +- src/llmq/quorums_commitment.h | 4 +- src/llmq/quorums_debug.h | 4 +- src/llmq/quorums_dkgsession.h | 4 +- src/llmq/quorums_dkgsessionhandler.cpp | 2 +- src/llmq/quorums_dkgsessionhandler.h | 4 +- src/llmq/quorums_dkgsessionmgr.h | 4 +- src/llmq/quorums_init.cpp | 18 +- src/llmq/quorums_init.h | 4 +- src/llmq/quorums_instantsend.cpp | 338 ++++++++++++------------- src/llmq/quorums_instantsend.h | 100 ++++---- src/llmq/quorums_signing.h | 4 +- src/llmq/quorums_signing_shares.h | 4 +- src/llmq/quorums_utils.h | 4 +- src/net.cpp | 2 +- src/net_processing.cpp | 12 +- src/privatesend-server.cpp | 2 +- src/privatesend.cpp | 2 +- src/qt/clientmodel.cpp | 4 +- src/qt/coincontroldialog.cpp | 6 +- src/qt/guiutil.cpp | 6 +- src/qt/receivecoinsdialog.cpp | 2 +- src/qt/receiverequestdialog.cpp | 2 +- src/qt/rpcconsole.cpp | 4 +- src/qt/rpcconsole.h | 2 +- src/qt/sendcoinsdialog.cpp | 14 +- src/qt/test/uritests.cpp | 10 +- src/qt/transactiondesc.cpp | 4 +- src/qt/walletmodel.cpp | 12 +- src/qt/walletmodel.h | 4 +- src/rpc/blockchain.cpp | 4 +- src/rpc/rawtransaction.cpp | 4 +- src/stacktraces.h | 4 +- src/txmempool.cpp | 2 +- src/unordered_lru_cache.h | 4 +- src/util.cpp | 2 +- src/validation.cpp | 14 +- src/validationinterface.cpp | 6 +- src/validationinterface.h | 4 +- src/wallet/coincontrol.h | 4 +- src/wallet/rpcwallet.cpp | 24 +- src/wallet/wallet.cpp | 82 +++--- src/wallet/wallet.h | 10 +- src/zmq/zmqabstractnotifier.cpp | 2 +- src/zmq/zmqabstractnotifier.h | 2 +- src/zmq/zmqnotificationinterface.cpp | 6 +- src/zmq/zmqnotificationinterface.h | 2 +- src/zmq/zmqpublishnotifier.cpp | 4 +- src/zmq/zmqpublishnotifier.h | 6 +- 75 files changed, 582 insertions(+), 582 deletions(-) diff --git a/src/batchedlogger.h b/src/batchedlogger.h index c0b51cf2d31b3..f694d2219e227 100644 --- a/src/batchedlogger.h +++ b/src/batchedlogger.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_BATCHEDLOGGER_H -#define PAC_BATCHEDLOGGER_H +#ifndef DASH_BATCHEDLOGGER_H +#define DASH_BATCHEDLOGGER_H #include "tinyformat.h" diff --git a/src/bip39.h b/src/bip39.h index 204254525f05a..4d74383817eee 100644 --- a/src/bip39.h +++ b/src/bip39.h @@ -21,8 +21,8 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef PAC_BIP39_H -#define PAC_BIP39_H +#ifndef DASH_BIP39_H +#define DASH_BIP39_H #include "support/allocators/secure.h" diff --git a/src/bls/bls.h b/src/bls/bls.h index 8003753d19aab..511959203d956 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_CRYPTO_BLS_H -#define PAC_CRYPTO_BLS_H +#ifndef DASH_CRYPTO_BLS_H +#define DASH_CRYPTO_BLS_H #include "hash.h" #include "serialize.h" diff --git a/src/bls/bls_batchverifier.h b/src/bls/bls_batchverifier.h index 72ab5de0c8721..996546d19720f 100644 --- a/src/bls/bls_batchverifier.h +++ b/src/bls/bls_batchverifier.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_CRYPTO_BLS_BATCHVERIFIER_H -#define PAC_CRYPTO_BLS_BATCHVERIFIER_H +#ifndef DASH_CRYPTO_BLS_BATCHVERIFIER_H +#define DASH_CRYPTO_BLS_BATCHVERIFIER_H #include "bls.h" diff --git a/src/bls/bls_ies.h b/src/bls/bls_ies.h index 7dafea2371c8f..48fd6b3822c75 100644 --- a/src/bls/bls_ies.h +++ b/src/bls/bls_ies.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_CRYPTO_BLS_IES_H -#define PAC_CRYPTO_BLS_IES_H +#ifndef DASH_CRYPTO_BLS_IES_H +#define DASH_CRYPTO_BLS_IES_H #include "bls.h" #include "streams.h" diff --git a/src/bls/bls_worker.h b/src/bls/bls_worker.h index 545c43164c4b5..268ca8c319cc7 100644 --- a/src/bls/bls_worker.h +++ b/src/bls/bls_worker.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_CRYPTO_BLS_WORKER_H -#define PAC_CRYPTO_BLS_WORKER_H +#ifndef DASH_CRYPTO_BLS_WORKER_H +#define DASH_CRYPTO_BLS_WORKER_H #include "bls.h" diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 0e662233f9bb3..923e43dd8188f 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -209,10 +209,10 @@ class CMainParams : public CChainParams { consensus.nMasternodePaymentsStartBlock = 200; consensus.nMasternodePaymentsIncreaseBlock = 217736; consensus.nMasternodePaymentsIncreasePeriod = 576*30; - consensus.nInstaPACConfirmationsRequired = 6; - consensus.nInstaPACKeepLock = 24; - consensus.nInstaPACSigsRequired = 6; - consensus.nInstaPACSigsTotal = 10; + consensus.nInstantSendConfirmationsRequired = 6; + consensus.nInstantSendKeepLock = 24; + consensus.nInstantSendSigsRequired = 6; + consensus.nInstantSendSigsTotal = 10; consensus.nBudgetPaymentsStartBlock = 200; consensus.nBudgetPaymentsCycleBlocks = 16616; consensus.nBudgetPaymentsWindowBlocks = 100; @@ -402,10 +402,10 @@ class CTestNetParams : public CChainParams { consensus.nMasternodePaymentsStartBlock = 50; consensus.nMasternodePaymentsIncreaseBlock = NEVER32; consensus.nMasternodePaymentsIncreasePeriod = NEVER32; - consensus.nInstaPACConfirmationsRequired = 2; - consensus.nInstaPACKeepLock = 6; - consensus.nInstaPACSigsRequired = 6; - consensus.nInstaPACSigsTotal = 10; + consensus.nInstantSendConfirmationsRequired = 2; + consensus.nInstantSendKeepLock = 6; + consensus.nInstantSendSigsRequired = 6; + consensus.nInstantSendSigsTotal = 10; consensus.nBudgetPaymentsStartBlock = NEVER32; consensus.nBudgetPaymentsCycleBlocks = NEVER32; consensus.nBudgetPaymentsWindowBlocks = NEVER32; @@ -568,10 +568,10 @@ class CDevNetParams : public CChainParams { consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock consensus.nMasternodePaymentsIncreaseBlock = 4030; consensus.nMasternodePaymentsIncreasePeriod = 10; - consensus.nInstaPACConfirmationsRequired = 2; - consensus.nInstaPACKeepLock = 6; - consensus.nInstaPACSigsRequired = 6; - consensus.nInstaPACSigsTotal = 10; + consensus.nInstantSendConfirmationsRequired = 2; + consensus.nInstantSendKeepLock = 6; + consensus.nInstantSendSigsRequired = 6; + consensus.nInstantSendSigsTotal = 10; consensus.nBudgetPaymentsStartBlock = 4100; consensus.nBudgetPaymentsCycleBlocks = 50; consensus.nBudgetPaymentsWindowBlocks = 10; @@ -745,10 +745,10 @@ class CRegTestParams : public CChainParams { consensus.nMasternodePaymentsStartBlock = 240; consensus.nMasternodePaymentsIncreaseBlock = 350; consensus.nMasternodePaymentsIncreasePeriod = 10; - consensus.nInstaPACConfirmationsRequired = 2; - consensus.nInstaPACKeepLock = 6; - consensus.nInstaPACSigsRequired = 3; - consensus.nInstaPACSigsTotal = 5; + consensus.nInstantSendConfirmationsRequired = 2; + consensus.nInstantSendKeepLock = 6; + consensus.nInstantSendSigsRequired = 3; + consensus.nInstantSendSigsTotal = 5; consensus.nBudgetPaymentsStartBlock = 1000; consensus.nBudgetPaymentsCycleBlocks = 50; consensus.nBudgetPaymentsWindowBlocks = 10; diff --git a/src/chainparamsseeds.h b/src/chainparamsseeds.h index 0d324d46ed17d..286ee99c4404c 100644 --- a/src/chainparamsseeds.h +++ b/src/chainparamsseeds.h @@ -1,5 +1,5 @@ -#ifndef PAC_CHAINPARAMSSEEDS_H -#define PAC_CHAINPARAMSSEEDS_H +#ifndef DASH_CHAINPARAMSSEEDS_H +#define DASH_CHAINPARAMSSEEDS_H /** * List of fixed seed nodes for the dash network * AUTOGENERATED by contrib/seeds/generate-seeds.py diff --git a/src/consensus/params.h b/src/consensus/params.h index cd305b089225c..c23fea1ec44ba 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -124,10 +124,10 @@ struct Params { int nMasternodePaymentsStartBlock; int nMasternodePaymentsIncreaseBlock; int nMasternodePaymentsIncreasePeriod; // in blocks - int nInstaPACConfirmationsRequired; // in blocks - int nInstaPACKeepLock; // in blocks - int nInstaPACSigsRequired; - int nInstaPACSigsTotal; + int nInstantSendConfirmationsRequired; // in blocks + int nInstantSendKeepLock; // in blocks + int nInstantSendSigsRequired; + int nInstantSendSigsTotal; int nBudgetPaymentsStartBlock; int nBudgetPaymentsCycleBlocks; int nBudgetPaymentsWindowBlocks; diff --git a/src/dsnotificationinterface.cpp b/src/dsnotificationinterface.cpp index 9060583ccd477..ba8ef297c714f 100644 --- a/src/dsnotificationinterface.cpp +++ b/src/dsnotificationinterface.cpp @@ -66,7 +66,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con if (fLiteMode) return; - llmq::quorumInstaPACManager->UpdatedBlockTip(pindexNew); + llmq::quorumInstantSendManager->UpdatedBlockTip(pindexNew); llmq::chainLocksHandler->UpdatedBlockTip(pindexNew); CPrivateSend::UpdatedBlockTip(pindexNew); @@ -81,7 +81,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock) { - llmq::quorumInstaPACManager->SyncTransaction(tx, pindex, posInBlock); + llmq::quorumInstantSendManager->SyncTransaction(tx, pindex, posInBlock); llmq::chainLocksHandler->SyncTransaction(tx, pindex, posInBlock); instantsend.SyncTransaction(tx, pindex, posInBlock); CPrivateSend::SyncTransaction(tx, pindex, posInBlock); @@ -97,5 +97,5 @@ void CDSNotificationInterface::NotifyMasternodeListChanged(bool undo, const CDet void CDSNotificationInterface::NotifyChainLock(const CBlockIndex* pindex) { - llmq::quorumInstaPACManager->NotifyChainLock(pindex); + llmq::quorumInstantSendManager->NotifyChainLock(pindex); } diff --git a/src/evo/cbtx.h b/src/evo/cbtx.h index 89891f05ce1f8..3f61813bb80af 100644 --- a/src/evo/cbtx.h +++ b/src/evo/cbtx.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_CBTX_H -#define PAC_CBTX_H +#ifndef DASH_CBTX_H +#define DASH_CBTX_H #include "consensus/validation.h" #include "primitives/transaction.h" diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index b857fe4b865a4..b34a5f619e72d 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_DETERMINISTICMNS_H -#define PAC_DETERMINISTICMNS_H +#ifndef DASH_DETERMINISTICMNS_H +#define DASH_DETERMINISTICMNS_H #include "arith_uint256.h" #include "bls/bls.h" diff --git a/src/evo/evodb.h b/src/evo/evodb.h index a83a1cdd25234..df02be80cc59c 100644 --- a/src/evo/evodb.h +++ b/src/evo/evodb.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_EVODB_H -#define PAC_EVODB_H +#ifndef DASH_EVODB_H +#define DASH_EVODB_H #include "dbwrapper.h" #include "sync.h" diff --git a/src/evo/mnauth.h b/src/evo/mnauth.h index acc5ef279fc32..4721568ca130e 100644 --- a/src/evo/mnauth.h +++ b/src/evo/mnauth.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_MNAUTH_H -#define PAC_MNAUTH_H +#ifndef DASH_MNAUTH_H +#define DASH_MNAUTH_H #include "bls/bls.h" #include "serialize.h" diff --git a/src/evo/providertx.h b/src/evo/providertx.h index dd724d86e961f..7ab6c7d81d3ff 100644 --- a/src/evo/providertx.h +++ b/src/evo/providertx.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_PROVIDERTX_H -#define PAC_PROVIDERTX_H +#ifndef DASH_PROVIDERTX_H +#define DASH_PROVIDERTX_H #include "bls/bls.h" #include "consensus/validation.h" diff --git a/src/evo/simplifiedmns.h b/src/evo/simplifiedmns.h index 574211da47c4f..bfb5e764c5cdd 100644 --- a/src/evo/simplifiedmns.h +++ b/src/evo/simplifiedmns.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_SIMPLIFIEDMNS_H -#define PAC_SIMPLIFIEDMNS_H +#ifndef DASH_SIMPLIFIEDMNS_H +#define DASH_SIMPLIFIEDMNS_H #include "bls/bls.h" #include "merkleblock.h" diff --git a/src/evo/specialtx.h b/src/evo/specialtx.h index b646ac79977e3..43220237ac01c 100644 --- a/src/evo/specialtx.h +++ b/src/evo/specialtx.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_SPECIALTX_H -#define PAC_SPECIALTX_H +#ifndef DASH_SPECIALTX_H +#define DASH_SPECIALTX_H #include "primitives/transaction.h" #include "streams.h" diff --git a/src/hdchain.h b/src/hdchain.h index 3f809bfc3ae86..ad1d85e049097 100644 --- a/src/hdchain.h +++ b/src/hdchain.h @@ -1,7 +1,7 @@ // Copyright (c) 2014-2018 The Dash Core developers // Distributed under the MIT software license, see the accompanying -#ifndef PAC_HDCHAIN_H -#define PAC_HDCHAIN_H +#ifndef DASH_HDCHAIN_H +#define DASH_HDCHAIN_H #include "key.h" #include "sync.h" diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 17fc4d9771bd6..0ab45731900d9 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -308,7 +308,7 @@ static void http_reject_request_cb(struct evhttp_request* req, void*) /** Event dispatcher thread */ static bool ThreadHTTP(struct event_base* base, struct evhttp* http) { - RenameThread("dash-http"); + RenameThread("pacglobal-http"); LogPrint("http", "Entering http event loop\n"); event_base_dispatch(base); // Event loop will be interrupted by InterruptHTTPServer() @@ -358,7 +358,7 @@ static bool HTTPBindAddresses(struct evhttp* http) /** Simple wrapper to set thread name and run work queue */ static void HTTPWorkQueueRun(WorkQueue* queue) { - RenameThread("dash-httpworker"); + RenameThread("pacglobal-httpworker"); queue->Run(); } diff --git a/src/init.cpp b/src/init.cpp index c6df9acc64895..cd777182c0605 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -229,7 +229,7 @@ void PrepareShutdown() /// for example if the data directory was found to be locked. /// Be sure that anything that writes files or flushes caches only does this if the respective /// module was initialized. - RenameThread("dash-shutoff"); + RenameThread("pacglobal-shutoff"); mempool.AddTransactionsUpdated(1); StopHTTPRPC(); StopREST(); @@ -268,9 +268,9 @@ void PrepareShutdown() flatdb3.Dump(governance); CFlatDB flatdb4("netfulfilled.dat", "magicFulfilledCache"); flatdb4.Dump(netfulfilledman); - if(fEnableInstaPAC) + if(fEnableInstantSend) { - CFlatDB flatdb5("instantsend.dat", "magicInstaPACCache"); + CFlatDB flatdb5("instantsend.dat", "magicInstaPACCache"); flatdb5.Dump(instantsend); } CFlatDB flatdb6("sporks.dat", "magicSporkCache"); @@ -749,7 +749,7 @@ void CleanupBlockRevFiles() void ThreadImport(std::vector vImportFiles) { const CChainParams& chainparams = Params(); - RenameThread("dash-loadblk"); + RenameThread("pacglobal-loadblk"); { CImportingNow imp; @@ -1969,7 +1969,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) // ********************************************************* Step 10b: setup InstaPAC - fEnableInstaPAC = GetBoolArg("-enableinstantsend", 1); + fEnableInstantSend = GetBoolArg("-enableinstantsend", 1); // ********************************************************* Step 10c: Load cache data @@ -2002,13 +2002,13 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) return InitError(_("Failed to load fulfilled requests cache from") + "\n" + (pathDB / strDBName).string()); } - if(fEnableInstaPAC) + if(fEnableInstantSend) { strDBName = "instantsend.dat"; uiInterface.InitMessage(_("Loading InstaPAC data cache...")); - CFlatDB flatdb5(strDBName, "magicInstaPACCache"); + CFlatDB flatdb5(strDBName, "magicInstaPACCache"); if(!flatdb5.Load(instantsend)) { - return InitError(_("Failed to load InstaPAC data cache from") + "\n" + (pathDB / strDBName).string()); + return InitError(_("Failed to load InstantSend data cache from") + "\n" + (pathDB / strDBName).string()); } } } @@ -2022,7 +2022,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) scheduler.scheduleEvery(boost::bind(&CGovernanceManager::DoMaintenance, boost::ref(governance), boost::ref(*g_connman)), 60 * 5 * 1000); - scheduler.scheduleEvery(boost::bind(&CInstaPAC::DoMaintenance, boost::ref(instantsend)), 60 * 1000); + scheduler.scheduleEvery(boost::bind(&CInstantSend::DoMaintenance, boost::ref(instantsend)), 60 * 1000); if (fMasternodeMode) scheduler.scheduleEvery(boost::bind(&CPrivateSendServer::DoMaintenance, boost::ref(privateSendServer), boost::ref(*g_connman)), 1 * 1000); diff --git a/src/instantx.cpp b/src/instantx.cpp index 6146c5526466b..fc21b4b5d7c40 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -35,33 +35,33 @@ extern CWallet* pwalletMain; #endif // ENABLE_WALLET extern CTxMemPool mempool; -bool fEnableInstaPAC = true; +bool fEnableInstantSend = true; -std::atomic CInstaPAC::isAutoLockBip9Active{false}; -const double CInstaPAC::AUTO_IX_MEMPOOL_THRESHOLD = 0.1; +std::atomic CInstantSend::isAutoLockBip9Active{false}; +const double CInstantSend::AUTO_IX_MEMPOOL_THRESHOLD = 0.1; -CInstaPAC instantsend; -const std::string CInstaPAC::SERIALIZATION_VERSION_STRING = "CInstaPAC-Version-1"; +CInstantSend instantsend; +const std::string CInstantSend::SERIALIZATION_VERSION_STRING = "CInstaPAC-Version-1"; // Transaction Locks // // step 1) Some node announces intention to lock transaction inputs via "txlockrequest" message (ix) -// step 2) Top nInstaPACSigsTotal masternodes per each spent outpoint push "txlockvote" message (txlvote) -// step 3) Once there are nInstaPACSigsRequired valid "txlockvote" messages (txlvote) per each spent outpoint +// step 2) Top nInstantSendSigsTotal masternodes per each spent outpoint push "txlockvote" message (txlvote) +// step 3) Once there are nInstantSendSigsRequired valid "txlockvote" messages (txlvote) per each spent outpoint // for a corresponding "txlockrequest" message (ix), all outpoints from that tx are treated as locked // -// CInstaPAC +// CInstantSend // -void CInstaPAC::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) +void CInstantSend::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) { if (fLiteMode) return; // disable all PACGlobal specific functionality - if (!llmq::IsOldInstaPACEnabled()) return; + if (!llmq::IsOldInstantSendEnabled()) return; // NOTE: NetMsgType::TXLOCKREQUEST is handled via ProcessMessage() in net_processing.cpp - if (strCommand == NetMsgType::TXLOCKVOTE) { // InstaPAC Transaction Lock Consensus Votes + if (strCommand == NetMsgType::TXLOCKVOTE) { // InstantSend Transaction Lock Consensus Votes if(pfrom->nVersion < MIN_INSTANTSEND_PROTO_VERSION) { LogPrint("instantsend", "TXLOCKVOTE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, @@ -95,7 +95,7 @@ void CInstaPAC::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDat } } -bool CInstaPAC::ProcessTxLockRequest(const CTxLockRequest& txLockRequest, CConnman& connman) +bool CInstantSend::ProcessTxLockRequest(const CTxLockRequest& txLockRequest, CConnman& connman) { LOCK(cs_main); #ifdef ENABLE_WALLET @@ -110,7 +110,7 @@ bool CInstaPAC::ProcessTxLockRequest(const CTxLockRequest& txLockRequest, CConnm std::map::iterator it = mapLockedOutpoints.find(txin.prevout); if (it != mapLockedOutpoints.end() && it->second != txLockRequest.GetHash()) { // Conflicting with complete lock, proceed to see if we should cancel them both - LogPrintf("CInstaPAC::ProcessTxLockRequest -- WARNING: Found conflicting completed Transaction Lock, txid=%s, completed lock txid=%s\n", + LogPrintf("CInstantSend::ProcessTxLockRequest -- WARNING: Found conflicting completed Transaction Lock, txid=%s, completed lock txid=%s\n", txLockRequest.GetHash().ToString(), it->second.ToString()); } } @@ -122,14 +122,14 @@ bool CInstaPAC::ProcessTxLockRequest(const CTxLockRequest& txLockRequest, CConnm if (it != mapVotedOutpoints.end()) { for (const auto& hash : it->second) { if (hash != txLockRequest.GetHash()) { - LogPrint("instantsend", "CInstaPAC::ProcessTxLockRequest -- Double spend attempt! %s\n", txin.prevout.ToStringShort()); + LogPrint("instantsend", "CInstantSend::ProcessTxLockRequest -- Double spend attempt! %s\n", txin.prevout.ToStringShort()); // do not fail here, let it go and see which one will get the votes to be locked // NOTIFY ZMQ CTransaction txCurrent = *txLockRequest.tx; // currently processed tx auto itPrevious = mapTxLockCandidates.find(hash); if (itPrevious != mapTxLockCandidates.end() && itPrevious->second.txLockRequest) { CTransaction txPrevious = *itPrevious->second.txLockRequest.tx; // previously locked one - GetMainSignals().NotifyInstaPACDoubleSpendAttempt(txCurrent, txPrevious); + GetMainSignals().NotifyInstantSendDoubleSpendAttempt(txCurrent, txPrevious); } } } @@ -138,10 +138,10 @@ bool CInstaPAC::ProcessTxLockRequest(const CTxLockRequest& txLockRequest, CConnm if (!CreateTxLockCandidate(txLockRequest)) { // smth is not right - LogPrintf("CInstaPAC::ProcessTxLockRequest -- CreateTxLockCandidate failed, txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::ProcessTxLockRequest -- CreateTxLockCandidate failed, txid=%s\n", txHash.ToString()); return false; } - LogPrintf("CInstaPAC::ProcessTxLockRequest -- accepted, txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::ProcessTxLockRequest -- accepted, txid=%s\n", txHash.ToString()); // Masternodes will sometimes propagate votes before the transaction is known to the client. // If this just happened - process orphan votes, lock inputs, resolve conflicting locks, @@ -153,7 +153,7 @@ bool CInstaPAC::ProcessTxLockRequest(const CTxLockRequest& txLockRequest, CConnm return true; } -bool CInstaPAC::CreateTxLockCandidate(const CTxLockRequest& txLockRequest) +bool CInstantSend::CreateTxLockCandidate(const CTxLockRequest& txLockRequest) { if (!txLockRequest.IsValid()) return false; @@ -163,7 +163,7 @@ bool CInstaPAC::CreateTxLockCandidate(const CTxLockRequest& txLockRequest) std::map::iterator itLockCandidate = mapTxLockCandidates.find(txHash); if (itLockCandidate == mapTxLockCandidates.end()) { - LogPrintf("CInstaPAC::CreateTxLockCandidate -- new, txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::CreateTxLockCandidate -- new, txid=%s\n", txHash.ToString()); CTxLockCandidate txLockCandidate(txLockRequest); // all inputs should already be checked by txLockRequest.IsValid() above, just use them now @@ -175,32 +175,32 @@ bool CInstaPAC::CreateTxLockCandidate(const CTxLockRequest& txLockRequest) // i.e. empty Transaction Lock Candidate was created earlier, let's update it with actual data itLockCandidate->second.txLockRequest = txLockRequest; if (itLockCandidate->second.IsTimedOut()) { - LogPrintf("CInstaPAC::CreateTxLockCandidate -- timed out, txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::CreateTxLockCandidate -- timed out, txid=%s\n", txHash.ToString()); return false; } - LogPrintf("CInstaPAC::CreateTxLockCandidate -- update empty, txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::CreateTxLockCandidate -- update empty, txid=%s\n", txHash.ToString()); // all inputs should already be checked by txLockRequest.IsValid() above, just use them now for (const auto& txin : txLockRequest.tx->vin) { itLockCandidate->second.AddOutPointLock(txin.prevout); } } else { - LogPrint("instantsend", "CInstaPAC::CreateTxLockCandidate -- seen, txid=%s\n", txHash.ToString()); + LogPrint("instantsend", "CInstantSend::CreateTxLockCandidate -- seen, txid=%s\n", txHash.ToString()); } return true; } -void CInstaPAC::CreateEmptyTxLockCandidate(const uint256& txHash) +void CInstantSend::CreateEmptyTxLockCandidate(const uint256& txHash) { if (mapTxLockCandidates.find(txHash) != mapTxLockCandidates.end()) return; - LogPrintf("CInstaPAC::CreateEmptyTxLockCandidate -- new, txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::CreateEmptyTxLockCandidate -- new, txid=%s\n", txHash.ToString()); const CTxLockRequest txLockRequest = CTxLockRequest(); mapTxLockCandidates.insert(std::make_pair(txHash, CTxLockCandidate(txLockRequest))); } -void CInstaPAC::Vote(const uint256& txHash, CConnman& connman) +void CInstantSend::Vote(const uint256& txHash, CConnman& connman) { AssertLockHeld(cs_main); #ifdef ENABLE_WALLET @@ -222,10 +222,10 @@ void CInstaPAC::Vote(const uint256& txHash, CConnman& connman) TryToFinalizeLockCandidate(txLockCandidate); } -void CInstaPAC::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) +void CInstantSend::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) { if (!fMasternodeMode) return; - if (!llmq::IsOldInstaPACEnabled()) return; + if (!llmq::IsOldInstantSendEnabled()) return; AssertLockHeld(cs_main); AssertLockHeld(cs_instantsend); @@ -238,26 +238,26 @@ void CInstaPAC::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) for (auto& outpointLockPair : txLockCandidate.mapOutPointLocks) { int nPrevoutHeight = GetUTXOHeight(outpointLockPair.first); if (nPrevoutHeight == -1) { - LogPrint("instantsend", "CInstaPAC::Vote -- Failed to find UTXO %s\n", outpointLockPair.first.ToStringShort()); + LogPrint("instantsend", "CInstantSend::Vote -- Failed to find UTXO %s\n", outpointLockPair.first.ToStringShort()); return; } - int nLockInputHeight = nPrevoutHeight + Params().GetConsensus().nInstaPACConfirmationsRequired - 2; + int nLockInputHeight = nPrevoutHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2; int nRank; uint256 quorumModifierHash; if (!CMasternodeUtils::GetMasternodeRank(activeMasternodeInfo.outpoint, nRank, quorumModifierHash, nLockInputHeight)) { - LogPrint("instantsend", "CInstaPAC::Vote -- Can't calculate rank for masternode %s\n", activeMasternodeInfo.outpoint.ToStringShort()); + LogPrint("instantsend", "CInstantSend::Vote -- Can't calculate rank for masternode %s\n", activeMasternodeInfo.outpoint.ToStringShort()); continue; } - int nSignaturesTotal = Params().GetConsensus().nInstaPACSigsTotal; + int nSignaturesTotal = Params().GetConsensus().nInstantSendSigsTotal; if (nRank > nSignaturesTotal) { - LogPrint("instantsend", "CInstaPAC::Vote -- Masternode not in the top %d (%d)\n", nSignaturesTotal, nRank); + LogPrint("instantsend", "CInstantSend::Vote -- Masternode not in the top %d (%d)\n", nSignaturesTotal, nRank); continue; } - LogPrint("instantsend", "CInstaPAC::Vote -- In the top %d (%d)\n", nSignaturesTotal, nRank); + LogPrint("instantsend", "CInstantSend::Vote -- In the top %d (%d)\n", nSignaturesTotal, nRank); std::map >::iterator itVoted = mapVotedOutpoints.find(outpointLockPair.first); @@ -271,7 +271,7 @@ void CInstaPAC::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) // we already voted for this outpoint to be included either in the same tx or in a competing one, // skip it anyway fAlreadyVoted = true; - LogPrintf("CInstaPAC::Vote -- WARNING: We already voted for this outpoint, skipping: txHash=%s, outpoint=%s\n", + LogPrintf("CInstantSend::Vote -- WARNING: We already voted for this outpoint, skipping: txHash=%s, outpoint=%s\n", txHash.ToString(), outpointLockPair.first.ToStringShort()); break; } @@ -286,11 +286,11 @@ void CInstaPAC::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) CTxLockVote vote(txHash, outpointLockPair.first, activeMasternodeInfo.outpoint, quorumModifierHash, activeMasternodeInfo.proTxHash); if (!vote.Sign()) { - LogPrintf("CInstaPAC::Vote -- Failed to sign consensus vote\n"); + LogPrintf("CInstantSend::Vote -- Failed to sign consensus vote\n"); return; } if (!vote.CheckSignature()) { - LogPrintf("CInstaPAC::Vote -- Signature invalid\n"); + LogPrintf("CInstantSend::Vote -- Signature invalid\n"); return; } @@ -298,7 +298,7 @@ void CInstaPAC::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) uint256 nVoteHash = vote.GetHash(); mapTxLockVotes.insert(std::make_pair(nVoteHash, vote)); if (outpointLockPair.second.AddVote(vote)) { - LogPrintf("CInstaPAC::Vote -- Vote created successfully, relaying: txHash=%s, outpoint=%s, vote=%s\n", + LogPrintf("CInstantSend::Vote -- Vote created successfully, relaying: txHash=%s, outpoint=%s, vote=%s\n", txHash.ToString(), outpointLockPair.first.ToStringShort(), nVoteHash.ToString()); if (itVoted == mapVotedOutpoints.end()) { @@ -309,7 +309,7 @@ void CInstaPAC::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) mapVotedOutpoints[outpointLockPair.first].insert(txHash); if (mapVotedOutpoints[outpointLockPair.first].size() > 1) { // it's ok to continue, just warn user - LogPrintf("CInstaPAC::Vote -- WARNING: Vote conflicts with some existing votes: txHash=%s, outpoint=%s, vote=%s\n", + LogPrintf("CInstantSend::Vote -- WARNING: Vote conflicts with some existing votes: txHash=%s, outpoint=%s, vote=%s\n", txHash.ToString(), outpointLockPair.first.ToStringShort(), nVoteHash.ToString()); } } @@ -319,14 +319,14 @@ void CInstaPAC::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) } } -bool CInstaPAC::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, CConnman& connman) +bool CInstantSend::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, CConnman& connman) { uint256 txHash = vote.GetTxHash(); uint256 nVoteHash = vote.GetHash(); if (!vote.IsValid(pfrom, connman)) { // could be because of missing MN - LogPrint("instantsend", "CInstaPAC::%s -- Vote is invalid, txid=%s\n", __func__, txHash.ToString()); + LogPrint("instantsend", "CInstantSend::%s -- Vote is invalid, txid=%s\n", __func__, txHash.ToString()); return false; } @@ -350,7 +350,7 @@ bool CInstaPAC::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, CCon CreateEmptyTxLockCandidate(txHash); } bool fInserted = mapTxLockVotesOrphan.emplace(nVoteHash, vote).second; - LogPrint("instantsend", "CInstaPAC::%s -- Orphan vote: txid=%s masternode=%s %s\n", + LogPrint("instantsend", "CInstantSend::%s -- Orphan vote: txid=%s masternode=%s %s\n", __func__, txHash.ToString(), vote.GetMasternodeOutpoint().ToStringShort(), fInserted ? "new" : "seen"); // This tracks those messages and allows only the same rate as of the rest of the network @@ -362,7 +362,7 @@ bool CInstaPAC::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, CCon mapMasternodeOrphanVotes.emplace(vote.GetMasternodeOutpoint(), nMasternodeOrphanExpireTime); } else { if (itMnOV->second > GetTime() && itMnOV->second > GetAverageMasternodeOrphanVoteTime()) { - LogPrint("instantsend", "CInstaPAC::%s -- masternode is spamming orphan Transaction Lock Votes: txid=%s masternode=%s\n", + LogPrint("instantsend", "CInstantSend::%s -- masternode is spamming orphan Transaction Lock Votes: txid=%s masternode=%s\n", __func__, txHash.ToString(), vote.GetMasternodeOutpoint().ToStringShort()); // Misbehaving(pfrom->id, 1); return false; @@ -378,11 +378,11 @@ bool CInstaPAC::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, CCon CTxLockCandidate& txLockCandidate = it->second; if (txLockCandidate.IsTimedOut()) { - LogPrint("instantsend", "CInstaPAC::%s -- too late, Transaction Lock timed out, txid=%s\n", __func__, txHash.ToString()); + LogPrint("instantsend", "CInstantSend::%s -- too late, Transaction Lock timed out, txid=%s\n", __func__, txHash.ToString()); return false; } - LogPrint("instantsend", "CInstaPAC::%s -- Transaction Lock Vote, txid=%s\n", __func__, txHash.ToString()); + LogPrint("instantsend", "CInstantSend::%s -- Transaction Lock Vote, txid=%s\n", __func__, txHash.ToString()); UpdateVotedOutpoints(vote, txLockCandidate); @@ -393,7 +393,7 @@ bool CInstaPAC::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, CCon int nSignatures = txLockCandidate.CountVotes(); int nSignaturesMax = txLockCandidate.txLockRequest.GetMaxSignatures(); - LogPrint("instantsend", "CInstaPAC::%s -- Transaction Lock signatures count: %d/%d, vote hash=%s\n", __func__, + LogPrint("instantsend", "CInstantSend::%s -- Transaction Lock signatures count: %d/%d, vote hash=%s\n", __func__, nSignatures, nSignaturesMax, nVoteHash.ToString()); TryToFinalizeLockCandidate(txLockCandidate); @@ -401,7 +401,7 @@ bool CInstaPAC::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, CCon return true; } -bool CInstaPAC::ProcessOrphanTxLockVote(const CTxLockVote& vote) +bool CInstantSend::ProcessOrphanTxLockVote(const CTxLockVote& vote) { // cs_main, cs_wallet and cs_instantsend should be already locked AssertLockHeld(cs_main); @@ -421,11 +421,11 @@ bool CInstaPAC::ProcessOrphanTxLockVote(const CTxLockVote& vote) CTxLockCandidate& txLockCandidate = it->second; if (txLockCandidate.IsTimedOut()) { - LogPrint("instantsend", "CInstaPAC::%s -- too late, Transaction Lock timed out, txid=%s\n", __func__, txHash.ToString()); + LogPrint("instantsend", "CInstantSend::%s -- too late, Transaction Lock timed out, txid=%s\n", __func__, txHash.ToString()); return false; } - LogPrint("instantsend", "CInstaPAC::%s -- Transaction Lock Vote, txid=%s\n", __func__, txHash.ToString()); + LogPrint("instantsend", "CInstantSend::%s -- Transaction Lock Vote, txid=%s\n", __func__, txHash.ToString()); UpdateVotedOutpoints(vote, txLockCandidate); @@ -436,13 +436,13 @@ bool CInstaPAC::ProcessOrphanTxLockVote(const CTxLockVote& vote) int nSignatures = txLockCandidate.CountVotes(); int nSignaturesMax = txLockCandidate.txLockRequest.GetMaxSignatures(); - LogPrint("instantsend", "CInstaPAC::%s -- Transaction Lock signatures count: %d/%d, vote hash=%s\n", + LogPrint("instantsend", "CInstantSend::%s -- Transaction Lock signatures count: %d/%d, vote hash=%s\n", __func__, nSignatures, nSignaturesMax, vote.GetHash().ToString()); return true; } -void CInstaPAC::UpdateVotedOutpoints(const CTxLockVote& vote, CTxLockCandidate& txLockCandidate) +void CInstantSend::UpdateVotedOutpoints(const CTxLockVote& vote, CTxLockCandidate& txLockCandidate) { AssertLockHeld(cs_instantsend); @@ -458,7 +458,7 @@ void CInstaPAC::UpdateVotedOutpoints(const CTxLockVote& vote, CTxLockCandidate& std::map::iterator it2 = mapTxLockCandidates.find(hash); if (it2 !=mapTxLockCandidates.end() && it2->second.HasMasternodeVoted(vote.GetOutpoint(), vote.GetMasternodeOutpoint())) { // yes, it was the same masternode - LogPrintf("CInstaPAC::%s -- masternode sent conflicting votes! %s\n", __func__, vote.GetMasternodeOutpoint().ToStringShort()); + LogPrintf("CInstantSend::%s -- masternode sent conflicting votes! %s\n", __func__, vote.GetMasternodeOutpoint().ToStringShort()); // mark both Lock Candidates as attacked, none of them should complete, // or at least the new (current) one shouldn't even // if the second one was already completed earlier @@ -480,7 +480,7 @@ void CInstaPAC::UpdateVotedOutpoints(const CTxLockVote& vote, CTxLockCandidate& } } -void CInstaPAC::ProcessOrphanTxLockVotes() +void CInstantSend::ProcessOrphanTxLockVotes() { AssertLockHeld(cs_main); AssertLockHeld(cs_instantsend); @@ -495,17 +495,17 @@ void CInstaPAC::ProcessOrphanTxLockVotes() } } -void CInstaPAC::TryToFinalizeLockCandidate(const CTxLockCandidate& txLockCandidate) +void CInstantSend::TryToFinalizeLockCandidate(const CTxLockCandidate& txLockCandidate) { - if (!llmq::IsOldInstaPACEnabled()) return; + if (!llmq::IsOldInstantSendEnabled()) return; AssertLockHeld(cs_main); AssertLockHeld(cs_instantsend); uint256 txHash = txLockCandidate.txLockRequest.tx->GetHash(); - if (txLockCandidate.IsAllOutPointsReady() && !IsLockedInstaPACTransaction(txHash)) { + if (txLockCandidate.IsAllOutPointsReady() && !IsLockedInstantSendTransaction(txHash)) { // we have enough votes now - LogPrint("instantsend", "CInstaPAC::TryToFinalizeLockCandidate -- Transaction Lock is ready to complete, txid=%s\n", txHash.ToString()); + LogPrint("instantsend", "CInstantSend::TryToFinalizeLockCandidate -- Transaction Lock is ready to complete, txid=%s\n", txHash.ToString()); if (ResolveConflicts(txLockCandidate)) { LockTransactionInputs(txLockCandidate); UpdateLockedTransaction(txLockCandidate); @@ -513,7 +513,7 @@ void CInstaPAC::TryToFinalizeLockCandidate(const CTxLockCandidate& txLockCandida } } -void CInstaPAC::UpdateLockedTransaction(const CTxLockCandidate& txLockCandidate) +void CInstantSend::UpdateLockedTransaction(const CTxLockCandidate& txLockCandidate) { // cs_main, cs_wallet and cs_instantsend should be already locked AssertLockHeld(cs_main); @@ -526,7 +526,7 @@ void CInstaPAC::UpdateLockedTransaction(const CTxLockCandidate& txLockCandidate) uint256 txHash = txLockCandidate.GetHash(); - if (!IsLockedInstaPACTransaction(txHash)) return; // not a locked tx, do not update/notify + if (!IsLockedInstantSendTransaction(txHash)) return; // not a locked tx, do not update/notify #ifdef ENABLE_WALLET if (pwalletMain && pwalletMain->UpdatedTransaction(txHash)) { @@ -541,12 +541,12 @@ void CInstaPAC::UpdateLockedTransaction(const CTxLockCandidate& txLockCandidate) GetMainSignals().NotifyTransactionLock(*txLockCandidate.txLockRequest.tx); - LogPrint("instantsend", "CInstaPAC::UpdateLockedTransaction -- done, txid=%s\n", txHash.ToString()); + LogPrint("instantsend", "CInstantSend::UpdateLockedTransaction -- done, txid=%s\n", txHash.ToString()); } -void CInstaPAC::LockTransactionInputs(const CTxLockCandidate& txLockCandidate) +void CInstantSend::LockTransactionInputs(const CTxLockCandidate& txLockCandidate) { - if (!llmq::IsOldInstaPACEnabled()) return; + if (!llmq::IsOldInstantSendEnabled()) return; LOCK(cs_instantsend); @@ -557,10 +557,10 @@ void CInstaPAC::LockTransactionInputs(const CTxLockCandidate& txLockCandidate) for (const auto& pair : txLockCandidate.mapOutPointLocks) { mapLockedOutpoints.insert(std::make_pair(pair.first, txHash)); } - LogPrint("instantsend", "CInstaPAC::LockTransactionInputs -- done, txid=%s\n", txHash.ToString()); + LogPrint("instantsend", "CInstantSend::LockTransactionInputs -- done, txid=%s\n", txHash.ToString()); } -bool CInstaPAC::GetLockedOutPointTxHash(const COutPoint& outpoint, uint256& hashRet) +bool CInstantSend::GetLockedOutPointTxHash(const COutPoint& outpoint, uint256& hashRet) { LOCK(cs_instantsend); std::map::iterator it = mapLockedOutpoints.find(outpoint); @@ -569,7 +569,7 @@ bool CInstaPAC::GetLockedOutPointTxHash(const COutPoint& outpoint, uint256& hash return true; } -bool CInstaPAC::ResolveConflicts(const CTxLockCandidate& txLockCandidate) +bool CInstantSend::ResolveConflicts(const CTxLockCandidate& txLockCandidate) { AssertLockHeld(cs_main); AssertLockHeld(cs_instantsend); @@ -590,11 +590,11 @@ bool CInstaPAC::ResolveConflicts(const CTxLockCandidate& txLockCandidate) std::map::iterator itLockCandidateConflicting = mapTxLockCandidates.find(hashConflicting); if (itLockCandidate == mapTxLockCandidates.end() || itLockCandidateConflicting == mapTxLockCandidates.end()) { // safety check, should never really happen - LogPrintf("CInstaPAC::ResolveConflicts -- ERROR: Found conflicting completed Transaction Lock, but one of txLockCandidate-s is missing, txid=%s, conflicting txid=%s\n", + LogPrintf("CInstantSend::ResolveConflicts -- ERROR: Found conflicting completed Transaction Lock, but one of txLockCandidate-s is missing, txid=%s, conflicting txid=%s\n", txHash.ToString(), hashConflicting.ToString()); return false; } - LogPrintf("CInstaPAC::ResolveConflicts -- WARNING: Found conflicting completed Transaction Lock, dropping both, txid=%s, conflicting txid=%s\n", + LogPrintf("CInstantSend::ResolveConflicts -- WARNING: Found conflicting completed Transaction Lock, dropping both, txid=%s, conflicting txid=%s\n", txHash.ToString(), hashConflicting.ToString()); CTxLockRequest txLockRequest = itLockCandidate->second.txLockRequest; CTxLockRequest txLockRequestConflicting = itLockCandidateConflicting->second.txLockRequest; @@ -620,7 +620,7 @@ bool CInstaPAC::ResolveConflicts(const CTxLockCandidate& txLockCandidate) hashConflicting = mempool.mapNextTx.find(txin.prevout)->second->GetHash(); if (txHash == hashConflicting) continue; // matches current, not a conflict, skip to next txin // conflicts with tx in mempool - LogPrintf("CInstaPAC::ResolveConflicts -- ERROR: Failed to complete Transaction Lock, conflicts with mempool, txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::ResolveConflicts -- ERROR: Failed to complete Transaction Lock, conflicts with mempool, txid=%s\n", txHash.ToString()); return false; } } // FOREACH @@ -628,7 +628,7 @@ bool CInstaPAC::ResolveConflicts(const CTxLockCandidate& txLockCandidate) CTransactionRef txTmp; uint256 hashBlock; if (GetTransaction(txHash, txTmp, Params().GetConsensus(), hashBlock, true) && hashBlock != uint256()) { - LogPrint("instantsend", "CInstaPAC::ResolveConflicts -- Done, %s is included in block %s\n", txHash.ToString(), hashBlock.ToString()); + LogPrint("instantsend", "CInstantSend::ResolveConflicts -- Done, %s is included in block %s\n", txHash.ToString(), hashBlock.ToString()); return true; } // Not in block yet, make sure all its inputs are still unspent @@ -636,16 +636,16 @@ bool CInstaPAC::ResolveConflicts(const CTxLockCandidate& txLockCandidate) Coin coin; if (!GetUTXOCoin(txin.prevout, coin)) { // Not in UTXO anymore? A conflicting tx was mined while we were waiting for votes. - LogPrintf("CInstaPAC::ResolveConflicts -- ERROR: Failed to find UTXO %s, can't complete Transaction Lock\n", txin.prevout.ToStringShort()); + LogPrintf("CInstantSend::ResolveConflicts -- ERROR: Failed to find UTXO %s, can't complete Transaction Lock\n", txin.prevout.ToStringShort()); return false; } } - LogPrint("instantsend", "CInstaPAC::ResolveConflicts -- Done, txid=%s\n", txHash.ToString()); + LogPrint("instantsend", "CInstantSend::ResolveConflicts -- Done, txid=%s\n", txHash.ToString()); return true; } -int64_t CInstaPAC::GetAverageMasternodeOrphanVoteTime() +int64_t CInstantSend::GetAverageMasternodeOrphanVoteTime() { LOCK(cs_instantsend); // NOTE: should never actually call this function when mapMasternodeOrphanVotes is empty @@ -659,7 +659,7 @@ int64_t CInstaPAC::GetAverageMasternodeOrphanVoteTime() return total / mapMasternodeOrphanVotes.size(); } -void CInstaPAC::CheckAndRemove() +void CInstantSend::CheckAndRemove() { if (!masternodeSync.IsBlockchainSynced()) return; @@ -672,7 +672,7 @@ void CInstaPAC::CheckAndRemove() CTxLockCandidate &txLockCandidate = itLockCandidate->second; uint256 txHash = txLockCandidate.GetHash(); if (txLockCandidate.IsExpired(nCachedBlockHeight)) { - LogPrintf("CInstaPAC::CheckAndRemove -- Removing expired Transaction Lock Candidate: txid=%s\n", txHash.ToString()); + LogPrintf("CInstantSend::CheckAndRemove -- Removing expired Transaction Lock Candidate: txid=%s\n", txHash.ToString()); for (const auto& pair : txLockCandidate.mapOutPointLocks) { mapLockedOutpoints.erase(pair.first); @@ -690,7 +690,7 @@ void CInstaPAC::CheckAndRemove() std::map::iterator itVote = mapTxLockVotes.begin(); while (itVote != mapTxLockVotes.end()) { if (itVote->second.IsExpired(nCachedBlockHeight)) { - LogPrint("instantsend", "CInstaPAC::CheckAndRemove -- Removing expired vote: txid=%s masternode=%s\n", + LogPrint("instantsend", "CInstantSend::CheckAndRemove -- Removing expired vote: txid=%s masternode=%s\n", itVote->second.GetTxHash().ToString(), itVote->second.GetMasternodeOutpoint().ToStringShort()); mapTxLockVotes.erase(itVote++); } else { @@ -702,7 +702,7 @@ void CInstaPAC::CheckAndRemove() std::map::iterator itOrphanVote = mapTxLockVotesOrphan.begin(); while (itOrphanVote != mapTxLockVotesOrphan.end()) { if (itOrphanVote->second.IsTimedOut()) { - LogPrint("instantsend", "CInstaPAC::CheckAndRemove -- Removing timed out orphan vote: txid=%s masternode=%s\n", + LogPrint("instantsend", "CInstantSend::CheckAndRemove -- Removing timed out orphan vote: txid=%s masternode=%s\n", itOrphanVote->second.GetTxHash().ToString(), itOrphanVote->second.GetMasternodeOutpoint().ToStringShort()); mapTxLockVotes.erase(itOrphanVote->first); mapTxLockVotesOrphan.erase(itOrphanVote++); @@ -715,7 +715,7 @@ void CInstaPAC::CheckAndRemove() itVote = mapTxLockVotes.begin(); while (itVote != mapTxLockVotes.end()) { if (itVote->second.IsFailed()) { - LogPrint("instantsend", "CInstaPAC::CheckAndRemove -- Removing vote for failed lock attempt: txid=%s masternode=%s\n", + LogPrint("instantsend", "CInstantSend::CheckAndRemove -- Removing vote for failed lock attempt: txid=%s masternode=%s\n", itVote->second.GetTxHash().ToString(), itVote->second.GetMasternodeOutpoint().ToStringShort()); mapTxLockVotes.erase(itVote++); } else { @@ -727,19 +727,19 @@ void CInstaPAC::CheckAndRemove() std::map::iterator itMasternodeOrphan = mapMasternodeOrphanVotes.begin(); while (itMasternodeOrphan != mapMasternodeOrphanVotes.end()) { if (itMasternodeOrphan->second < GetTime()) { - LogPrint("instantsend", "CInstaPAC::CheckAndRemove -- Removing timed out orphan masternode vote: masternode=%s\n", + LogPrint("instantsend", "CInstantSend::CheckAndRemove -- Removing timed out orphan masternode vote: masternode=%s\n", itMasternodeOrphan->first.ToStringShort()); mapMasternodeOrphanVotes.erase(itMasternodeOrphan++); } else { ++itMasternodeOrphan; } } - LogPrintf("CInstaPAC::CheckAndRemove -- %s\n", ToString()); + LogPrintf("CInstantSend::CheckAndRemove -- %s\n", ToString()); } -bool CInstaPAC::AlreadyHave(const uint256& hash) +bool CInstantSend::AlreadyHave(const uint256& hash) { - if (!llmq::IsOldInstaPACEnabled()) { + if (!llmq::IsOldInstantSendEnabled()) { return true; } @@ -749,27 +749,27 @@ bool CInstaPAC::AlreadyHave(const uint256& hash) mapTxLockVotes.count(hash); } -void CInstaPAC::AcceptLockRequest(const CTxLockRequest& txLockRequest) +void CInstantSend::AcceptLockRequest(const CTxLockRequest& txLockRequest) { LOCK(cs_instantsend); mapLockRequestAccepted.insert(std::make_pair(txLockRequest.GetHash(), txLockRequest)); } -void CInstaPAC::RejectLockRequest(const CTxLockRequest& txLockRequest) +void CInstantSend::RejectLockRequest(const CTxLockRequest& txLockRequest) { LOCK(cs_instantsend); mapLockRequestRejected.insert(std::make_pair(txLockRequest.GetHash(), txLockRequest)); } -bool CInstaPAC::HasTxLockRequest(const uint256& txHash) +bool CInstantSend::HasTxLockRequest(const uint256& txHash) { CTxLockRequest txLockRequestTmp; return GetTxLockRequest(txHash, txLockRequestTmp); } -bool CInstaPAC::GetTxLockRequest(const uint256& txHash, CTxLockRequest& txLockRequestRet) +bool CInstantSend::GetTxLockRequest(const uint256& txHash, CTxLockRequest& txLockRequestRet) { - if (!llmq::IsOldInstaPACEnabled()) { + if (!llmq::IsOldInstantSendEnabled()) { return false; } @@ -782,9 +782,9 @@ bool CInstaPAC::GetTxLockRequest(const uint256& txHash, CTxLockRequest& txLockRe return true; } -bool CInstaPAC::GetTxLockVote(const uint256& hash, CTxLockVote& txLockVoteRet) +bool CInstantSend::GetTxLockVote(const uint256& hash, CTxLockVote& txLockVoteRet) { - if (!llmq::IsOldInstaPACEnabled()) { + if (!llmq::IsOldInstantSendEnabled()) { return false; } @@ -797,7 +797,7 @@ bool CInstaPAC::GetTxLockVote(const uint256& hash, CTxLockVote& txLockVoteRet) return true; } -void CInstaPAC::Clear() +void CInstantSend::Clear() { LOCK(cs_instantsend); @@ -812,9 +812,9 @@ void CInstaPAC::Clear() nCachedBlockHeight = 0; } -bool CInstaPAC::IsLockedInstaPACTransaction(const uint256& txHash) +bool CInstantSend::IsLockedInstantSendTransaction(const uint256& txHash) { - if (!fEnableInstaPAC || GetfLargeWorkForkFound() || GetfLargeWorkInvalidChainFound() || + if (!fEnableInstantSend || GetfLargeWorkForkFound() || GetfLargeWorkInvalidChainFound() || !sporkManager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) return false; LOCK(cs_instantsend); @@ -835,11 +835,11 @@ bool CInstaPAC::IsLockedInstaPACTransaction(const uint256& txHash) return true; } -int CInstaPAC::GetTransactionLockSignatures(const uint256& txHash) +int CInstantSend::GetTransactionLockSignatures(const uint256& txHash) { - if (!fEnableInstaPAC) return -1; + if (!fEnableInstantSend) return -1; if (GetfLargeWorkForkFound() || GetfLargeWorkInvalidChainFound()) return -2; - if (!llmq::IsOldInstaPACEnabled()) return -3; + if (!llmq::IsOldInstantSendEnabled()) return -3; LOCK(cs_instantsend); @@ -851,9 +851,9 @@ int CInstaPAC::GetTransactionLockSignatures(const uint256& txHash) return -1; } -bool CInstaPAC::IsTxLockCandidateTimedOut(const uint256& txHash) +bool CInstantSend::IsTxLockCandidateTimedOut(const uint256& txHash) { - if (!fEnableInstaPAC) return false; + if (!fEnableInstantSend) return false; LOCK(cs_instantsend); @@ -866,7 +866,7 @@ bool CInstaPAC::IsTxLockCandidateTimedOut(const uint256& txHash) return false; } -void CInstaPAC::Relay(const uint256& txHash, CConnman& connman) +void CInstantSend::Relay(const uint256& txHash, CConnman& connman) { LOCK(cs_instantsend); @@ -876,12 +876,12 @@ void CInstaPAC::Relay(const uint256& txHash, CConnman& connman) } } -void CInstaPAC::UpdatedBlockTip(const CBlockIndex *pindex) +void CInstantSend::UpdatedBlockTip(const CBlockIndex *pindex) { nCachedBlockHeight = pindex->nHeight; } -void CInstaPAC::SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock) +void CInstantSend::SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock) { // Update lock candidates and votes if corresponding tx confirmed // or went from confirmed to 0-confirmed or conflicted. @@ -895,12 +895,12 @@ void CInstaPAC::SyncTransaction(const CTransaction& tx, const CBlockIndex *pinde // When tx is 0-confirmed or conflicted, posInBlock is SYNC_TRANSACTION_NOT_IN_BLOCK and nHeightNew should be set to -1 int nHeightNew = posInBlock == CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK ? -1 : pindex->nHeight; - LogPrint("instantsend", "CInstaPAC::SyncTransaction -- txid=%s nHeightNew=%d\n", txHash.ToString(), nHeightNew); + LogPrint("instantsend", "CInstantSend::SyncTransaction -- txid=%s nHeightNew=%d\n", txHash.ToString(), nHeightNew); // Check lock candidates std::map::iterator itLockCandidate = mapTxLockCandidates.find(txHash); if (itLockCandidate != mapTxLockCandidates.end()) { - LogPrint("instantsend", "CInstaPAC::SyncTransaction -- txid=%s nHeightNew=%d lock candidate updated\n", + LogPrint("instantsend", "CInstantSend::SyncTransaction -- txid=%s nHeightNew=%d lock candidate updated\n", txHash.ToString(), nHeightNew); itLockCandidate->second.SetConfirmedHeight(nHeightNew); // Loop through outpoint locks @@ -908,7 +908,7 @@ void CInstaPAC::SyncTransaction(const CTransaction& tx, const CBlockIndex *pinde // Check corresponding lock votes for (const auto& vote : pair.second.GetVotes()) { uint256 nVoteHash = vote.GetHash(); - LogPrint("instantsend", "CInstaPAC::SyncTransaction -- txid=%s nHeightNew=%d vote %s updated\n", + LogPrint("instantsend", "CInstantSend::SyncTransaction -- txid=%s nHeightNew=%d vote %s updated\n", txHash.ToString(), nHeightNew, nVoteHash.ToString()); const auto& it = mapTxLockVotes.find(nVoteHash); if (it != mapTxLockVotes.end()) { @@ -921,29 +921,29 @@ void CInstaPAC::SyncTransaction(const CTransaction& tx, const CBlockIndex *pinde // check orphan votes for (const auto& pair : mapTxLockVotesOrphan) { if (pair.second.GetTxHash() == txHash) { - LogPrint("instantsend", "CInstaPAC::SyncTransaction -- txid=%s nHeightNew=%d vote %s updated\n", + LogPrint("instantsend", "CInstantSend::SyncTransaction -- txid=%s nHeightNew=%d vote %s updated\n", txHash.ToString(), nHeightNew, pair.first.ToString()); mapTxLockVotes[pair.first].SetConfirmedHeight(nHeightNew); } } } -std::string CInstaPAC::ToString() const +std::string CInstantSend::ToString() const { LOCK(cs_instantsend); return strprintf("Lock Candidates: %llu, Votes %llu", mapTxLockCandidates.size(), mapTxLockVotes.size()); } -void CInstaPAC::DoMaintenance() +void CInstantSend::DoMaintenance() { if (ShutdownRequested()) return; CheckAndRemove(); } -bool CInstaPAC::CanAutoLock() +bool CInstantSend::CanAutoLock() { - if (!isAutoLockBip9Active || !llmq::IsOldInstaPACEnabled()) { + if (!isAutoLockBip9Active || !llmq::IsOldInstantSendEnabled()) { return false; } if (!sporkManager.IsSporkActive(SPORK_16_INSTANTSEND_AUTOLOCKS)) { @@ -972,7 +972,7 @@ bool CTxLockRequest::IsValid() const CAmount nValueIn = 0; - int nInstaPACConfirmationsRequired = Params().GetConsensus().nInstaPACConfirmationsRequired; + int nInstantSendConfirmationsRequired = Params().GetConsensus().nInstantSendConfirmationsRequired; for (const auto& txin : tx->vin) { @@ -985,7 +985,7 @@ bool CTxLockRequest::IsValid() const int nTxAge = chainActive.Height() - coin.nHeight + 1; // 1 less than the "send IX" gui requires, in case of a block propagating the network at the time - int nConfirmationsRequired = nInstaPACConfirmationsRequired - 1; + int nConfirmationsRequired = nInstantSendConfirmationsRequired - 1; if (nTxAge < nConfirmationsRequired) { LogPrint("instantsend", "CTxLockRequest::IsValid -- outpoint %s too new: nTxAge=%d, nConfirmationsRequired=%d, txid=%s\n", @@ -1013,7 +1013,7 @@ bool CTxLockRequest::IsValid() const CAmount CTxLockRequest::GetMinFee(bool fForceMinFee) const { - if (!fForceMinFee && CInstaPAC::CanAutoLock() && IsSimple()) { + if (!fForceMinFee && CInstantSend::CanAutoLock() && IsSimple()) { return CAmount(); } CAmount nMinFee = MIN_FEE; @@ -1022,7 +1022,7 @@ CAmount CTxLockRequest::GetMinFee(bool fForceMinFee) const int CTxLockRequest::GetMaxSignatures() const { - return tx->vin.size() * Params().GetConsensus().nInstaPACSigsTotal; + return tx->vin.size() * Params().GetConsensus().nInstantSendSigsTotal; } bool CTxLockRequest::IsSimple() const @@ -1063,7 +1063,7 @@ bool CTxLockVote::IsValid(CNode* pnode, CConnman& connman) const return false; } - int nLockInputHeight = coin.nHeight + Params().GetConsensus().nInstaPACConfirmationsRequired - 2; + int nLockInputHeight = coin.nHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2; int nRank; uint256 expectedQuorumModifierHash; @@ -1084,7 +1084,7 @@ bool CTxLockVote::IsValid(CNode* pnode, CConnman& connman) const LogPrint("instantsend", "CTxLockVote::IsValid -- Masternode %s, rank=%d\n", outpointMasternode.ToStringShort(), nRank); - int nSignaturesTotal = Params().GetConsensus().nInstaPACSigsTotal; + int nSignaturesTotal = Params().GetConsensus().nInstantSendSigsTotal; if (nRank > nSignaturesTotal) { LogPrint("instantsend", "CTxLockVote::IsValid -- Masternode %s is not in the top %d (%d), vote hash=%s\n", outpointMasternode.ToStringShort(), nSignaturesTotal, nRank, GetHash().ToString()); @@ -1156,8 +1156,8 @@ void CTxLockVote::Relay(CConnman& connman) const bool CTxLockVote::IsExpired(int nHeight) const { - // Locks and votes expire nInstaPACKeepLock blocks after the block corresponding tx was included into. - return (nConfirmedHeight != -1) && (nHeight - nConfirmedHeight > Params().GetConsensus().nInstaPACKeepLock); + // Locks and votes expire nInstantSendKeepLock blocks after the block corresponding tx was included into. + return (nConfirmedHeight != -1) && (nHeight - nConfirmedHeight > Params().GetConsensus().nInstantSendKeepLock); } bool CTxLockVote::IsTimedOut() const @@ -1167,7 +1167,7 @@ bool CTxLockVote::IsTimedOut() const bool CTxLockVote::IsFailed() const { - return (GetTime() - nTimeCreated > INSTANTSEND_FAILED_TIMEOUT_SECONDS) && !instantsend.IsLockedInstaPACTransaction(GetTxHash()); + return (GetTime() - nTimeCreated > INSTANTSEND_FAILED_TIMEOUT_SECONDS) && !instantsend.IsLockedInstantSendTransaction(GetTxHash()); } // @@ -1195,7 +1195,7 @@ bool COutPointLock::HasMasternodeVoted(const COutPoint& outpointMasternodeIn) co bool COutPointLock::IsReady() const { - return !fAttacked && CountVotes() >= Params().GetConsensus().nInstaPACSigsRequired; + return !fAttacked && CountVotes() >= Params().GetConsensus().nInstantSendSigsRequired; } void COutPointLock::Relay(CConnman& connman) const @@ -1256,8 +1256,8 @@ int CTxLockCandidate::CountVotes() const bool CTxLockCandidate::IsExpired(int nHeight) const { - // Locks and votes expire nInstaPACKeepLock blocks after the block corresponding tx was included into. - return (nConfirmedHeight != -1) && (nHeight - nConfirmedHeight > Params().GetConsensus().nInstaPACKeepLock); + // Locks and votes expire nInstantSendKeepLock blocks after the block corresponding tx was included into. + return (nConfirmedHeight != -1) && (nHeight - nConfirmedHeight > Params().GetConsensus().nInstantSendKeepLock); } bool CTxLockCandidate::IsTimedOut() const diff --git a/src/instantx.h b/src/instantx.h index 23e424342e510..74201cee82046 100644 --- a/src/instantx.h +++ b/src/instantx.h @@ -14,9 +14,9 @@ class CTxLockVote; class COutPointLock; class CTxLockRequest; class CTxLockCandidate; -class CInstaPAC; +class CInstantSend; -extern CInstaPAC instantsend; +extern CInstantSend instantsend; /* At 15 signatures, 1/2 of the masternode network can be owned by @@ -37,12 +37,12 @@ static const int INSTANTSEND_LOCK_TIMEOUT_SECONDS = 15; /// must be greater than INSTANTSEND_LOCK_TIMEOUT_SECONDS static const int INSTANTSEND_FAILED_TIMEOUT_SECONDS = 60; -extern bool fEnableInstaPAC; +extern bool fEnableInstantSend; /** * Manages InstaPAC. Processes lock requests, candidates, and votes. */ -class CInstaPAC +class CInstantSend { public: /// Automatic locks of "simple" transactions are only allowed @@ -136,7 +136,7 @@ class CInstaPAC bool GetLockedOutPointTxHash(const COutPoint& outpoint, uint256& hashRet); /// Verify if transaction is currently locked - bool IsLockedInstaPACTransaction(const uint256& txHash); + bool IsLockedInstantSendTransaction(const uint256& txHash); /// Get the actual number of accepted lock signatures int GetTransactionLockSignatures(const uint256& txHash); diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index f739053b72c63..711e69c77d9f0 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -143,7 +143,7 @@ void CQuorum::StartCachePopulatorThread(std::shared_ptr _this) // this thread will exit after some time // when then later some other thread tries to get keys, it will be much faster _this->cachePopulatorThread = std::thread([_this, t]() { - RenameThread("dash-q-cachepop"); + RenameThread("pacglobal-q-cachepop"); for (size_t i = 0; i < _this->members.size() && !_this->stopCachePopulatorThread && !ShutdownRequested(); i++) { if (_this->qc.validMembers[i]) { _this->GetPubKeyShare(i); diff --git a/src/llmq/quorums.h b/src/llmq/quorums.h index f4aa6930d2e1c..aa99ab38ae0b0 100644 --- a/src/llmq/quorums.h +++ b/src/llmq/quorums.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_H -#define PAC_QUORUMS_H +#ifndef DASH_QUORUMS_H +#define DASH_QUORUMS_H #include "evo/evodb.h" #include "evo/deterministicmns.h" diff --git a/src/llmq/quorums_blockprocessor.h b/src/llmq/quorums_blockprocessor.h index c10b414224395..959daa6913ebb 100644 --- a/src/llmq/quorums_blockprocessor.h +++ b/src/llmq/quorums_blockprocessor.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_BLOCKPROCESSOR_H -#define PAC_QUORUMS_BLOCKPROCESSOR_H +#ifndef DASH_QUORUMS_BLOCKPROCESSOR_H +#define DASH_QUORUMS_BLOCKPROCESSOR_H #include "llmq/quorums_commitment.h" #include "llmq/quorums_utils.h" diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp index 5c6ba81e16ecc..cdb5d99ac14c2 100644 --- a/src/llmq/quorums_chainlocks.cpp +++ b/src/llmq/quorums_chainlocks.cpp @@ -286,7 +286,7 @@ void CChainLocksHandler::TrySignChainTip() // considered safe when it is ixlocked or at least known since 10 minutes (from mempool or block). These checks are // performed for the tip (which we try to sign) and the previous 5 blocks. If a ChainLocked block is found on the // way down, we consider all TXs to be safe. - if (IsNewInstaPACEnabled() && sporkManager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) { + if (IsNewInstantSendEnabled() && sporkManager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) { auto pindexWalk = pindex; while (pindexWalk) { if (pindex->nHeight - pindexWalk->nHeight > 5) { @@ -317,7 +317,7 @@ void CChainLocksHandler::TrySignChainTip() } } - if (txAge < WAIT_FOR_ISLOCK_TIMEOUT && !quorumInstaPACManager->IsLocked(txid)) { + if (txAge < WAIT_FOR_ISLOCK_TIMEOUT && !quorumInstantSendManager->IsLocked(txid)) { LogPrint("chainlocks", "CChainLocksHandler::%s -- not signing block %s due to TX %s not being ixlocked and not old enough. age=%d\n", __func__, pindexWalk->GetBlockHash().ToString(), txid.ToString(), txAge); return; @@ -433,7 +433,7 @@ bool CChainLocksHandler::IsTxSafeForMining(const uint256& txid) if (!sporkManager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) { return true; } - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return true; } @@ -449,7 +449,7 @@ bool CChainLocksHandler::IsTxSafeForMining(const uint256& txid) } } - if (txAge < WAIT_FOR_ISLOCK_TIMEOUT && !quorumInstaPACManager->IsLocked(txid)) { + if (txAge < WAIT_FOR_ISLOCK_TIMEOUT && !quorumInstantSendManager->IsLocked(txid)) { return false; } return true; diff --git a/src/llmq/quorums_chainlocks.h b/src/llmq/quorums_chainlocks.h index a5660bd92ee9d..2577e242b527e 100644 --- a/src/llmq/quorums_chainlocks.h +++ b/src/llmq/quorums_chainlocks.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_CHAINLOCKS_H -#define PAC_QUORUMS_CHAINLOCKS_H +#ifndef DASH_QUORUMS_CHAINLOCKS_H +#define DASH_QUORUMS_CHAINLOCKS_H #include "llmq/quorums.h" #include "llmq/quorums_signing.h" diff --git a/src/llmq/quorums_commitment.h b/src/llmq/quorums_commitment.h index 5fa8d35b57b04..c58287631548b 100644 --- a/src/llmq/quorums_commitment.h +++ b/src/llmq/quorums_commitment.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_COMMITMENT_H -#define PAC_QUORUMS_COMMITMENT_H +#ifndef DASH_QUORUMS_COMMITMENT_H +#define DASH_QUORUMS_COMMITMENT_H #include "consensus/params.h" diff --git a/src/llmq/quorums_debug.h b/src/llmq/quorums_debug.h index 528c74a7b62bc..9c91f7d370303 100644 --- a/src/llmq/quorums_debug.h +++ b/src/llmq/quorums_debug.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_DEBUG_H -#define PAC_QUORUMS_DEBUG_H +#ifndef DASH_QUORUMS_DEBUG_H +#define DASH_QUORUMS_DEBUG_H #include "consensus/params.h" #include "sync.h" diff --git a/src/llmq/quorums_dkgsession.h b/src/llmq/quorums_dkgsession.h index c7e20eca09a3c..209dfccd662f2 100644 --- a/src/llmq/quorums_dkgsession.h +++ b/src/llmq/quorums_dkgsession.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_DKGSESSION_H -#define PAC_QUORUMS_DKGSESSION_H +#ifndef DASH_QUORUMS_DKGSESSION_H +#define DASH_QUORUMS_DKGSESSION_H #include "consensus/params.h" #include "net.h" diff --git a/src/llmq/quorums_dkgsessionhandler.cpp b/src/llmq/quorums_dkgsessionhandler.cpp index 938b2fe7d08cc..9a032b0169949 100644 --- a/src/llmq/quorums_dkgsessionhandler.cpp +++ b/src/llmq/quorums_dkgsessionhandler.cpp @@ -95,7 +95,7 @@ CDKGSessionHandler::CDKGSessionHandler(const Consensus::LLMQParams& _params, ctp pendingPrematureCommitments((size_t)_params.size * 2) { phaseHandlerThread = std::thread([this] { - RenameThread(strprintf("dash-q-phase-%d", (uint8_t)params.type).c_str()); + RenameThread(strprintf("pacglobal-q-phase-%d", (uint8_t)params.type).c_str()); PhaseHandlerThread(); }); } diff --git a/src/llmq/quorums_dkgsessionhandler.h b/src/llmq/quorums_dkgsessionhandler.h index d09ccf92c0aef..61b3cc2903fd6 100644 --- a/src/llmq/quorums_dkgsessionhandler.h +++ b/src/llmq/quorums_dkgsessionhandler.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_DKGSESSIONHANDLER_H -#define PAC_QUORUMS_DKGSESSIONHANDLER_H +#ifndef DASH_QUORUMS_DKGSESSIONHANDLER_H +#define DASH_QUORUMS_DKGSESSIONHANDLER_H #include "llmq/quorums_dkgsession.h" diff --git a/src/llmq/quorums_dkgsessionmgr.h b/src/llmq/quorums_dkgsessionmgr.h index 4e773b71cba41..276bdf57bb592 100644 --- a/src/llmq/quorums_dkgsessionmgr.h +++ b/src/llmq/quorums_dkgsessionmgr.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_DKGSESSIONMGR_H -#define PAC_QUORUMS_DKGSESSIONMGR_H +#ifndef DASH_QUORUMS_DKGSESSIONMGR_H +#define DASH_QUORUMS_DKGSESSIONMGR_H #include "llmq/quorums_dkgsessionhandler.h" diff --git a/src/llmq/quorums_init.cpp b/src/llmq/quorums_init.cpp index 52e9b5f7d0a6e..394703ad5af99 100644 --- a/src/llmq/quorums_init.cpp +++ b/src/llmq/quorums_init.cpp @@ -36,13 +36,13 @@ void InitLLMQSystem(CEvoDB& evoDb, CScheduler* scheduler, bool unitTests, bool f quorumSigSharesManager = new CSigSharesManager(); quorumSigningManager = new CSigningManager(*llmqDb, unitTests); chainLocksHandler = new CChainLocksHandler(scheduler); - quorumInstaPACManager = new CInstaPACManager(*llmqDb); + quorumInstantSendManager = new CInstantSendManager(*llmqDb); } void DestroyLLMQSystem() { - delete quorumInstaPACManager; - quorumInstaPACManager = nullptr; + delete quorumInstantSendManager; + quorumInstantSendManager = nullptr; delete chainLocksHandler; chainLocksHandler = nullptr; delete quorumSigningManager; @@ -80,15 +80,15 @@ void StartLLMQSystem() if (chainLocksHandler) { chainLocksHandler->Start(); } - if (quorumInstaPACManager) { - quorumInstaPACManager->Start(); + if (quorumInstantSendManager) { + quorumInstantSendManager->Start(); } } void StopLLMQSystem() { - if (quorumInstaPACManager) { - quorumInstaPACManager->Stop(); + if (quorumInstantSendManager) { + quorumInstantSendManager->Stop(); } if (chainLocksHandler) { chainLocksHandler->Stop(); @@ -110,8 +110,8 @@ void InterruptLLMQSystem() if (quorumSigSharesManager) { quorumSigSharesManager->InterruptWorkerThread(); } - if (quorumInstaPACManager) { - quorumInstaPACManager->InterruptWorkerThread(); + if (quorumInstantSendManager) { + quorumInstantSendManager->InterruptWorkerThread(); } } diff --git a/src/llmq/quorums_init.h b/src/llmq/quorums_init.h index f3088b25db3d3..3d5538f049a51 100644 --- a/src/llmq/quorums_init.h +++ b/src/llmq/quorums_init.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_INIT_H -#define PAC_QUORUMS_INIT_H +#ifndef DASH_QUORUMS_INIT_H +#define DASH_QUORUMS_INIT_H class CDBWrapper; class CEvoDB; diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 0a2427f73f4b1..0ce99a9a2b32f 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -31,9 +31,9 @@ namespace llmq static const std::string INPUTLOCK_REQUESTID_PREFIX = "inlock"; static const std::string ISLOCK_REQUESTID_PREFIX = "islock"; -CInstaPACManager* quorumInstaPACManager; +CInstantSendManager* quorumInstantSendManager; -uint256 CInstaPACLock::GetRequestId() const +uint256 CInstantSendLock::GetRequestId() const { CHashWriter hw(SER_GETHASH, 0); hw << ISLOCK_REQUESTID_PREFIX; @@ -43,7 +43,7 @@ uint256 CInstaPACLock::GetRequestId() const //////////////// -void CInstaPACDb::WriteNewInstaPACLock(const uint256& hash, const CInstaPACLock& islock) +void CInstantSendDb::WriteNewInstantSendLock(const uint256& hash, const CInstantSendLock& islock) { CDBBatch batch(db); batch.Write(std::make_tuple(std::string("is_i"), hash), islock); @@ -53,7 +53,7 @@ void CInstaPACDb::WriteNewInstaPACLock(const uint256& hash, const CInstaPACLock& } db.WriteBatch(batch); - auto p = std::make_shared(islock); + auto p = std::make_shared(islock); islockCache.insert(hash, p); txidCache.insert(islock.txid, hash); for (auto& in : islock.inputs) { @@ -61,10 +61,10 @@ void CInstaPACDb::WriteNewInstaPACLock(const uint256& hash, const CInstaPACLock& } } -void CInstaPACDb::RemoveInstaPACLock(CDBBatch& batch, const uint256& hash, CInstaPACLockPtr islock) +void CInstantSendDb::RemoveInstantSendLock(CDBBatch& batch, const uint256& hash, CInstantSendLockPtr islock) { if (!islock) { - islock = GetInstaPACLockByHash(hash); + islock = GetInstantSendLockByHash(hash); if (!islock) { return; } @@ -88,23 +88,23 @@ static std::tuple BuildInversedISLockKey(const s return std::make_tuple(k, htobe32(std::numeric_limits::max() - nHeight), islockHash); } -void CInstaPACDb::WriteInstaPACLockMined(const uint256& hash, int nHeight) +void CInstantSendDb::WriteInstantSendLockMined(const uint256& hash, int nHeight) { db.Write(BuildInversedISLockKey("is_m", nHeight, hash), true); } -void CInstaPACDb::RemoveInstaPACLockMined(const uint256& hash, int nHeight) +void CInstantSendDb::RemoveInstantSendLockMined(const uint256& hash, int nHeight) { db.Erase(BuildInversedISLockKey("is_m", nHeight, hash)); } -void CInstaPACDb::WriteInstaPACLockArchived(CDBBatch& batch, const uint256& hash, int nHeight) +void CInstantSendDb::WriteInstantSendLockArchived(CDBBatch& batch, const uint256& hash, int nHeight) { batch.Write(BuildInversedISLockKey("is_a1", nHeight, hash), true); batch.Write(std::make_tuple(std::string("is_a2"), hash), true); } -std::unordered_map CInstaPACDb::RemoveConfirmedInstaPACLocks(int nUntilHeight) +std::unordered_map CInstantSendDb::RemoveConfirmedInstantSendLocks(int nUntilHeight) { auto it = std::unique_ptr(db.NewIterator()); @@ -113,7 +113,7 @@ std::unordered_map CInstaPACDb::RemoveConfirmedInstaP it->Seek(firstKey); CDBBatch batch(db); - std::unordered_map ret; + std::unordered_map ret; while (it->Valid()) { decltype(firstKey) curKey; if (!it->GetKey(curKey) || std::get<0>(curKey) != "is_m") { @@ -125,14 +125,14 @@ std::unordered_map CInstaPACDb::RemoveConfirmedInstaP } auto& islockHash = std::get<2>(curKey); - auto islock = GetInstaPACLockByHash(islockHash); + auto islock = GetInstantSendLockByHash(islockHash); if (islock) { - RemoveInstaPACLock(batch, islockHash, islock); + RemoveInstantSendLock(batch, islockHash, islock); ret.emplace(islockHash, islock); } // archive the islock hash, so that we're still able to check if we've seen the islock in the past - WriteInstaPACLockArchived(batch, islockHash, nHeight); + WriteInstantSendLockArchived(batch, islockHash, nHeight); batch.Erase(curKey); @@ -144,7 +144,7 @@ std::unordered_map CInstaPACDb::RemoveConfirmedInstaP return ret; } -void CInstaPACDb::RemoveArchivedInstaPACLocks(int nUntilHeight) +void CInstantSendDb::RemoveArchivedInstantSendLocks(int nUntilHeight) { auto it = std::unique_ptr(db.NewIterator()); @@ -173,12 +173,12 @@ void CInstaPACDb::RemoveArchivedInstaPACLocks(int nUntilHeight) db.WriteBatch(batch); } -bool CInstaPACDb::HasArchivedInstaPACLock(const uint256& islockHash) +bool CInstantSendDb::HasArchivedInstantSendLock(const uint256& islockHash) { return db.Exists(std::make_tuple(std::string("is_a2"), islockHash)); } -size_t CInstaPACDb::GetInstaPACLockCount() +size_t CInstantSendDb::GetInstantSendLockCount() { auto it = std::unique_ptr(db.NewIterator()); auto firstKey = std::make_tuple(std::string("is_i"), uint256()); @@ -200,14 +200,14 @@ size_t CInstaPACDb::GetInstaPACLockCount() return cnt; } -CInstaPACLockPtr CInstaPACDb::GetInstaPACLockByHash(const uint256& hash) +CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash) { - CInstaPACLockPtr ret; + CInstantSendLockPtr ret; if (islockCache.get(hash, ret)) { return ret; } - ret = std::make_shared(); + ret = std::make_shared(); bool exists = db.Read(std::make_tuple(std::string("is_i"), hash), *ret); if (!exists) { ret = nullptr; @@ -216,7 +216,7 @@ CInstaPACLockPtr CInstaPACDb::GetInstaPACLockByHash(const uint256& hash) return ret; } -uint256 CInstaPACDb::GetInstaPACLockHashByTxid(const uint256& txid) +uint256 CInstantSendDb::GetInstantSendLockHashByTxid(const uint256& txid) { uint256 islockHash; @@ -236,16 +236,16 @@ uint256 CInstaPACDb::GetInstaPACLockHashByTxid(const uint256& txid) return islockHash; } -CInstaPACLockPtr CInstaPACDb::GetInstaPACLockByTxid(const uint256& txid) +CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByTxid(const uint256& txid) { - uint256 islockHash = GetInstaPACLockHashByTxid(txid); + uint256 islockHash = GetInstantSendLockHashByTxid(txid); if (islockHash.IsNull()) { return nullptr; } - return GetInstaPACLockByHash(islockHash); + return GetInstantSendLockByHash(islockHash); } -CInstaPACLockPtr CInstaPACDb::GetInstaPACLockByInput(const COutPoint& outpoint) +CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByInput(const COutPoint& outpoint) { uint256 islockHash; bool found = outpointCache.get(outpoint, islockHash); @@ -261,10 +261,10 @@ CInstaPACLockPtr CInstaPACDb::GetInstaPACLockByInput(const COutPoint& outpoint) if (!found) { return nullptr; } - return GetInstaPACLockByHash(islockHash); + return GetInstantSendLockByHash(islockHash); } -std::vector CInstaPACDb::GetInstaPACLocksByParent(const uint256& parent) +std::vector CInstantSendDb::GetInstantSendLocksByParent(const uint256& parent) { auto it = std::unique_ptr(db.NewIterator()); auto firstKey = std::make_tuple(std::string("is_in"), COutPoint(parent, 0)); @@ -293,7 +293,7 @@ std::vector CInstaPACDb::GetInstaPACLocksByParent(const uint256& parent return result; } -std::vector CInstaPACDb::RemoveChainedInstaPACLocks(const uint256& islockHash, const uint256& txid, int nHeight) +std::vector CInstantSendDb::RemoveChainedInstantSendLocks(const uint256& islockHash, const uint256& txid, int nHeight) { std::vector result; @@ -303,17 +303,17 @@ std::vector CInstaPACDb::RemoveChainedInstaPACLocks(const uint256& islo CDBBatch batch(db); while (!stack.empty()) { - auto children = GetInstaPACLocksByParent(stack.back()); + auto children = GetInstantSendLocksByParent(stack.back()); stack.pop_back(); for (auto& childIslockHash : children) { - auto childIsLock = GetInstaPACLockByHash(childIslockHash); + auto childIsLock = GetInstantSendLockByHash(childIslockHash); if (!childIsLock) { continue; } - RemoveInstaPACLock(batch, childIslockHash, childIsLock); - WriteInstaPACLockArchived(batch, childIslockHash, nHeight); + RemoveInstantSendLock(batch, childIslockHash, childIsLock); + WriteInstantSendLockArchived(batch, childIslockHash, nHeight); result.emplace_back(childIslockHash); if (added.emplace(childIsLock->txid).second) { @@ -322,8 +322,8 @@ std::vector CInstaPACDb::RemoveChainedInstaPACLocks(const uint256& islo } } - RemoveInstaPACLock(batch, islockHash, nullptr); - WriteInstaPACLockArchived(batch, islockHash, nHeight); + RemoveInstantSendLock(batch, islockHash, nullptr); + WriteInstantSendLockArchived(batch, islockHash, nHeight); result.emplace_back(islockHash); db.WriteBatch(batch); @@ -333,29 +333,29 @@ std::vector CInstaPACDb::RemoveChainedInstaPACLocks(const uint256& islo //////////////// -CInstaPACManager::CInstaPACManager(CDBWrapper& _llmqDb) : +CInstantSendManager::CInstantSendManager(CDBWrapper& _llmqDb) : db(_llmqDb) { workInterrupt.reset(); } -CInstaPACManager::~CInstaPACManager() +CInstantSendManager::~CInstantSendManager() { } -void CInstaPACManager::Start() +void CInstantSendManager::Start() { // can't start new thread if we have one running already if (workThread.joinable()) { assert(false); } - workThread = std::thread(&TraceThread >, "instantsend", std::function(std::bind(&CInstaPACManager::WorkThreadMain, this))); + workThread = std::thread(&TraceThread >, "instantsend", std::function(std::bind(&CInstantSendManager::WorkThreadMain, this))); quorumSigningManager->RegisterRecoveredSigsListener(this); } -void CInstaPACManager::Stop() +void CInstantSendManager::Stop() { quorumSigningManager->UnregisterRecoveredSigsListener(this); @@ -369,14 +369,14 @@ void CInstaPACManager::Stop() } } -void CInstaPACManager::InterruptWorkerThread() +void CInstantSendManager::InterruptWorkerThread() { workInterrupt(); } -bool CInstaPACManager::ProcessTx(const CTransaction& tx, const Consensus::Params& params) +bool CInstantSendManager::ProcessTx(const CTransaction& tx, const Consensus::Params& params) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return true; } @@ -398,7 +398,7 @@ bool CInstaPACManager::ProcessTx(const CTransaction& tx, const Consensus::Params uint256 islockHash; { LOCK(cs); - islockHash = db.GetInstaPACLockHashByTxid(tx.GetHash()); + islockHash = db.GetInstantSendLockHashByTxid(tx.GetHash()); } if (!islockHash.IsNull()) { CInv inv(MSG_ISLOCK, islockHash); @@ -424,7 +424,7 @@ bool CInstaPACManager::ProcessTx(const CTransaction& tx, const Consensus::Params uint256 otherTxHash; if (quorumSigningManager->GetVoteForId(llmqType, id, otherTxHash)) { if (otherTxHash != tx.GetHash()) { - LogPrintf("CInstaPACManager::%s -- txid=%s: input %s is conflicting with islock %s\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s: input %s is conflicting with islock %s\n", __func__, tx.GetHash().ToString(), in.prevout.ToStringShort(), otherTxHash.ToString()); return false; } @@ -445,21 +445,21 @@ bool CInstaPACManager::ProcessTx(const CTransaction& tx, const Consensus::Params auto& id = ids[i]; inputRequestIds.emplace(id); if (quorumSigningManager->AsyncSignIfMember(llmqType, id, tx.GetHash())) { - LogPrintf("CInstaPACManager::%s -- txid=%s: voted on input %s with id %s\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s: voted on input %s with id %s\n", __func__, tx.GetHash().ToString(), in.prevout.ToStringShort(), id.ToString()); } } // We might have received all input locks before we got the corresponding TX. In this case, we have to sign the // islock now instead of waiting for the input locks. - TrySignInstaPACLock(tx); + TrySignInstantSendLock(tx); return true; } -bool CInstaPACManager::CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params) +bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params) { - if (sporkManager.IsSporkActive(SPORK_16_INSTANTSEND_AUTOLOCKS) && (mempool.UsedMemoryShare() > CInstaPAC::AUTO_IX_MEMPOOL_THRESHOLD)) { + if (sporkManager.IsSporkActive(SPORK_16_INSTANTSEND_AUTOLOCKS) && (mempool.UsedMemoryShare() > CInstantSend::AUTO_IX_MEMPOOL_THRESHOLD)) { return false; } @@ -484,7 +484,7 @@ bool CInstaPACManager::CheckCanLock(const CTransaction& tx, bool printDebug, con // CAmount maxValueIn = sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE); // if (nValueIn > maxValueIn * COIN) { // if (printDebug) { -// LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s: TX input value too high. nValueIn=%f, maxValueIn=%d", __func__, +// LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s: TX input value too high. nValueIn=%f, maxValueIn=%d", __func__, // tx.GetHash().ToString(), nValueIn / (double)COIN, maxValueIn); // } // return false; @@ -493,9 +493,9 @@ bool CInstaPACManager::CheckCanLock(const CTransaction& tx, bool printDebug, con return true; } -bool CInstaPACManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params) +bool CInstantSendManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params) { - int nInstaPACConfirmationsRequired = params.nInstaPACConfirmationsRequired; + int nInstantSendConfirmationsRequired = params.nInstantSendConfirmationsRequired; if (IsLocked(outpoint.hash)) { // if prevout was ix locked, allow locking of descendants (no matter if prevout is in mempool or already mined) @@ -505,7 +505,7 @@ bool CInstaPACManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, auto mempoolTx = mempool.get(outpoint.hash); if (mempoolTx) { if (printDebug) { - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s: parent mempool TX %s is not locked\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s: parent mempool TX %s is not locked\n", __func__, txHash.ToString(), outpoint.hash.ToString()); } return false; @@ -516,7 +516,7 @@ bool CInstaPACManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, // this relies on enabled txindex and won't work if we ever try to remove the requirement for txindex for masternodes if (!GetTransaction(outpoint.hash, tx, params, hashBlock, false)) { if (printDebug) { - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s: failed to find parent TX %s\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s: failed to find parent TX %s\n", __func__, txHash.ToString(), outpoint.hash.ToString()); } return false; @@ -530,11 +530,11 @@ bool CInstaPACManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, nTxAge = chainActive.Height() - pindexMined->nHeight + 1; } - if (nTxAge < nInstaPACConfirmationsRequired) { + if (nTxAge < nInstantSendConfirmationsRequired) { if (!llmq::chainLocksHandler->HasChainLock(pindexMined->nHeight, pindexMined->GetBlockHash())) { if (printDebug) { - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s: outpoint %s too new and not ChainLocked. nTxAge=%d, nInstaPACConfirmationsRequired=%d\n", __func__, - txHash.ToString(), outpoint.ToStringShort(), nTxAge, nInstaPACConfirmationsRequired); + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s: outpoint %s too new and not ChainLocked. nTxAge=%d, nInstantSendConfirmationsRequired=%d\n", __func__, + txHash.ToString(), outpoint.ToStringShort(), nTxAge, nInstantSendConfirmationsRequired); } return false; } @@ -547,9 +547,9 @@ bool CInstaPACManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, return true; } -void CInstaPACManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) +void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return; } @@ -560,24 +560,24 @@ void CInstaPACManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) auto& params = Params().GetConsensus().llmqs.at(llmqType); uint256 txid; - bool isInstaPACLock = false; + bool isInstantSendLock = false; { LOCK(cs); if (inputRequestIds.count(recoveredSig.id)) { txid = recoveredSig.msgHash; } - if (creatingInstaPACLocks.count(recoveredSig.id)) { - isInstaPACLock = true; + if (creatingInstantSendLocks.count(recoveredSig.id)) { + isInstantSendLock = true; } } if (!txid.IsNull()) { HandleNewInputLockRecoveredSig(recoveredSig, txid); - } else if (isInstaPACLock) { - HandleNewInstaPACLockRecoveredSig(recoveredSig); + } else if (isInstantSendLock) { + HandleNewInstantSendLockRecoveredSig(recoveredSig); } } -void CInstaPACManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid) +void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid) { auto llmqType = Params().GetConsensus().llmqForInstaPAC; @@ -591,17 +591,17 @@ void CInstaPACManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recov for (auto& in : tx->vin) { auto id = ::SerializeHash(std::make_pair(INPUTLOCK_REQUESTID_PREFIX, in.prevout)); if (id == recoveredSig.id) { - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s: got recovered sig for input %s\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s: got recovered sig for input %s\n", __func__, txid.ToString(), in.prevout.ToStringShort()); break; } } } - TrySignInstaPACLock(*tx); + TrySignInstantSendLock(*tx); } -void CInstaPACManager::TrySignInstaPACLock(const CTransaction& tx) +void CInstantSendManager::TrySignInstantSendLock(const CTransaction& tx) { auto llmqType = Params().GetConsensus().llmqForInstaPAC; @@ -612,10 +612,10 @@ void CInstaPACManager::TrySignInstaPACLock(const CTransaction& tx) } } - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s: got all recovered sigs, creating CInstaPACLock\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s: got all recovered sigs, creating CInstantSendLock\n", __func__, tx.GetHash().ToString()); - CInstaPACLock islock; + CInstantSendLock islock; islock.txid = tx.GetHash(); for (auto& in : tx.vin) { islock.inputs.emplace_back(in.prevout); @@ -629,59 +629,59 @@ void CInstaPACManager::TrySignInstaPACLock(const CTransaction& tx) { LOCK(cs); - auto e = creatingInstaPACLocks.emplace(id, std::move(islock)); + auto e = creatingInstantSendLocks.emplace(id, std::move(islock)); if (!e.second) { return; } - txToCreatingInstaPACLocks.emplace(tx.GetHash(), &e.first->second); + txToCreatingInstantSendLocks.emplace(tx.GetHash(), &e.first->second); } quorumSigningManager->AsyncSignIfMember(llmqType, id, tx.GetHash()); } -void CInstaPACManager::HandleNewInstaPACLockRecoveredSig(const llmq::CRecoveredSig& recoveredSig) +void CInstantSendManager::HandleNewInstantSendLockRecoveredSig(const llmq::CRecoveredSig& recoveredSig) { - CInstaPACLock islock; + CInstantSendLock islock; { LOCK(cs); - auto it = creatingInstaPACLocks.find(recoveredSig.id); - if (it == creatingInstaPACLocks.end()) { + auto it = creatingInstantSendLocks.find(recoveredSig.id); + if (it == creatingInstantSendLocks.end()) { return; } islock = std::move(it->second); - creatingInstaPACLocks.erase(it); - txToCreatingInstaPACLocks.erase(islock.txid); + creatingInstantSendLocks.erase(it); + txToCreatingInstantSendLocks.erase(islock.txid); } if (islock.txid != recoveredSig.msgHash) { - LogPrintf("CInstaPACManager::%s -- txid=%s: islock conflicts with %s, dropping own version", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s: islock conflicts with %s, dropping own version", __func__, islock.txid.ToString(), recoveredSig.msgHash.ToString()); return; } islock.sig = recoveredSig.sig; - ProcessInstaPACLock(-1, ::SerializeHash(islock), islock); + ProcessInstantSendLock(-1, ::SerializeHash(islock), islock); } -void CInstaPACManager::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) +void CInstantSendManager::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return; } if (strCommand == NetMsgType::ISLOCK) { - CInstaPACLock islock; + CInstantSendLock islock; vRecv >> islock; - ProcessMessageInstaPACLock(pfrom, islock, connman); + ProcessMessageInstantSendLock(pfrom, islock, connman); } } -void CInstaPACManager::ProcessMessageInstaPACLock(CNode* pfrom, const llmq::CInstaPACLock& islock, CConnman& connman) +void CInstantSendManager::ProcessMessageInstantSendLock(CNode* pfrom, const llmq::CInstantSendLock& islock, CConnman& connman) { bool ban = false; - if (!PreVerifyInstaPACLock(pfrom->id, islock, ban)) { + if (!PreVerifyInstantSendLock(pfrom->id, islock, ban)) { if (ban) { LOCK(cs_main); Misbehaving(pfrom->id, 100); @@ -692,20 +692,20 @@ void CInstaPACManager::ProcessMessageInstaPACLock(CNode* pfrom, const llmq::CIns auto hash = ::SerializeHash(islock); LOCK(cs); - if (db.GetInstaPACLockByHash(hash) != nullptr) { + if (db.GetInstantSendLockByHash(hash) != nullptr) { return; } - if (pendingInstaPACLocks.count(hash)) { + if (pendingInstantSendLocks.count(hash)) { return; } - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s, islock=%s: received islock, peer=%d\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s, islock=%s: received islock, peer=%d\n", __func__, islock.txid.ToString(), hash.ToString(), pfrom->id); - pendingInstaPACLocks.emplace(hash, std::make_pair(pfrom->id, std::move(islock))); + pendingInstantSendLocks.emplace(hash, std::make_pair(pfrom->id, std::move(islock))); } -bool CInstaPACManager::PreVerifyInstaPACLock(NodeId nodeId, const llmq::CInstaPACLock& islock, bool& retBan) +bool CInstantSendManager::PreVerifyInstantSendLock(NodeId nodeId, const llmq::CInstantSendLock& islock, bool& retBan) { retBan = false; @@ -725,20 +725,20 @@ bool CInstaPACManager::PreVerifyInstaPACLock(NodeId nodeId, const llmq::CInstaPA return true; } -bool CInstaPACManager::ProcessPendingInstaPACLocks() +bool CInstantSendManager::ProcessPendingInstantSendLocks() { - decltype(pendingInstaPACLocks) pend; + decltype(pendingInstantSendLocks) pend; { LOCK(cs); - pend = std::move(pendingInstaPACLocks); + pend = std::move(pendingInstantSendLocks); } if (pend.empty()) { return false; } - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return false; } @@ -760,9 +760,9 @@ bool CInstaPACManager::ProcessPendingInstaPACLocks() if (quorumsRotated) { // first check against the current active set and don't ban - auto badISLocks = ProcessPendingInstaPACLocks(tipHeight, pend, false); + auto badISLocks = ProcessPendingInstantSendLocks(tipHeight, pend, false); if (!badISLocks.empty()) { - LogPrintf("CInstaPACManager::%s -- detected LLMQ active set rotation, redoing verification on old active set\n", __func__); + LogPrintf("CInstantSendManager::%s -- detected LLMQ active set rotation, redoing verification on old active set\n", __func__); // filter out valid IS locks from "pend" for (auto it = pend.begin(); it != pend.end(); ) { @@ -773,16 +773,16 @@ bool CInstaPACManager::ProcessPendingInstaPACLocks() } } // now check against the previous active set and perform banning if this fails - ProcessPendingInstaPACLocks(tipHeight - 1, pend, true); + ProcessPendingInstantSendLocks(tipHeight - 1, pend, true); } } else { - ProcessPendingInstaPACLocks(tipHeight, pend, true); + ProcessPendingInstantSendLocks(tipHeight, pend, true); } return true; } -std::unordered_set CInstaPACManager::ProcessPendingInstaPACLocks(int signHeight, const std::unordered_map>& pend, bool ban) +std::unordered_set CInstantSendManager::ProcessPendingInstantSendLocks(int signHeight, const std::unordered_map>& pend, bool ban) { auto llmqType = Params().GetConsensus().llmqForInstaPAC; @@ -852,13 +852,13 @@ std::unordered_set CInstaPACManager::ProcessPendingInstaPACLocks(int si auto& islock = p.second.second; if (batchVerifier.badMessages.count(hash)) { - LogPrintf("CInstaPACManager::%s -- txid=%s, islock=%s: invalid sig in islock, peer=%d\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s, islock=%s: invalid sig in islock, peer=%d\n", __func__, islock.txid.ToString(), hash.ToString(), nodeId); badISLocks.emplace(hash); continue; } - ProcessInstaPACLock(nodeId, hash, islock); + ProcessInstantSendLock(nodeId, hash, islock); // See comment further on top. We pass a reconstructed recovered sig to the signing manager to avoid // double-verification of the sig. @@ -868,7 +868,7 @@ std::unordered_set CInstaPACManager::ProcessPendingInstaPACLocks(int si auto& recSig = it->second.second; if (!quorumSigningManager->HasRecoveredSigForId(llmqType, recSig.id)) { recSig.UpdateHash(); - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s, islock=%s: passing reconstructed recSig to signing mgr, peer=%d\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s, islock=%s: passing reconstructed recSig to signing mgr, peer=%d\n", __func__, islock.txid.ToString(), hash.ToString(), nodeId); quorumSigningManager->PushReconstructedRecoveredSig(recSig, quorum); } @@ -878,7 +878,7 @@ std::unordered_set CInstaPACManager::ProcessPendingInstaPACLocks(int si return badISLocks; } -void CInstaPACManager::ProcessInstaPACLock(NodeId from, const uint256& hash, const CInstaPACLock& islock) +void CInstantSendManager::ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLock& islock) { { LOCK(cs_main); @@ -899,7 +899,7 @@ void CInstaPACManager::ProcessInstaPACLock(NodeId from, const uint256& hash, con // Let's see if the TX that was locked by this islock is already mined in a ChainLocked block. If yes, // we can simply ignore the islock, as the ChainLock implies locking of all TXs in that chain if (llmq::chainLocksHandler->HasChainLock(pindexMined->nHeight, pindexMined->GetBlockHash())) { - LogPrint("instantsend", "CInstaPACManager::%s -- txlock=%s, islock=%s: dropping islock as it already got a ChainLock in block %s, peer=%d\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txlock=%s, islock=%s: dropping islock as it already got a ChainLock in block %s, peer=%d\n", __func__, islock.txid.ToString(), hash.ToString(), hashBlock.ToString(), from); return; } @@ -909,32 +909,32 @@ void CInstaPACManager::ProcessInstaPACLock(NodeId from, const uint256& hash, con { LOCK(cs); - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s, islock=%s: processsing islock, peer=%d\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s, islock=%s: processsing islock, peer=%d\n", __func__, islock.txid.ToString(), hash.ToString(), from); - creatingInstaPACLocks.erase(islock.GetRequestId()); - txToCreatingInstaPACLocks.erase(islock.txid); + creatingInstantSendLocks.erase(islock.GetRequestId()); + txToCreatingInstantSendLocks.erase(islock.txid); - CInstaPACLockPtr otherIsLock; - if (db.GetInstaPACLockByHash(hash)) { + CInstantSendLockPtr otherIsLock; + if (db.GetInstantSendLockByHash(hash)) { return; } - otherIsLock = db.GetInstaPACLockByTxid(islock.txid); + otherIsLock = db.GetInstantSendLockByTxid(islock.txid); if (otherIsLock != nullptr) { - LogPrintf("CInstaPACManager::%s -- txid=%s, islock=%s: duplicate islock, other islock=%s, peer=%d\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s, islock=%s: duplicate islock, other islock=%s, peer=%d\n", __func__, islock.txid.ToString(), hash.ToString(), ::SerializeHash(*otherIsLock).ToString(), from); } for (auto& in : islock.inputs) { - otherIsLock = db.GetInstaPACLockByInput(in); + otherIsLock = db.GetInstantSendLockByInput(in); if (otherIsLock != nullptr) { - LogPrintf("CInstaPACManager::%s -- txid=%s, islock=%s: conflicting input in islock. input=%s, other islock=%s, peer=%d\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s, islock=%s: conflicting input in islock. input=%s, other islock=%s, peer=%d\n", __func__, islock.txid.ToString(), hash.ToString(), in.ToStringShort(), ::SerializeHash(*otherIsLock).ToString(), from); } } - db.WriteNewInstaPACLock(hash, islock); + db.WriteNewInstantSendLock(hash, islock); if (pindexMined) { - db.WriteInstaPACLockMined(hash, pindexMined->nHeight); + db.WriteInstantSendLockMined(hash, pindexMined->nHeight); } // This will also add children TXs to pendingRetryTxs @@ -955,7 +955,7 @@ void CInstaPACManager::ProcessInstaPACLock(NodeId from, const uint256& hash, con UpdateWalletTransaction(islock.txid, tx); } -void CInstaPACManager::UpdateWalletTransaction(const uint256& txid, const CTransactionRef& tx) +void CInstantSendManager::UpdateWalletTransaction(const uint256& txid, const CTransactionRef& tx) { #ifdef ENABLE_WALLET if (!pwalletMain) { @@ -979,9 +979,9 @@ void CInstaPACManager::UpdateWalletTransaction(const uint256& txid, const CTrans } } -void CInstaPACManager::SyncTransaction(const CTransaction& tx, const CBlockIndex* pindex, int posInBlock) +void CInstantSendManager::SyncTransaction(const CTransaction& tx, const CBlockIndex* pindex, int posInBlock) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return; } @@ -1007,15 +1007,15 @@ void CInstaPACManager::SyncTransaction(const CTransaction& tx, const CBlockIndex uint256 islockHash; { LOCK(cs); - islockHash = db.GetInstaPACLockHashByTxid(tx.GetHash()); + islockHash = db.GetInstantSendLockHashByTxid(tx.GetHash()); // update DB about when an IS lock was mined if (!islockHash.IsNull() && pindex) { if (isDisconnect) { // SyncTransaction is called with pprev - db.RemoveInstaPACLockMined(islockHash, pindex->nHeight + 1); + db.RemoveInstantSendLockMined(islockHash, pindex->nHeight + 1); } else { - db.WriteInstaPACLockMined(islockHash, pindex->nHeight); + db.WriteInstantSendLockMined(islockHash, pindex->nHeight); } } } @@ -1040,7 +1040,7 @@ void CInstaPACManager::SyncTransaction(const CTransaction& tx, const CBlockIndex } } -void CInstaPACManager::AddNonLockedTx(const CTransactionRef& tx) +void CInstantSendManager::AddNonLockedTx(const CTransactionRef& tx) { AssertLockHeld(cs); auto res = nonLockedTxs.emplace(tx->GetHash(), NonLockedTxInfo()); @@ -1060,7 +1060,7 @@ void CInstaPACManager::AddNonLockedTx(const CTransactionRef& tx) } } -void CInstaPACManager::RemoveNonLockedTx(const uint256& txid, bool retryChildren) +void CInstantSendManager::RemoveNonLockedTx(const uint256& txid, bool retryChildren) { AssertLockHeld(cs); @@ -1102,7 +1102,7 @@ void CInstaPACManager::RemoveNonLockedTx(const uint256& txid, bool retryChildren nonLockedTxs.erase(it); } -void CInstaPACManager::RemoveConflictedTx(const CTransaction& tx) +void CInstantSendManager::RemoveConflictedTx(const CTransaction& tx) { AssertLockHeld(cs); RemoveNonLockedTx(tx.GetHash(), false); @@ -1113,12 +1113,12 @@ void CInstaPACManager::RemoveConflictedTx(const CTransaction& tx) } } -void CInstaPACManager::NotifyChainLock(const CBlockIndex* pindexChainLock) +void CInstantSendManager::NotifyChainLock(const CBlockIndex* pindexChainLock) { HandleFullyConfirmedBlock(pindexChainLock); } -void CInstaPACManager::UpdatedBlockTip(const CBlockIndex* pindexNew) +void CInstantSendManager::UpdatedBlockTip(const CBlockIndex* pindexNew) { // TODO remove this after DIP8 has activated bool fDIP0008Active = VersionBitsState(pindexNew->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0008, versionbitscache) == THRESHOLD_ACTIVE; @@ -1128,7 +1128,7 @@ void CInstaPACManager::UpdatedBlockTip(const CBlockIndex* pindexNew) return; } - int nConfirmedHeight = pindexNew->nHeight - Params().GetConsensus().nInstaPACKeepLock; + int nConfirmedHeight = pindexNew->nHeight - Params().GetConsensus().nInstantSendKeepLock; const CBlockIndex* pindex = pindexNew->GetAncestor(nConfirmedHeight); if (pindex) { @@ -1136,22 +1136,22 @@ void CInstaPACManager::UpdatedBlockTip(const CBlockIndex* pindexNew) } } -void CInstaPACManager::HandleFullyConfirmedBlock(const CBlockIndex* pindex) +void CInstantSendManager::HandleFullyConfirmedBlock(const CBlockIndex* pindex) { auto& consensusParams = Params().GetConsensus(); - std::unordered_map removeISLocks; + std::unordered_map removeISLocks; { LOCK(cs); - removeISLocks = db.RemoveConfirmedInstaPACLocks(pindex->nHeight); + removeISLocks = db.RemoveConfirmedInstantSendLocks(pindex->nHeight); if (pindex->nHeight > 100) { - db.RemoveArchivedInstaPACLocks(pindex->nHeight - 100); + db.RemoveArchivedInstantSendLocks(pindex->nHeight - 100); } for (auto& p : removeISLocks) { auto& islockHash = p.first; auto& islock = p.second; - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s, islock=%s: removed islock as it got fully confirmed\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s, islock=%s: removed islock as it got fully confirmed\n", __func__, islock->txid.ToString(), islockHash.ToString()); for (auto& in : islock->inputs) { @@ -1184,7 +1184,7 @@ void CInstaPACManager::HandleFullyConfirmedBlock(const CBlockIndex* pindex) } } -void CInstaPACManager::RemoveMempoolConflictsForLock(const uint256& hash, const CInstaPACLock& islock) +void CInstantSendManager::RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock) { std::unordered_map toDelete; @@ -1199,7 +1199,7 @@ void CInstaPACManager::RemoveMempoolConflictsForLock(const uint256& hash, const if (it->second->GetHash() != islock.txid) { toDelete.emplace(it->second->GetHash(), mempool.get(it->second->GetHash())); - LogPrintf("CInstaPACManager::%s -- txid=%s, islock=%s: mempool TX %s with input %s conflicts with islock\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s, islock=%s: mempool TX %s with input %s conflicts with islock\n", __func__, islock.txid.ToString(), hash.ToString(), it->second->GetHash().ToString(), in.ToStringShort()); } } @@ -1220,7 +1220,7 @@ void CInstaPACManager::RemoveMempoolConflictsForLock(const uint256& hash, const } } -void CInstaPACManager::ResolveBlockConflicts(const uint256& islockHash, const llmq::CInstaPACLock& islock) +void CInstantSendManager::ResolveBlockConflicts(const uint256& islockHash, const llmq::CInstantSendLock& islock) { // Lets first collect all non-locked TXs which conflict with the given ISLOCK std::unordered_map> conflicts; @@ -1244,7 +1244,7 @@ void CInstaPACManager::ResolveBlockConflicts(const uint256& islockHash, const ll if (!info.pindexMined || !info.tx) { continue; } - LogPrintf("CInstaPACManager::%s -- txid=%s, islock=%s: mined TX %s with input %s and mined in block %s conflicts with islock\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s, islock=%s: mined TX %s with input %s and mined in block %s conflicts with islock\n", __func__, islock.txid.ToString(), islockHash.ToString(), conflictTxid.ToString(), in.ToStringShort(), info.pindexMined->GetBlockHash().ToString()); conflicts[info.pindexMined].emplace(conflictTxid, info.tx); } @@ -1281,14 +1281,14 @@ void CInstaPACManager::ResolveBlockConflicts(const uint256& islockHash, const ll } } - LogPrintf("CInstaPACManager::%s -- invalidating block %s\n", __func__, pindex->GetBlockHash().ToString()); + LogPrintf("CInstantSendManager::%s -- invalidating block %s\n", __func__, pindex->GetBlockHash().ToString()); LOCK(cs_main); CValidationState state; // need non-const pointer auto pindex2 = mapBlockIndex.at(pindex->GetBlockHash()); if (!InvalidateBlock(state, Params(), pindex2)) { - LogPrintf("CInstaPACManager::%s -- InvalidateBlock failed: %s\n", __func__, FormatStateMessage(state)); + LogPrintf("CInstantSendManager::%s -- InvalidateBlock failed: %s\n", __func__, FormatStateMessage(state)); // This should not have happened and we are in a state were it's not safe to continue anymore assert(false); } @@ -1305,9 +1305,9 @@ void CInstaPACManager::ResolveBlockConflicts(const uint256& islockHash, const ll } } -void CInstaPACManager::RemoveChainLockConflictingLock(const uint256& islockHash, const llmq::CInstaPACLock& islock) +void CInstantSendManager::RemoveChainLockConflictingLock(const uint256& islockHash, const llmq::CInstantSendLock& islock) { - LogPrintf("CInstaPACManager::%s -- txid=%s, islock=%s: at least one conflicted TX already got a ChainLock. Removing ISLOCK and its chained children.\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s, islock=%s: at least one conflicted TX already got a ChainLock. Removing ISLOCK and its chained children.\n", __func__, islock.txid.ToString(), islockHash.ToString()); int tipHeight; { @@ -1316,14 +1316,14 @@ void CInstaPACManager::RemoveChainLockConflictingLock(const uint256& islockHash, } LOCK(cs); - auto removedIslocks = db.RemoveChainedInstaPACLocks(islockHash, islock.txid, tipHeight); + auto removedIslocks = db.RemoveChainedInstantSendLocks(islockHash, islock.txid, tipHeight); for (auto& h : removedIslocks) { - LogPrintf("CInstaPACManager::%s -- txid=%s, islock=%s: removed (child) ISLOCK %s\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s, islock=%s: removed (child) ISLOCK %s\n", __func__, islock.txid.ToString(), islockHash.ToString(), h.ToString()); } } -void CInstaPACManager::AskNodesForLockedTx(const uint256& txid) +void CInstantSendManager::AskNodesForLockedTx(const uint256& txid) { std::vector nodesToAskFor; g_connman->ForEachNode([&](CNode* pnode) { @@ -1336,7 +1336,7 @@ void CInstaPACManager::AskNodesForLockedTx(const uint256& txid) { LOCK(cs_main); for (CNode* pnode : nodesToAskFor) { - LogPrintf("CInstaPACManager::%s -- txid=%s: asking other peer %d for correct TX\n", __func__, + LogPrintf("CInstantSendManager::%s -- txid=%s: asking other peer %d for correct TX\n", __func__, txid.ToString(), pnode->id); CInv inv(MSG_TX, txid); @@ -1348,7 +1348,7 @@ void CInstaPACManager::AskNodesForLockedTx(const uint256& txid) } } -bool CInstaPACManager::ProcessPendingRetryLockTxs() +bool CInstantSendManager::ProcessPendingRetryLockTxs() { decltype(pendingRetryTxs) retryTxs; { @@ -1360,7 +1360,7 @@ bool CInstaPACManager::ProcessPendingRetryLockTxs() return false; } - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return false; } @@ -1379,7 +1379,7 @@ bool CInstaPACManager::ProcessPendingRetryLockTxs() continue; } - if (txToCreatingInstaPACLocks.count(tx->GetHash())) { + if (txToCreatingInstantSendLocks.count(tx->GetHash())) { // we're already in the middle of locking this one continue; } @@ -1398,7 +1398,7 @@ bool CInstaPACManager::ProcessPendingRetryLockTxs() if (!CheckCanLock(*tx, false, Params().GetConsensus())) { continue; } - LogPrint("instantsend", "CInstaPACManager::%s -- txid=%s: retrying to lock\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- txid=%s: retrying to lock\n", __func__, tx->GetHash().ToString()); } @@ -1408,31 +1408,31 @@ bool CInstaPACManager::ProcessPendingRetryLockTxs() if (retryCount != 0) { LOCK(cs); - LogPrint("instantsend", "CInstaPACManager::%s -- retried %d TXs. nonLockedTxs.size=%d\n", __func__, + LogPrint("instantsend", "CInstantSendManager::%s -- retried %d TXs. nonLockedTxs.size=%d\n", __func__, retryCount, nonLockedTxs.size()); } return retryCount != 0; } -bool CInstaPACManager::AlreadyHave(const CInv& inv) +bool CInstantSendManager::AlreadyHave(const CInv& inv) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return true; } LOCK(cs); - return db.GetInstaPACLockByHash(inv.hash) != nullptr || pendingInstaPACLocks.count(inv.hash) != 0 || db.HasArchivedInstaPACLock(inv.hash); + return db.GetInstantSendLockByHash(inv.hash) != nullptr || pendingInstantSendLocks.count(inv.hash) != 0 || db.HasArchivedInstantSendLock(inv.hash); } -bool CInstaPACManager::GetInstaPACLockByHash(const uint256& hash, llmq::CInstaPACLock& ret) +bool CInstantSendManager::GetInstantSendLockByHash(const uint256& hash, llmq::CInstantSendLock& ret) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return false; } LOCK(cs); - auto islock = db.GetInstaPACLockByHash(hash); + auto islock = db.GetInstantSendLockByHash(hash); if (!islock) { return false; } @@ -1440,30 +1440,30 @@ bool CInstaPACManager::GetInstaPACLockByHash(const uint256& hash, llmq::CInstaPA return true; } -bool CInstaPACManager::IsLocked(const uint256& txHash) +bool CInstantSendManager::IsLocked(const uint256& txHash) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return false; } LOCK(cs); - return db.GetInstaPACLockByTxid(txHash) != nullptr; + return db.GetInstantSendLockByTxid(txHash) != nullptr; } -bool CInstaPACManager::IsConflicted(const CTransaction& tx) +bool CInstantSendManager::IsConflicted(const CTransaction& tx) { return GetConflictingLock(tx) != nullptr; } -CInstaPACLockPtr CInstaPACManager::GetConflictingLock(const CTransaction& tx) +CInstantSendLockPtr CInstantSendManager::GetConflictingLock(const CTransaction& tx) { - if (!IsNewInstaPACEnabled()) { + if (!IsNewInstantSendEnabled()) { return nullptr; } LOCK(cs); for (const auto& in : tx.vin) { - auto otherIsLock = db.GetInstaPACLockByInput(in.prevout); + auto otherIsLock = db.GetInstantSendLockByInput(in.prevout); if (!otherIsLock) { continue; } @@ -1475,17 +1475,17 @@ CInstaPACLockPtr CInstaPACManager::GetConflictingLock(const CTransaction& tx) return nullptr; } -size_t CInstaPACManager::GetInstaPACLockCount() +size_t CInstantSendManager::GetInstantSendLockCount() { - return db.GetInstaPACLockCount(); + return db.GetInstantSendLockCount(); } -void CInstaPACManager::WorkThreadMain() +void CInstantSendManager::WorkThreadMain() { while (!workInterrupt) { bool didWork = false; - didWork |= ProcessPendingInstaPACLocks(); + didWork |= ProcessPendingInstantSendLocks(); didWork |= ProcessPendingRetryLockTxs(); if (!didWork) { @@ -1496,17 +1496,17 @@ void CInstaPACManager::WorkThreadMain() } } -bool IsOldInstaPACEnabled() +bool IsOldInstantSendEnabled() { return sporkManager.IsSporkActive(SPORK_2_INSTANTSEND_ENABLED) && !sporkManager.IsSporkActive(SPORK_20_INSTANTSEND_LLMQ_BASED); } -bool IsNewInstaPACEnabled() +bool IsNewInstantSendEnabled() { return sporkManager.IsSporkActive(SPORK_2_INSTANTSEND_ENABLED) && sporkManager.IsSporkActive(SPORK_20_INSTANTSEND_LLMQ_BASED); } -bool IsInstaPACEnabled() +bool IsInstantSendEnabled() { return sporkManager.IsSporkActive(SPORK_2_INSTANTSEND_ENABLED); } diff --git a/src/llmq/quorums_instantsend.h b/src/llmq/quorums_instantsend.h index 573a95f5706e7..e3100c090aeb5 100644 --- a/src/llmq/quorums_instantsend.h +++ b/src/llmq/quorums_instantsend.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_INSTANTSEND_H -#define PAC_QUORUMS_INSTANTSEND_H +#ifndef DASH_QUORUMS_INSTANTSEND_H +#define DASH_QUORUMS_INSTANTSEND_H #include "quorums_signing.h" @@ -17,7 +17,7 @@ namespace llmq { -class CInstaPACLock +class CInstantSendLock { public: std::vector inputs; @@ -38,45 +38,45 @@ class CInstaPACLock uint256 GetRequestId() const; }; -typedef std::shared_ptr CInstaPACLockPtr; +typedef std::shared_ptr CInstantSendLockPtr; -class CInstaPACDb +class CInstantSendDb { private: CDBWrapper& db; - unordered_lru_cache islockCache; + unordered_lru_cache islockCache; unordered_lru_cache txidCache; unordered_lru_cache outpointCache; public: - CInstaPACDb(CDBWrapper& _db) : db(_db) {} - - void WriteNewInstaPACLock(const uint256& hash, const CInstaPACLock& islock); - void RemoveInstaPACLock(CDBBatch& batch, const uint256& hash, CInstaPACLockPtr islock); - - void WriteInstaPACLockMined(const uint256& hash, int nHeight); - void RemoveInstaPACLockMined(const uint256& hash, int nHeight); - void WriteInstaPACLockArchived(CDBBatch& batch, const uint256& hash, int nHeight); - std::unordered_map RemoveConfirmedInstaPACLocks(int nUntilHeight); - void RemoveArchivedInstaPACLocks(int nUntilHeight); - bool HasArchivedInstaPACLock(const uint256& islockHash); - size_t GetInstaPACLockCount(); - - CInstaPACLockPtr GetInstaPACLockByHash(const uint256& hash); - uint256 GetInstaPACLockHashByTxid(const uint256& txid); - CInstaPACLockPtr GetInstaPACLockByTxid(const uint256& txid); - CInstaPACLockPtr GetInstaPACLockByInput(const COutPoint& outpoint); - - std::vector GetInstaPACLocksByParent(const uint256& parent); - std::vector RemoveChainedInstaPACLocks(const uint256& islockHash, const uint256& txid, int nHeight); + CInstantSendDb(CDBWrapper& _db) : db(_db) {} + + void WriteNewInstantSendLock(const uint256& hash, const CInstantSendLock& islock); + void RemoveInstantSendLock(CDBBatch& batch, const uint256& hash, CInstantSendLockPtr islock); + + void WriteInstantSendLockMined(const uint256& hash, int nHeight); + void RemoveInstantSendLockMined(const uint256& hash, int nHeight); + void WriteInstantSendLockArchived(CDBBatch& batch, const uint256& hash, int nHeight); + std::unordered_map RemoveConfirmedInstantSendLocks(int nUntilHeight); + void RemoveArchivedInstantSendLocks(int nUntilHeight); + bool HasArchivedInstantSendLock(const uint256& islockHash); + size_t GetInstantSendLockCount(); + + CInstantSendLockPtr GetInstantSendLockByHash(const uint256& hash); + uint256 GetInstantSendLockHashByTxid(const uint256& txid); + CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid); + CInstantSendLockPtr GetInstantSendLockByInput(const COutPoint& outpoint); + + std::vector GetInstantSendLocksByParent(const uint256& parent); + std::vector RemoveChainedInstantSendLocks(const uint256& islockHash, const uint256& txid, int nHeight); }; -class CInstaPACManager : public CRecoveredSigsListener +class CInstantSendManager : public CRecoveredSigsListener { private: CCriticalSection cs; - CInstaPACDb db; + CInstantSendDb db; std::thread workThread; CThreadInterrupt workInterrupt; @@ -92,12 +92,12 @@ class CInstaPACManager : public CRecoveredSigsListener * recovered signatures for all inputs of a TX. At the same time, we initiate signing of our sigshare for the islock. * When the recovered sig for the islock later arrives, we can finish the islock and propagate it. */ - std::unordered_map creatingInstaPACLocks; + std::unordered_map creatingInstantSendLocks; // maps from txid to the in-progress islock - std::unordered_map txToCreatingInstaPACLocks; + std::unordered_map txToCreatingInstantSendLocks; // Incoming and not verified yet - std::unordered_map> pendingInstaPACLocks; + std::unordered_map> pendingInstantSendLocks; // TXs which are neither IS locked nor ChainLocked. We use this to determine for which TXs we need to retry IS locking // of child TXs @@ -112,8 +112,8 @@ class CInstaPACManager : public CRecoveredSigsListener std::unordered_set pendingRetryTxs; public: - CInstaPACManager(CDBWrapper& _llmqDb); - ~CInstaPACManager(); + CInstantSendManager(CDBWrapper& _llmqDb); + ~CInstantSendManager(); void Start(); void Stop(); @@ -125,20 +125,20 @@ class CInstaPACManager : public CRecoveredSigsListener bool CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params); bool IsLocked(const uint256& txHash); bool IsConflicted(const CTransaction& tx); - CInstaPACLockPtr GetConflictingLock(const CTransaction& tx); + CInstantSendLockPtr GetConflictingLock(const CTransaction& tx); virtual void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig); void HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid); - void HandleNewInstaPACLockRecoveredSig(const CRecoveredSig& recoveredSig); + void HandleNewInstantSendLockRecoveredSig(const CRecoveredSig& recoveredSig); - void TrySignInstaPACLock(const CTransaction& tx); + void TrySignInstantSendLock(const CTransaction& tx); void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman); - void ProcessMessageInstaPACLock(CNode* pfrom, const CInstaPACLock& islock, CConnman& connman); - bool PreVerifyInstaPACLock(NodeId nodeId, const CInstaPACLock& islock, bool& retBan); - bool ProcessPendingInstaPACLocks(); - std::unordered_set ProcessPendingInstaPACLocks(int signHeight, const std::unordered_map>& pend, bool ban); - void ProcessInstaPACLock(NodeId from, const uint256& hash, const CInstaPACLock& islock); + void ProcessMessageInstantSendLock(CNode* pfrom, const CInstantSendLock& islock, CConnman& connman); + bool PreVerifyInstantSendLock(NodeId nodeId, const CInstantSendLock& islock, bool& retBan); + bool ProcessPendingInstantSendLocks(); + std::unordered_set ProcessPendingInstantSendLocks(int signHeight, const std::unordered_map>& pend, bool ban); + void ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLock& islock); void UpdateWalletTransaction(const uint256& txid, const CTransactionRef& tx); void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock); @@ -151,30 +151,30 @@ class CInstaPACManager : public CRecoveredSigsListener void HandleFullyConfirmedBlock(const CBlockIndex* pindex); - void RemoveMempoolConflictsForLock(const uint256& hash, const CInstaPACLock& islock); - void ResolveBlockConflicts(const uint256& islockHash, const CInstaPACLock& islock); - void RemoveChainLockConflictingLock(const uint256& islockHash, const CInstaPACLock& islock); + void RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock); + void ResolveBlockConflicts(const uint256& islockHash, const CInstantSendLock& islock); + void RemoveChainLockConflictingLock(const uint256& islockHash, const CInstantSendLock& islock); void AskNodesForLockedTx(const uint256& txid); bool ProcessPendingRetryLockTxs(); bool AlreadyHave(const CInv& inv); - bool GetInstaPACLockByHash(const uint256& hash, CInstaPACLock& ret); + bool GetInstantSendLockByHash(const uint256& hash, CInstantSendLock& ret); - size_t GetInstaPACLockCount(); + size_t GetInstantSendLockCount(); void WorkThreadMain(); }; -extern CInstaPACManager* quorumInstaPACManager; +extern CInstantSendManager* quorumInstantSendManager; // This involves 2 sporks: SPORK_2_INSTANTSEND_ENABLED and SPORK_20_INSTANTSEND_LLMQ_BASED // SPORK_2_INSTANTSEND_ENABLED generally enables/disables InstaPAC and SPORK_20_INSTANTSEND_LLMQ_BASED switches // between the old and the new (LLMQ based) system // TODO When the new system is fully deployed and enabled, we can remove this special handling in a future version // and revert to only using SPORK_2_INSTANTSEND_ENABLED. -bool IsOldInstaPACEnabled(); -bool IsNewInstaPACEnabled(); -bool IsInstaPACEnabled(); +bool IsOldInstantSendEnabled(); +bool IsNewInstantSendEnabled(); +bool IsInstantSendEnabled(); } diff --git a/src/llmq/quorums_signing.h b/src/llmq/quorums_signing.h index cc359586c31de..a487f35e1d148 100644 --- a/src/llmq/quorums_signing.h +++ b/src/llmq/quorums_signing.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_SIGNING_H -#define PAC_QUORUMS_SIGNING_H +#ifndef DASH_QUORUMS_SIGNING_H +#define DASH_QUORUMS_SIGNING_H #include "llmq/quorums.h" diff --git a/src/llmq/quorums_signing_shares.h b/src/llmq/quorums_signing_shares.h index 72afc91d8db53..3cf376722ba57 100644 --- a/src/llmq/quorums_signing_shares.h +++ b/src/llmq/quorums_signing_shares.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_SIGNING_SHARES_H -#define PAC_QUORUMS_SIGNING_SHARES_H +#ifndef DASH_QUORUMS_SIGNING_SHARES_H +#define DASH_QUORUMS_SIGNING_SHARES_H #include "bls/bls.h" #include "chainparams.h" diff --git a/src/llmq/quorums_utils.h b/src/llmq/quorums_utils.h index 6653898209393..62ba1cf5d939a 100644 --- a/src/llmq/quorums_utils.h +++ b/src/llmq/quorums_utils.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_QUORUMS_UTILS_H -#define PAC_QUORUMS_UTILS_H +#ifndef DASH_QUORUMS_UTILS_H +#define DASH_QUORUMS_UTILS_H #include "consensus/params.h" #include "net.h" diff --git a/src/net.cpp b/src/net.cpp index 5405daf46e44f..d68d3d0517c91 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2888,7 +2888,7 @@ void CConnman::RelayTransaction(const CTransaction& tx) int nInv = MSG_TX; if (CPrivateSend::GetDSTX(hash)) { nInv = MSG_DSTX; - } else if (llmq::IsOldInstaPACEnabled() && instantsend.HasTxLockRequest(hash)) { + } else if (llmq::IsOldInstantSendEnabled() && instantsend.HasTxLockRequest(hash)) { nInv = MSG_TXLOCK_REQUEST; } CInv inv(nInv, hash); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ca9502bb523a9..05e4c22ba0316 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1024,7 +1024,7 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) case MSG_CLSIG: return llmq::chainLocksHandler->AlreadyHave(inv); case MSG_ISLOCK: - return llmq::quorumInstaPACManager->AlreadyHave(inv); + return llmq::quorumInstantSendManager->AlreadyHave(inv); } // Don't know what it is, just say we already got one return true; @@ -1357,8 +1357,8 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam } if (!push && (inv.type == MSG_ISLOCK)) { - llmq::CInstaPACLock o; - if (llmq::quorumInstaPACManager->GetInstaPACLockByHash(inv.hash, o)) { + llmq::CInstantSendLock o; + if (llmq::quorumInstantSendManager->GetInstantSendLockByHash(inv.hash, o)) { connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::ISLOCK, o)); push = true; } @@ -2133,12 +2133,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr if(strCommand == NetMsgType::TX) { vRecv >> ptx; txLockRequest = CTxLockRequest(ptx); - fCanAutoLock = llmq::IsOldInstaPACEnabled() && CInstaPAC::CanAutoLock() && txLockRequest.IsSimple(); + fCanAutoLock = llmq::IsOldInstantSendEnabled() && CInstantSend::CanAutoLock() && txLockRequest.IsSimple(); } else if(strCommand == NetMsgType::TXLOCKREQUEST) { vRecv >> txLockRequest; ptx = txLockRequest.tx; nInvType = MSG_TXLOCK_REQUEST; - if (llmq::IsNewInstaPACEnabled()) { + if (llmq::IsNewInstantSendEnabled()) { // the new system does not require explicit lock requests // changing the inv type to MSG_TX also results in re-broadcasting the TX as normal TX nInvType = MSG_TX; @@ -3105,7 +3105,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr llmq::quorumSigSharesManager->ProcessMessage(pfrom, strCommand, vRecv, connman); llmq::quorumSigningManager->ProcessMessage(pfrom, strCommand, vRecv, connman); llmq::chainLocksHandler->ProcessMessage(pfrom, strCommand, vRecv, connman); - llmq::quorumInstaPACManager->ProcessMessage(pfrom, strCommand, vRecv, connman); + llmq::quorumInstantSendManager->ProcessMessage(pfrom, strCommand, vRecv, connman); } else { diff --git a/src/privatesend-server.cpp b/src/privatesend-server.cpp index 71625a1da389a..1a5f579463f95 100644 --- a/src/privatesend-server.cpp +++ b/src/privatesend-server.cpp @@ -221,7 +221,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm Coin coin; auto mempoolTx = mempool.get(txin.prevout.hash); if (mempoolTx != nullptr) { - if (mempool.isSpent(txin.prevout) || !llmq::quorumInstaPACManager->IsLocked(txin.prevout.hash)) { + if (mempool.isSpent(txin.prevout) || !llmq::quorumInstantSendManager->IsLocked(txin.prevout.hash)) { LogPrintf("DSVIN -- spent or non-locked mempool input! txin=%s\n", txin.ToString()); PushStatus(pfrom, STATUS_REJECTED, ERR_MISSING_TX, connman); return; diff --git a/src/privatesend.cpp b/src/privatesend.cpp index 95916395bfec7..5a081348d57a8 100644 --- a/src/privatesend.cpp +++ b/src/privatesend.cpp @@ -242,7 +242,7 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral) Coin coin; auto mempoolTx = mempool.get(txin.prevout.hash); if (mempoolTx != nullptr) { - if (mempool.isSpent(txin.prevout) || !llmq::quorumInstaPACManager->IsLocked(txin.prevout.hash)) { + if (mempool.isSpent(txin.prevout) || !llmq::quorumInstantSendManager->IsLocked(txin.prevout.hash)) { LogPrint("privatesend", "CPrivateSend::IsCollateralValid -- spent or non-locked mempool input! txin=%s\n", txin.ToString()); return false; } diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 49ea6cb6403d1..0e7bfcf23579b 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -165,10 +165,10 @@ size_t ClientModel::getMempoolDynamicUsage() const size_t ClientModel::getInstantSentLockCount() const { - if (!llmq::quorumInstaPACManager) { + if (!llmq::quorumInstantSendManager) { return 0; } - return llmq::quorumInstaPACManager->GetInstaPACLockCount(); + return llmq::quorumInstantSendManager->GetInstantSendLockCount(); } double ClientModel::getVerificationProgress(const CBlockIndex *tipIn) const diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index bd4318b90ed86..82c953316e0ee 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -541,7 +541,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) else nBytesInputs += 148; // Add inputs to calculate InstaPAC Fee later - if(coinControl->fUseInstaPAC) + if(coinControl->fUseInstantSend) txDummy.vin.push_back(CTxIn()); } @@ -561,8 +561,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) if (nPayFee > 0 && coinControl->nMinimumTotalFee > nPayFee) nPayFee = coinControl->nMinimumTotalFee; - // InstaPAC Fee - if (coinControl->fUseInstaPAC) nPayFee = std::max(nPayFee, CTxLockRequest(txDummy).GetMinFee(true)); + // InstantSend Fee + if (coinControl->fUseInstantSend) nPayFee = std::max(nPayFee, CTxLockRequest(txDummy).GetMinFee(true)); if (nPayAmount > 0) { diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 2beeb2f292763..96a42bd93168d 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -168,7 +168,7 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) QList > items = uriQuery.queryItems(); #endif - rv.fUseInstaPAC = false; + rv.fUseInstantSend = false; for (QList >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; @@ -186,7 +186,7 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) if (i->first == "IS") { if(i->second.compare(QString("1")) == 0) - rv.fUseInstaPAC = true; + rv.fUseInstantSend = true; fShouldReturnFalse = false; } @@ -256,7 +256,7 @@ QString formatBitcoinURI(const SendCoinsRecipient &info) paramCount++; } - if(info.fUseInstaPAC) + if(info.fUseInstantSend) { ret += QString("%1IS=1").arg(paramCount == 0 ? "?" : "&"); paramCount++; diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 59d5ce71edd5c..3b8af2f496024 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -157,7 +157,7 @@ void ReceiveCoinsDialog::on_receiveButton_clicked() } SendCoinsRecipient info(address, label, ui->reqAmount->value(), ui->reqMessage->text()); - info.fUseInstaPAC = ui->checkUseInstaPAC->isChecked(); + info.fUseInstantSend = ui->checkUseInstaPAC->isChecked(); ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setModel(model->getOptionsModel()); diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index 61c01256108a3..3da94f2e60319 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -149,7 +149,7 @@ void ReceiveRequestDialog::update() html += ""+tr("Label")+": " + GUIUtil::HtmlEscape(info.label) + "
"; if(!info.message.isEmpty()) html += ""+tr("Message")+": " + GUIUtil::HtmlEscape(info.message) + "
"; - html += ""+tr("InstaPAC")+": " + (info.fUseInstaPAC ? tr("Yes") : tr("No")) + "
"; + html += ""+tr("InstaPAC")+": " + (info.fUseInstantSend ? tr("Yes") : tr("No")) + "
"; ui->outUri->setText(html); #ifdef USE_QRCODE diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 635de97e2b0c6..f9bce8bb9435b 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -563,7 +563,7 @@ void RPCConsole::setClientModel(ClientModel *model) connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64))); connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t))); - connect(model, SIGNAL(islockCountChanged(size_t)), this, SLOT(setInstaPACLockCount(size_t))); + connect(model, SIGNAL(islockCountChanged(size_t)), this, SLOT(setInstantSendLockCount(size_t))); // set up peer table ui->peerWidget->setModel(model->getPeerTableModel()); @@ -907,7 +907,7 @@ void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage) ui->mempoolSize->setText(QString::number(dynUsage/1000000.0, 'f', 2) + " MB"); } -void RPCConsole::setInstaPACLockCount(size_t count) +void RPCConsole::setInstantSendLockCount(size_t count) { ui->instantSendLockCount->setText(QString::number(count)); } diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index ed0f71932140f..401abe9c11cd3 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -112,7 +112,7 @@ public Q_SLOTS: /** Set size (number of transactions and memory usage) of the mempool in the UI */ void setMempoolSize(long numberOfTxs, size_t dynUsage); /** Set number of InstaPAC locks */ - void setInstaPACLockCount(size_t count); + void setInstantSendLockCount(size_t count); /** Go forward or back in history */ void browseHistory(int offset); /** Scroll console view to end */ diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index effe6bc2a2405..b78e77d9b997e 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -77,19 +77,19 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p settings.setValue("bUseInstantX", false); bool fUsePrivateSend = settings.value("bUseDarkSend").toBool(); - bool fUseInstaPAC = settings.value("bUseInstantX").toBool(); + bool fUseInstantSend = settings.value("bUseInstantX").toBool(); if(fLiteMode) { ui->checkUsePrivateSend->setChecked(false); ui->checkUsePrivateSend->setVisible(false); ui->checkUseInstaPAC->setVisible(false); CoinControlDialog::coinControl->fUsePrivateSend = false; - CoinControlDialog::coinControl->fUseInstaPAC = false; + CoinControlDialog::coinControl->fUseInstantSend = false; } else{ ui->checkUsePrivateSend->setChecked(fUsePrivateSend); - ui->checkUseInstaPAC->setChecked(fUseInstaPAC); + ui->checkUseInstaPAC->setChecked(fUseInstantSend); CoinControlDialog::coinControl->fUsePrivateSend = fUsePrivateSend; - CoinControlDialog::coinControl->fUseInstaPAC = fUseInstaPAC; + CoinControlDialog::coinControl->fUseInstantSend = fUseInstantSend; } connect(ui->checkUsePrivateSend, SIGNAL(stateChanged ( int )), this, SLOT(updateDisplayUnit())); @@ -270,14 +270,14 @@ void SendCoinsDialog::on_sendButton_clicked() strFunds = tr("using") + " " + tr("any available funds (not anonymous)") + ""; } - if(model->IsOldInstaPACEnabled() && ui->checkUseInstaPAC->isChecked()) { + if(model->IsOldInstantSendEnabled() && ui->checkUseInstaPAC->isChecked()) { strFunds += " "; strFunds += tr("and InstaPAC"); } for (SendCoinsRecipient& rcp : recipients) { rcp.inputType = ui->checkUsePrivateSend->isChecked() ? ONLY_DENOMINATED : ALL_COINS; - rcp.fUseInstaPAC = model->IsOldInstaPACEnabled() && ui->checkUseInstaPAC->isChecked(); + rcp.fUseInstantSend = model->IsOldInstantSendEnabled() && ui->checkUseInstaPAC->isChecked(); } fNewRecipientAllowed = false; @@ -612,7 +612,7 @@ void SendCoinsDialog::updateInstaPAC() { QSettings settings; settings.setValue("bUseInstantX", ui->checkUseInstaPAC->isChecked()); - CoinControlDialog::coinControl->fUseInstaPAC = model->IsOldInstaPACEnabled() && ui->checkUseInstaPAC->isChecked(); + CoinControlDialog::coinControl->fUseInstantSend = model->IsOldInstantSendEnabled() && ui->checkUseInstaPAC->isChecked(); coinControlUpdateLabels(); } diff --git a/src/qt/test/uritests.cpp b/src/qt/test/uritests.cpp index fd756f2047ecd..8fedce8c43986 100644 --- a/src/qt/test/uritests.cpp +++ b/src/qt/test/uritests.cpp @@ -70,7 +70,7 @@ void URITests::uriTests() QVERIFY(rv.amount == 10000000000LL); QVERIFY(rv.label == QString("Some Example")); QVERIFY(rv.message == QString("Some Example Message")); - QVERIFY(rv.fUseInstaPAC == 1); + QVERIFY(rv.fUseInstantSend == 1); uri.setUrl(QString("pac:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=100&label=Some Example&message=Some Example Message&IS=Something Invalid")); QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); @@ -78,17 +78,17 @@ void URITests::uriTests() QVERIFY(rv.amount == 10000000000LL); QVERIFY(rv.label == QString("Some Example")); QVERIFY(rv.message == QString("Some Example Message")); - QVERIFY(rv.fUseInstaPAC != 1); + QVERIFY(rv.fUseInstantSend != 1); uri.setUrl(QString("pac:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?IS=1")); QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); - QVERIFY(rv.fUseInstaPAC == 1); + QVERIFY(rv.fUseInstantSend == 1); uri.setUrl(QString("pac:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?IS=0")); QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); - QVERIFY(rv.fUseInstaPAC != 1); + QVERIFY(rv.fUseInstantSend != 1); uri.setUrl(QString("pac:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg")); QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); - QVERIFY(rv.fUseInstaPAC != 1); + QVERIFY(rv.fUseInstantSend != 1); } diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 0e81b39c03a55..b76e833aacf03 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -67,9 +67,9 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) int nSignatures = instantsend.GetTransactionLockSignatures(wtx.GetHash()); int nSignaturesMax = CTxLockRequest(wtx).GetMaxSignatures(); - // InstaPAC + // InstantSend strTxStatus += " ("; - if(instantsend.IsLockedInstaPACTransaction(wtx.GetHash())) { + if(instantsend.IsLockedInstantSendTransaction(wtx.GetHash())) { strTxStatus += tr("verified via InstaPAC"); } else if(!instantsend.IsTxLockCandidateTimedOut(wtx.GetHash())) { strTxStatus += tr("InstaPAC verification in progress - %1 of %2 signatures").arg(nSignatures).arg(nSignaturesMax); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 826a4603af997..6ce7feb3e83ba 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -216,9 +216,9 @@ int WalletModel::getNumISLocks() const return cachedNumISLocks; } -bool WalletModel::IsOldInstaPACEnabled() const +bool WalletModel::IsOldInstantSendEnabled() const { - return llmq::IsOldInstaPACEnabled(); + return llmq::IsOldInstantSendEnabled(); } void WalletModel::updateAddressBook(const QString &address, const QString &label, @@ -319,7 +319,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact return AmountExceedsBalance; } - if(recipients[0].fUseInstaPAC && IsOldInstaPACEnabled() && total > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { + if(recipients[0].fUseInstantSend && IsOldInstantSendEnabled() && total > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { Q_EMIT message(tr("Send Coins"), tr("InstaPAC doesn't support sending values that high yet. Transactions are currently limited to %1 PAC.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)), CClientUIInterface::MSG_ERROR); return TransactionCreationFailed; @@ -340,7 +340,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact CWalletTx* newTx = transaction.getTransaction(); CReserveKey *keyChange = transaction.getPossibleKeyChange(); - fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl, true, recipients[0].inputType, recipients[0].fUseInstaPAC); + fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl, true, recipients[0].inputType, recipients[0].fUseInstantSend); transaction.setTransactionFee(nFeeRequired); if (fSubtractFeeFromAmount && fCreated) transaction.reassignAmounts(); @@ -349,7 +349,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact nVinSize = newTx->tx->vin.size(); } - if(recipients[0].fUseInstaPAC && IsOldInstaPACEnabled()) { + if(recipients[0].fUseInstantSend && IsOldInstantSendEnabled()) { if(nValueOut > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { Q_EMIT message(tr("Send Coins"), tr("InstaPAC doesn't support sending values that high yet. Transactions are currently limited to %1 PAC.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)), CClientUIInterface::MSG_ERROR); @@ -415,7 +415,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran CValidationState state; // the new IX system does not require explicit IX messages std::string strCommand = NetMsgType::TX; - if (recipients[0].fUseInstaPAC && IsOldInstaPACEnabled()) { + if (recipients[0].fUseInstantSend && IsOldInstantSendEnabled()) { strCommand = NetMsgType::TXLOCKREQUEST; } if(!wallet->CommitTransaction(*newTx, *keyChange, g_connman.get(), state, strCommand)) diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index af8793d57b27a..c1ba1fd9d290b 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -54,7 +54,7 @@ class SendCoinsRecipient #ifdef ENABLE_WALLET AvailableCoinsType inputType; #endif // ENABLE_WALLET - bool fUseInstaPAC; + bool fUseInstantSend; CAmount amount; // If from a payment request, this is used for storing the memo QString message; @@ -233,7 +233,7 @@ class WalletModel : public QObject int getDefaultConfirmTarget() const; int getNumISLocks() const; - bool IsOldInstaPACEnabled() const; + bool IsOldInstantSendEnabled() const; private: CWallet *wallet; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 955eb265484cc..b9697bf9314b5 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -407,7 +407,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) info.push_back(Pair("depends", depends)); info.push_back(Pair("instantsend", instantsend.HasTxLockRequest(tx.GetHash()))); - info.push_back(Pair("instantlock", instantsend.IsLockedInstaPACTransaction(tx.GetHash()) || llmq::quorumInstaPACManager->IsLocked(tx.GetHash()))); + info.push_back(Pair("instantlock", instantsend.IsLockedInstantSendTransaction(tx.GetHash()) || llmq::quorumInstantSendManager->IsLocked(tx.GetHash()))); } UniValue mempoolToJSON(bool fVerbose = false) @@ -1504,7 +1504,7 @@ UniValue mempoolInfoToJSON() size_t maxmempool = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; ret.push_back(Pair("maxmempool", (int64_t) maxmempool)); ret.push_back(Pair("mempoolminfee", ValueFromAmount(mempool.GetMinFee(maxmempool).GetFeePerK()))); - ret.push_back(Pair("instantsendlocks", (int64_t)llmq::quorumInstaPACManager->GetInstaPACLockCount())); + ret.push_back(Pair("instantsendlocks", (int64_t)llmq::quorumInstantSendManager->GetInstantSendLockCount())); return ret; } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 82702f2910a43..ecc1272307084 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -199,8 +199,8 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) } } } - bool fLocked = instantsend.IsLockedInstaPACTransaction(txid); - bool fLLMQLocked = llmq::quorumInstaPACManager->IsLocked(txid); + bool fLocked = instantsend.IsLockedInstantSendTransaction(txid); + bool fLLMQLocked = llmq::quorumInstantSendManager->IsLocked(txid); entry.push_back(Pair("instantlock", fLocked || fLLMQLocked || chainLock)); entry.push_back(Pair("instantlock_internal", fLocked || fLLMQLocked)); entry.push_back(Pair("chainlock", chainLock)); diff --git a/src/stacktraces.h b/src/stacktraces.h index 00c73d4fdbe83..0fa6c0dc93432 100644 --- a/src/stacktraces.h +++ b/src/stacktraces.h @@ -2,8 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_STACKTRACES_H -#define PAC_STACKTRACES_H +#ifndef DASH_STACKTRACES_H +#define DASH_STACKTRACES_H #include #include diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 673760f93afa2..eea9fe125a4a3 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1472,7 +1472,7 @@ int CTxMemPool::Expire(int64_t time) { setEntries toremove; while (it != mapTx.get().end() && it->GetTime() < time) { // locked txes do not expire until mined and have sufficient confirmations - if (instantsend.IsLockedInstaPACTransaction(it->GetTx().GetHash()) || llmq::quorumInstaPACManager->IsLocked(it->GetTx().GetHash())) { + if (instantsend.IsLockedInstantSendTransaction(it->GetTx().GetHash()) || llmq::quorumInstantSendManager->IsLocked(it->GetTx().GetHash())) { it++; continue; } diff --git a/src/unordered_lru_cache.h b/src/unordered_lru_cache.h index fb32be22b8b99..d243203dba3c0 100644 --- a/src/unordered_lru_cache.h +++ b/src/unordered_lru_cache.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef PAC_UNORDERED_LRU_CACHE_H -#define PAC_UNORDERED_LRU_CACHE_H +#ifndef DASH_UNORDERED_LRU_CACHE_H +#define DASH_UNORDERED_LRU_CACHE_H #include diff --git a/src/util.cpp b/src/util.cpp index 7343351bc5e39..93ade3d6daa0b 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -288,7 +288,7 @@ bool LogAcceptCategory(const char* category) ptrCategory.reset(new std::set(categories.begin(), categories.end())); // thread_specific_ptr automatically deletes the set when the thread ends. // "dash" is a composite category enabling all PACGlobal-related debug output - if(ptrCategory->count(std::string("dash"))) { + if(ptrCategory->count(std::string("pacglobal"))) { ptrCategory->insert(std::string("chainlocks")); ptrCategory->insert(std::string("gobject")); ptrCategory->insert(std::string("instantsend")); diff --git a/src/validation.cpp b/src/validation.cpp index a4f9310a01dc3..3dab739cb590b 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -714,12 +714,12 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C REJECT_INVALID, "tx-txlock-conflict"); } - llmq::CInstaPACLockPtr conflictLock = llmq::quorumInstaPACManager->GetConflictingLock(tx); + llmq::CInstantSendLockPtr conflictLock = llmq::quorumInstantSendManager->GetConflictingLock(tx); if (conflictLock) { CTransactionRef txConflict; uint256 hashBlock; if (GetTransaction(conflictLock->txid, txConflict, Params().GetConsensus(), hashBlock)) { - GetMainSignals().NotifyInstaPACDoubleSpendAttempt(tx, *txConflict); + GetMainSignals().NotifyInstantSendDoubleSpendAttempt(tx, *txConflict); } return state.DoS(10, error("AcceptToMemoryPool : Transaction %s conflicts with locked TX %s", hash.ToString(), conflictLock->txid.ToString()), @@ -736,7 +736,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C { const CTransaction *ptxConflicting = itConflicting->second; - // InstaPAC txes are not replacable + // InstantSend txes are not replacable if(instantsend.HasTxLockRequest(ptxConflicting->GetHash())) { // this tx conflicts with a Transaction Lock Request candidate return state.DoS(0, error("AcceptToMemoryPool : Transaction %s conflicts with Transaction Lock Request %s", @@ -1841,7 +1841,7 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne static CCheckQueue scriptcheckqueue(128); void ThreadScriptCheck() { - RenameThread("dash-scriptch"); + RenameThread("pacglobal-scriptch"); scriptcheckqueue.Thread(); } @@ -2280,13 +2280,13 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd REJECT_INVALID, "conflict-tx-lock"); } } - llmq::CInstaPACLockPtr conflictLock = llmq::quorumInstaPACManager->GetConflictingLock(*tx); + llmq::CInstantSendLockPtr conflictLock = llmq::quorumInstantSendManager->GetConflictingLock(*tx); if (!conflictLock) { continue; } if (llmq::chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash())) { - llmq::quorumInstaPACManager->RemoveChainLockConflictingLock(::SerializeHash(*conflictLock), *conflictLock); - assert(llmq::quorumInstaPACManager->GetConflictingLock(*tx) == nullptr); + llmq::quorumInstantSendManager->RemoveChainLockConflictingLock(::SerializeHash(*conflictLock), *conflictLock); + assert(llmq::quorumInstantSendManager->GetConflictingLock(*tx) == nullptr); } else { // The node which relayed this should switch to correct chain. // TODO: relay instantsend data/proof. diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 990b240821158..a9f8483955083 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -29,7 +29,7 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { g_signals.NewPoWValidBlock.connect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2)); g_signals.NotifyGovernanceObject.connect(boost::bind(&CValidationInterface::NotifyGovernanceObject, pwalletIn, _1)); g_signals.NotifyGovernanceVote.connect(boost::bind(&CValidationInterface::NotifyGovernanceVote, pwalletIn, _1)); - g_signals.NotifyInstaPACDoubleSpendAttempt.connect(boost::bind(&CValidationInterface::NotifyInstaPACDoubleSpendAttempt, pwalletIn, _1, _2)); + g_signals.NotifyInstantSendDoubleSpendAttempt.connect(boost::bind(&CValidationInterface::NotifyInstantSendDoubleSpendAttempt, pwalletIn, _1, _2)); g_signals.NotifyMasternodeListChanged.connect(boost::bind(&CValidationInterface::NotifyMasternodeListChanged, pwalletIn, _1, _2, _3)); } @@ -50,7 +50,7 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) { g_signals.AcceptedBlockHeader.disconnect(boost::bind(&CValidationInterface::AcceptedBlockHeader, pwalletIn, _1)); g_signals.NotifyGovernanceObject.disconnect(boost::bind(&CValidationInterface::NotifyGovernanceObject, pwalletIn, _1)); g_signals.NotifyGovernanceVote.disconnect(boost::bind(&CValidationInterface::NotifyGovernanceVote, pwalletIn, _1)); - g_signals.NotifyInstaPACDoubleSpendAttempt.disconnect(boost::bind(&CValidationInterface::NotifyInstaPACDoubleSpendAttempt, pwalletIn, _1, _2)); + g_signals.NotifyInstantSendDoubleSpendAttempt.disconnect(boost::bind(&CValidationInterface::NotifyInstantSendDoubleSpendAttempt, pwalletIn, _1, _2)); g_signals.NotifyMasternodeListChanged.disconnect(boost::bind(&CValidationInterface::NotifyMasternodeListChanged, pwalletIn, _1, _2, _3)); } @@ -71,6 +71,6 @@ void UnregisterAllValidationInterfaces() { g_signals.AcceptedBlockHeader.disconnect_all_slots(); g_signals.NotifyGovernanceObject.disconnect_all_slots(); g_signals.NotifyGovernanceVote.disconnect_all_slots(); - g_signals.NotifyInstaPACDoubleSpendAttempt.disconnect_all_slots(); + g_signals.NotifyInstantSendDoubleSpendAttempt.disconnect_all_slots(); g_signals.NotifyMasternodeListChanged.disconnect_all_slots(); } diff --git a/src/validationinterface.h b/src/validationinterface.h index acd19decf8198..5ddf19648da80 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -43,7 +43,7 @@ class CValidationInterface { virtual void NotifyChainLock(const CBlockIndex* pindex) {} virtual void NotifyGovernanceVote(const CGovernanceVote &vote) {} virtual void NotifyGovernanceObject(const CGovernanceObject &object) {} - virtual void NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) {} + virtual void NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) {} virtual void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff) {} virtual void SetBestChain(const CBlockLocator &locator) {} virtual bool UpdatedTransaction(const uint256 &hash) { return false;} @@ -85,7 +85,7 @@ struct CMainSignals { /** Notifies listeners of a new governance object. */ boost::signals2::signal NotifyGovernanceObject; /** Notifies listeners of a attempted InstaPAC double spend*/ - boost::signals2::signal NotifyInstaPACDoubleSpendAttempt; + boost::signals2::signal NotifyInstantSendDoubleSpendAttempt; /** Notifies listeners that the MN list changed */ boost::signals2::signal NotifyMasternodeListChanged; /** Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible). */ diff --git a/src/wallet/coincontrol.h b/src/wallet/coincontrol.h index 1937c2fb6aa92..2d06635f61211 100644 --- a/src/wallet/coincontrol.h +++ b/src/wallet/coincontrol.h @@ -13,7 +13,7 @@ class CCoinControl public: CTxDestination destChange; bool fUsePrivateSend; - bool fUseInstaPAC; + bool fUseInstantSend; //! If false, allows unselected inputs, but requires all selected inputs be used if fAllowOtherInputs is true (default) bool fAllowOtherInputs; //! If false, only include as many inputs as necessary to fulfill a coin selection request. Only usable together with fAllowOtherInputs @@ -41,7 +41,7 @@ class CCoinControl fRequireAllInputs = true; fAllowWatchOnly = false; setSelected.clear(); - fUseInstaPAC = false; + fUseInstantSend = false; fUsePrivateSend = true; nMinimumTotalFee = 0; nFeeRate = CFeeRate(0); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 277cc5d7bb7d5..db60c5a181d58 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -65,8 +65,8 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) { AssertLockHeld(cs_main); // for mapBlockIndex int confirms = wtx.GetDepthInMainChain(); - bool fLocked = instantsend.IsLockedInstaPACTransaction(wtx.GetHash()); - bool fLLMQLocked = llmq::quorumInstaPACManager->IsLocked(wtx.GetHash()); + bool fLocked = instantsend.IsLockedInstantSendTransaction(wtx.GetHash()); + bool fLLMQLocked = llmq::quorumInstantSendManager->IsLocked(wtx.GetHash()); bool chainlock = false; if (confirms > 0) { chainlock = llmq::chainLocksHandler->HasChainLock(mapBlockIndex[wtx.hashBlock]->nHeight, wtx.hashBlock); @@ -354,7 +354,7 @@ UniValue getaddressesbyaccount(const JSONRPCRequest& request) return ret; } -static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, bool fUseInstaPAC = false, bool fUsePrivateSend = false) +static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, bool fUseInstantSend = false, bool fUsePrivateSend = false) { CAmount curBalance = pwallet->GetBalance(); @@ -381,7 +381,7 @@ static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CA CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount}; vecSend.push_back(recipient); if (!pwallet->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet, - strError, NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstaPAC)) { + strError, NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstantSend)) { if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance) strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired)); throw JSONRPCError(RPC_WALLET_ERROR, strError); @@ -389,7 +389,7 @@ static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CA CValidationState state; // the new IX system does not require explicit IX messages std::string strCommand = NetMsgType::TX; - if (fUseInstaPAC && llmq::IsOldInstaPACEnabled()) { + if (fUseInstantSend && llmq::IsOldInstantSendEnabled()) { strCommand = NetMsgType::TXLOCKREQUEST; } if (!pwallet->CommitTransaction(wtxNew, reservekey, g_connman.get(), state, strCommand)) { @@ -453,16 +453,16 @@ UniValue sendtoaddress(const JSONRPCRequest& request) if (request.params.size() > 4) fSubtractFeeFromAmount = request.params[4].get_bool(); - bool fUseInstaPAC = false; + bool fUseInstantSend = false; bool fUsePrivateSend = false; if (request.params.size() > 5) - fUseInstaPAC = request.params[5].get_bool(); + fUseInstantSend = request.params[5].get_bool(); if (request.params.size() > 6) fUsePrivateSend = request.params[6].get_bool(); EnsureWalletIsUnlocked(pwallet); - SendMoney(pwallet, address.Get(), nAmount, fSubtractFeeFromAmount, wtx, fUseInstaPAC, fUsePrivateSend); + SendMoney(pwallet, address.Get(), nAmount, fSubtractFeeFromAmount, wtx, fUseInstantSend, fUsePrivateSend); return wtx.GetHash().GetHex(); } @@ -1130,21 +1130,21 @@ UniValue sendmany(const JSONRPCRequest& request) CAmount nFeeRequired = 0; int nChangePosRet = -1; std::string strFailReason; - bool fUseInstaPAC = false; + bool fUseInstantSend = false; bool fUsePrivateSend = false; if (request.params.size() > 6) - fUseInstaPAC = request.params[6].get_bool(); + fUseInstantSend = request.params[6].get_bool(); if (request.params.size() > 7) fUsePrivateSend = request.params[7].get_bool(); bool fCreated = pwallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, - NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstaPAC); + NULL, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, fUseInstantSend); if (!fCreated) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); CValidationState state; // the new IX system does not require explicit IX messages std::string strCommand = NetMsgType::TX; - if (fUseInstaPAC && llmq::IsOldInstaPACEnabled()) { + if (fUseInstantSend && llmq::IsOldInstantSendEnabled()) { strCommand = NetMsgType::TXLOCKREQUEST; } if (!pwallet->CommitTransaction(wtx, keyChange, g_connman.get(), state, strCommand)) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index feb605c7c7013..02342cc96de46 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1911,7 +1911,7 @@ bool CWalletTx::RelayWalletTransaction(CConnman* connman, const std::string& str LogPrintf("Relaying wtx %s\n", hash.ToString()); if ((strCommand == NetMsgType::TXLOCKREQUEST) || - ((CTxLockRequest(*this).IsSimple()) && CInstaPAC::CanAutoLock())) { + ((CTxLockRequest(*this).IsSimple()) && CInstantSend::CanAutoLock())) { if (instantsend.ProcessTxLockRequest((CTxLockRequest)*this, *connman)) { instantsend.AcceptLockRequest((CTxLockRequest)*this); } else { @@ -2489,13 +2489,13 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const return nTotal; } -void CWallet::AvailableCoins(std::vector& vCoins, bool fOnlySafe, const CCoinControl *coinControl, bool fIncludeZeroValue, AvailableCoinsType nCoinType, bool fUseInstaPAC) const +void CWallet::AvailableCoins(std::vector& vCoins, bool fOnlySafe, const CCoinControl *coinControl, bool fIncludeZeroValue, AvailableCoinsType nCoinType, bool fUseInstantSend) const { vCoins.clear(); { LOCK2(cs_main, cs_wallet); - int nInstaPACConfirmationsRequired = Params().GetConsensus().nInstaPACConfirmationsRequired; + int nInstantSendConfirmationsRequired = Params().GetConsensus().nInstantSendConfirmationsRequired; for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { @@ -2509,8 +2509,8 @@ void CWallet::AvailableCoins(std::vector& vCoins, bool fOnlySafe, const continue; int nDepth = pcoin->GetDepthInMainChain(); - // do not use IX for inputs that have less then nInstaPACConfirmationsRequired blockchain confirmations - if (fUseInstaPAC && nDepth < nInstaPACConfirmationsRequired) + // do not use IX for inputs that have less then nInstantSendConfirmationsRequired blockchain confirmations + if (fUseInstantSend && nDepth < nInstantSendConfirmationsRequired) continue; // We should not consider coins which aren't at least in our mempool @@ -2555,17 +2555,17 @@ void CWallet::AvailableCoins(std::vector& vCoins, bool fOnlySafe, const } static void ApproximateBestSubset(std::vector > >vValue, const CAmount& nTotalLower, const CAmount& nTargetValue, - std::vector& vfBest, CAmount& nBest, bool fUseInstaPAC = false, int iterations = 1000) + std::vector& vfBest, CAmount& nBest, bool fUseInstantSend = false, int iterations = 1000) { std::vector vfIncluded; vfBest.assign(vValue.size(), true); nBest = nTotalLower; - if (!llmq::IsOldInstaPACEnabled()) { - // The new system does not require special handling for InstaPAC as this is all done in CInstaPACManager. + if (!llmq::IsOldInstantSendEnabled()) { + // The new system does not require special handling for InstaPAC as this is all done in CInstantSendManager. // There is also no need for an extra fee anymore. - fUseInstaPAC = false; + fUseInstantSend = false; } FastRandomContext insecure_rand; @@ -2579,7 +2579,7 @@ static void ApproximateBestSubset(std::vector sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { + if (fUseInstantSend && nTotal + vValue[i].first > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { continue; } //The solver here uses a randomized algorithm, @@ -2635,20 +2635,20 @@ bool less_then_denom (const COutput& out1, const COutput& out2) } bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMine, const int nConfTheirs, const uint64_t nMaxAncestors, std::vector vCoins, - std::set >& setCoinsRet, CAmount& nValueRet, AvailableCoinsType nCoinType, bool fUseInstaPAC) const + std::set >& setCoinsRet, CAmount& nValueRet, AvailableCoinsType nCoinType, bool fUseInstantSend) const { setCoinsRet.clear(); nValueRet = 0; - if (!llmq::IsOldInstaPACEnabled()) { - // The new system does not require special handling for InstaPAC as this is all done in CInstaPACManager. + if (!llmq::IsOldInstantSendEnabled()) { + // The new system does not require special handling for InstaPAC as this is all done in CInstantSendManager. // There is also no need for an extra fee anymore. - fUseInstaPAC = false; + fUseInstantSend = false; } // List of values less than target std::pair > coinLowestLarger; - coinLowestLarger.first = fUseInstaPAC + coinLowestLarger.first = fUseInstantSend ? sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN : std::numeric_limits::max(); coinLowestLarger.second.first = NULL; @@ -2762,9 +2762,9 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin std::vector vfBest; CAmount nBest; - ApproximateBestSubset(vValue, nTotalLower, nTargetValue, vfBest, nBest, fUseInstaPAC); + ApproximateBestSubset(vValue, nTotalLower, nTargetValue, vfBest, nBest, fUseInstantSend); if (nBest != nTargetValue && nTotalLower >= nTargetValue + nMinChange) - ApproximateBestSubset(vValue, nTotalLower, nTargetValue + nMinChange, vfBest, nBest, fUseInstaPAC); + ApproximateBestSubset(vValue, nTotalLower, nTargetValue + nMinChange, vfBest, nBest, fUseInstantSend); // If we have a bigger coin and (either the stochastic approximation didn't find a good solution, // or the next bigger coin is closer), return the bigger coin @@ -2793,7 +2793,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin return nCoinType == ONLY_DENOMINATED ? (nValueRet - nTargetValue <= maxTxFee) : true; } -bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl, AvailableCoinsType nCoinType, bool fUseInstaPAC) const +bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl, AvailableCoinsType nCoinType, bool fUseInstantSend) const { // Note: this function should never be used for "always free" tx types like dstx @@ -2866,13 +2866,13 @@ bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAm bool fRejectLongChains = GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS); bool res = nTargetValue <= nValueFromPresetInputs || - SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 1, 6, 0, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstaPAC) || - SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 1, 1, 0, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstaPAC) || - (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, 2, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstaPAC)) || - (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, std::min((size_t)4, nMaxChainLength/3), vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstaPAC)) || - (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, nMaxChainLength/2, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstaPAC)) || - (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, nMaxChainLength, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstaPAC)) || - (bSpendZeroConfChange && !fRejectLongChains && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, std::numeric_limits::max(), vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstaPAC)); + SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 1, 6, 0, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstantSend) || + SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 1, 1, 0, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstantSend) || + (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, 2, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstantSend)) || + (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, std::min((size_t)4, nMaxChainLength/3), vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstantSend)) || + (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, nMaxChainLength/2, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstantSend)) || + (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, nMaxChainLength, vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstantSend)) || + (bSpendZeroConfChange && !fRejectLongChains && SelectCoinsMinConf(nTargetValue - nValueFromPresetInputs, 0, 1, std::numeric_limits::max(), vCoins, setCoinsRet, nValueRet, nCoinType, fUseInstantSend)); // because SelectCoinsMinConf clears the setCoinsRet, we now add the possible inputs to the coinset setCoinsRet.insert(setPresetCoins.begin(), setPresetCoins.end()); @@ -3273,7 +3273,7 @@ bool CWallet::CreateCollateralTransaction(CMutableTransaction& txCollateral, std return true; } -bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, CAmount amount, bool fUseInstaPAC, const COutPoint& outpoint) +bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, CAmount amount, bool fUseInstantSend, const COutPoint& outpoint) { // make our change address CReserveKey reservekey(this); @@ -3291,7 +3291,7 @@ bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, CAmount a if (!outpoint.IsNull()) { coinControl.Select(outpoint); } - bool success = CreateTransaction(vecSend, tx, reservekey, nFeeRet, nChangePosRet, strFail, &coinControl, true, ALL_COINS, fUseInstaPAC); + bool success = CreateTransaction(vecSend, tx, reservekey, nFeeRet, nChangePosRet, strFail, &coinControl, true, ALL_COINS, fUseInstantSend); if(!success){ LogPrintf("CWallet::GetBudgetSystemCollateralTX -- Error: %s\n", strFail); return false; @@ -3319,12 +3319,12 @@ bool CWallet::ConvertList(std::vector vecTxIn, std::vector& vecA } bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, - int& nChangePosInOut, std::string& strFailReason, const CCoinControl* coinControl, bool sign, AvailableCoinsType nCoinType, bool fUseInstaPAC, int nExtraPayloadSize) + int& nChangePosInOut, std::string& strFailReason, const CCoinControl* coinControl, bool sign, AvailableCoinsType nCoinType, bool fUseInstantSend, int nExtraPayloadSize) { - if (!llmq::IsOldInstaPACEnabled()) { - // The new system does not require special handling for InstaPAC as this is all done in CInstaPACManager. + if (!llmq::IsOldInstantSendEnabled()) { + // The new system does not require special handling for InstaPAC as this is all done in CInstantSendManager. // There is also no need for an extra fee anymore. - fUseInstaPAC = false; + fUseInstantSend = false; } if (nExtraPayloadSize > 0 && chainActive.Height() < Params().GetConsensus().DIP0003Height) { @@ -3332,7 +3332,7 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletT return false; } - CAmount nFeePay = fUseInstaPAC ? CTxLockRequest().GetMinFee(true) : 0; + CAmount nFeePay = fUseInstantSend ? CTxLockRequest().GetMinFee(true) : 0; CAmount nValue = 0; int nChangePosRequest = nChangePosInOut; @@ -3404,8 +3404,8 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletT LOCK2(cs_main, cs_wallet); { std::vector vAvailableCoins; - AvailableCoins(vAvailableCoins, true, coinControl, false, nCoinType, fUseInstaPAC); - int nInstaPACConfirmationsRequired = Params().GetConsensus().nInstaPACConfirmationsRequired; + AvailableCoins(vAvailableCoins, true, coinControl, false, nCoinType, fUseInstantSend); + int nInstantSendConfirmationsRequired = Params().GetConsensus().nInstantSendConfirmationsRequired; nFeeRet = 0; if(nFeePay > 0) nFeeRet = nFeePay; @@ -3456,7 +3456,7 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletT // Choose coins to use CAmount nValueIn = 0; setCoins.clear(); - if (!SelectCoins(vAvailableCoins, nValueToSelect, setCoins, nValueIn, coinControl, nCoinType, fUseInstaPAC)) + if (!SelectCoins(vAvailableCoins, nValueToSelect, setCoins, nValueIn, coinControl, nCoinType, fUseInstantSend)) { if (nCoinType == ONLY_NONDENOMINATED) { strFailReason = _("Unable to locate enough PrivateSend non-denominated funds for this transaction."); @@ -3465,15 +3465,15 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletT strFailReason += " " + _("PrivateSend uses exact denominated amounts to send funds, you might simply need to anonymize some more coins."); } else if (nValueIn < nValueToSelect) { strFailReason = _("Insufficient funds."); - if (fUseInstaPAC) { + if (fUseInstantSend) { // could be not true but most likely that's the reason - strFailReason += " " + strprintf(_("InstaPAC requires inputs with at least %d confirmations, you might need to wait a few minutes and try again."), nInstaPACConfirmationsRequired); + strFailReason += " " + strprintf(_("InstaPAC requires inputs with at least %d confirmations, you might need to wait a few minutes and try again."), nInstantSendConfirmationsRequired); } } return false; } - if (fUseInstaPAC && nValueIn > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { + if (fUseInstantSend && nValueIn > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { strFailReason += " " + strprintf(_("InstaPAC doesn't support sending values that high yet. Transactions are currently limited to %1 PAC."), sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)); return false; } @@ -3648,7 +3648,7 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletT if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) { nFeeNeeded = coinControl->nMinimumTotalFee; } - if(fUseInstaPAC) { + if(fUseInstantSend) { nFeeNeeded = std::max(nFeeNeeded, CTxLockRequest(txNew).GetMinFee(true)); } if (coinControl && coinControl->fOverrideFeeRate) @@ -5578,12 +5578,12 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const bool CMerkleTx::IsLockedByInstaPAC() const { - return instantsend.IsLockedInstaPACTransaction(GetHash()) || llmq::quorumInstaPACManager->IsLocked(GetHash()); + return instantsend.IsLockedInstantSendTransaction(GetHash()) || llmq::quorumInstantSendManager->IsLocked(GetHash()); } bool CMerkleTx::IsLockedByLLMQInstaPAC() const { - return llmq::quorumInstaPACManager->IsLocked(GetHash()); + return llmq::quorumInstantSendManager->IsLocked(GetHash()); } bool CMerkleTx::IsChainLocked() const diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 88f1be3c9a419..bd5c881dfb2d1 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -682,7 +682,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface * all coins from coinControl are selected; Never select unconfirmed coins * if they are not ours */ - bool SelectCoins(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set >& setCoinsRet, CAmount& nValueRet, const CCoinControl *coinControl = NULL, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstaPAC = true) const; + bool SelectCoins(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set >& setCoinsRet, CAmount& nValueRet, const CCoinControl *coinControl = NULL, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstantSend = true) const; CWalletDB *pwalletdbEncryption; @@ -854,7 +854,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface /** * populate vCoins with vector of available COutputs. */ - void AvailableCoins(std::vector& vCoins, bool fOnlySafe=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstaPAC = false) const; + void AvailableCoins(std::vector& vCoins, bool fOnlySafe=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstantSend = false) const; /** * Shuffle and select coins until nTargetValue is reached while avoiding @@ -862,7 +862,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface * completion the coin set and corresponding actual target value is * assembled */ - bool SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, uint64_t nMaxAncestors, std::vector vCoins, std::set >& setCoinsRet, CAmount& nValueRet, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstaPAC = false) const; + bool SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, uint64_t nMaxAncestors, std::vector vCoins, std::set >& setCoinsRet, CAmount& nValueRet, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstantSend = false) const; // Coin selection bool SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMin, CAmount nValueMax, std::vector< std::pair >& vecPSInOutPairsRet); @@ -987,7 +987,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface CAmount GetNormalizedAnonymizedBalance() const; CAmount GetDenominatedBalance(bool unconfirmed=false) const; - bool GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, CAmount amount, bool fUseInstaPAC, const COutPoint& outpoint=COutPoint()/*defaults null*/); + bool GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, CAmount amount, bool fUseInstantSend, const COutPoint& outpoint=COutPoint()/*defaults null*/); /** * Insert additional inputs into the transaction by @@ -1001,7 +1001,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface * @note passing nChangePosInOut as -1 will result in setting a random position */ bool CreateTransaction(const std::vector& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosInOut, - std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstaPAC=false, int nExtraPayloadSize = 0); + std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true, AvailableCoinsType nCoinType=ALL_COINS, bool fUseInstantSend=false, int nExtraPayloadSize = 0); bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, CAmount blockReward, CMutableTransaction& txNew, unsigned int& nTxNewTime, std::vector &vwtxPrev); diff --git a/src/zmq/zmqabstractnotifier.cpp b/src/zmq/zmqabstractnotifier.cpp index 51147fda1f208..72aa19ecbb91c 100644 --- a/src/zmq/zmqabstractnotifier.cpp +++ b/src/zmq/zmqabstractnotifier.cpp @@ -41,7 +41,7 @@ bool CZMQAbstractNotifier::NotifyGovernanceObject(const CGovernanceObject& /*obj return true; } -bool CZMQAbstractNotifier::NotifyInstaPACDoubleSpendAttempt(const CTransaction& /*currentTx*/, const CTransaction& /*previousTx*/) +bool CZMQAbstractNotifier::NotifyInstantSendDoubleSpendAttempt(const CTransaction& /*currentTx*/, const CTransaction& /*previousTx*/) { return true; } diff --git a/src/zmq/zmqabstractnotifier.h b/src/zmq/zmqabstractnotifier.h index 0b55bcbe5e1d0..029be2a161712 100644 --- a/src/zmq/zmqabstractnotifier.h +++ b/src/zmq/zmqabstractnotifier.h @@ -40,7 +40,7 @@ class CZMQAbstractNotifier virtual bool NotifyTransactionLock(const CTransaction &transaction); virtual bool NotifyGovernanceVote(const CGovernanceVote &vote); virtual bool NotifyGovernanceObject(const CGovernanceObject &object); - virtual bool NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx); + virtual bool NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx); protected: diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp index 6a8892ecf8005..575c5da892cbd 100644 --- a/src/zmq/zmqnotificationinterface.cpp +++ b/src/zmq/zmqnotificationinterface.cpp @@ -41,7 +41,7 @@ CZMQNotificationInterface* CZMQNotificationInterface::Create() factories["pubhashtxlock"] = CZMQAbstractNotifier::Create; factories["pubhashgovernancevote"] = CZMQAbstractNotifier::Create; factories["pubhashgovernanceobject"] = CZMQAbstractNotifier::Create; - factories["pubhashinstantsenddoublespend"] = CZMQAbstractNotifier::Create; + factories["pubhashinstantsenddoublespend"] = CZMQAbstractNotifier::Create; factories["pubrawblock"] = CZMQAbstractNotifier::Create; factories["pubrawchainlock"] = CZMQAbstractNotifier::Create; factories["pubrawtx"] = CZMQAbstractNotifier::Create; @@ -239,11 +239,11 @@ void CZMQNotificationInterface::NotifyGovernanceObject(const CGovernanceObject & } } -void CZMQNotificationInterface::NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) +void CZMQNotificationInterface::NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) { for (auto it = notifiers.begin(); it != notifiers.end();) { CZMQAbstractNotifier *notifier = *it; - if (notifier->NotifyInstaPACDoubleSpendAttempt(currentTx, previousTx)) { + if (notifier->NotifyInstantSendDoubleSpendAttempt(currentTx, previousTx)) { ++it; } else { notifier->Shutdown(); diff --git a/src/zmq/zmqnotificationinterface.h b/src/zmq/zmqnotificationinterface.h index 90ac6f1a7262e..a94dd29338e4f 100644 --- a/src/zmq/zmqnotificationinterface.h +++ b/src/zmq/zmqnotificationinterface.h @@ -30,7 +30,7 @@ class CZMQNotificationInterface : public CValidationInterface void NotifyTransactionLock(const CTransaction &tx) override; void NotifyGovernanceVote(const CGovernanceVote& vote) override; void NotifyGovernanceObject(const CGovernanceObject& object) override; - void NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) override; + void NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) override; private: diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp index 58bede32c089f..149efa1dd582e 100644 --- a/src/zmq/zmqpublishnotifier.cpp +++ b/src/zmq/zmqpublishnotifier.cpp @@ -211,7 +211,7 @@ bool CZMQPublishHashGovernanceObjectNotifier::NotifyGovernanceObject(const CGove return SendMessage(MSG_HASHGOBJ, data, 32); } -bool CZMQPublishHashInstaPACDoubleSpendNotifier::NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) +bool CZMQPublishHashInstantSendDoubleSpendNotifier::NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) { uint256 currentHash = currentTx.GetHash(), previousHash = previousTx.GetHash(); LogPrint("zmq", "zmq: Publish hashinstantsenddoublespend %s conflicts against %s\n", currentHash.ToString(), previousHash.ToString()); @@ -303,7 +303,7 @@ bool CZMQPublishRawGovernanceObjectNotifier::NotifyGovernanceObject(const CGover return SendMessage(MSG_RAWGOBJ, &(*ss.begin()), ss.size()); } -bool CZMQPublishRawInstaPACDoubleSpendNotifier::NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) +bool CZMQPublishRawInstaPACDoubleSpendNotifier::NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) { LogPrint("zmq", "zmq: Publish rawinstantsenddoublespend %s conflicts with %s\n", currentTx.GetHash().ToString(), previousTx.GetHash().ToString()); CDataStream ssCurrent(SER_NETWORK, PROTOCOL_VERSION), ssPrevious(SER_NETWORK, PROTOCOL_VERSION); diff --git a/src/zmq/zmqpublishnotifier.h b/src/zmq/zmqpublishnotifier.h index 248a709d00fed..d1b09aeafb634 100644 --- a/src/zmq/zmqpublishnotifier.h +++ b/src/zmq/zmqpublishnotifier.h @@ -66,10 +66,10 @@ class CZMQPublishHashGovernanceObjectNotifier : public CZMQAbstractPublishNotifi bool NotifyGovernanceObject(const CGovernanceObject &object) override; }; -class CZMQPublishHashInstaPACDoubleSpendNotifier : public CZMQAbstractPublishNotifier +class CZMQPublishHashInstantSendDoubleSpendNotifier : public CZMQAbstractPublishNotifier { public: - bool NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) override; + bool NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) override; }; class CZMQPublishRawBlockNotifier : public CZMQAbstractPublishNotifier @@ -111,6 +111,6 @@ class CZMQPublishRawGovernanceObjectNotifier : public CZMQAbstractPublishNotifie class CZMQPublishRawInstaPACDoubleSpendNotifier : public CZMQAbstractPublishNotifier { public: - bool NotifyInstaPACDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) override; + bool NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx) override; }; #endif // BITCOIN_ZMQ_ZMQPUBLISHNOTIFIER_H