From c6663910f749291fc71ce6632cd45ecf71404692 Mon Sep 17 00:00:00 2001 From: Jimmy Pound Date: Sat, 27 Jul 2024 17:57:18 +0200 Subject: [PATCH 1/2] Revert "Prepend std::placeholders namespace to placeholder arguments of boost::bind()" This reverts commit 2669119b39ddeebc824bd5f452b6888116a9bdbe. --- src/main.cpp | 20 ++++++++++---------- src/qt/bitmarkgui.cpp | 4 ++-- src/qt/clientmodel.cpp | 8 ++++---- src/qt/splashscreen.cpp | 10 +++++----- src/qt/walletmodel.cpp | 16 ++++++++-------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9d127bae75..730b2a3732 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -155,21 +155,21 @@ struct CMainSignals { } void RegisterWallet(CWalletInterface* pwalletIn) { - g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - g_signals.EraseTransaction.connect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, std::placeholders::_1)); - g_signals.UpdatedTransaction.connect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, std::placeholders::_1)); - g_signals.SetBestChain.connect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, std::placeholders::_1)); - g_signals.Inventory.connect(boost::bind(&CWalletInterface::Inventory, pwalletIn, std::placeholders::_1)); + g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3)); + g_signals.EraseTransaction.connect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, _1)); + g_signals.UpdatedTransaction.connect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, _1)); + g_signals.SetBestChain.connect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, _1)); + g_signals.Inventory.connect(boost::bind(&CWalletInterface::Inventory, pwalletIn, _1)); g_signals.Broadcast.connect(boost::bind(&CWalletInterface::ResendWalletTransactions, pwalletIn)); } void UnregisterWallet(CWalletInterface* pwalletIn) { g_signals.Broadcast.disconnect(boost::bind(&CWalletInterface::ResendWalletTransactions, pwalletIn)); - g_signals.Inventory.disconnect(boost::bind(&CWalletInterface::Inventory, pwalletIn, std::placeholders::_1)); - g_signals.SetBestChain.disconnect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, std::placeholders::_1)); - g_signals.UpdatedTransaction.disconnect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, std::placeholders::_1)); - g_signals.EraseTransaction.disconnect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, std::placeholders::_1)); - g_signals.SyncTransaction.disconnect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + g_signals.Inventory.disconnect(boost::bind(&CWalletInterface::Inventory, pwalletIn, _1)); + g_signals.SetBestChain.disconnect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, _1)); + g_signals.UpdatedTransaction.disconnect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, _1)); + g_signals.EraseTransaction.disconnect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, _1)); + g_signals.SyncTransaction.disconnect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3)); } void UnregisterAllWallets() { diff --git a/src/qt/bitmarkgui.cpp b/src/qt/bitmarkgui.cpp index 112e46c9fb..62972c1ce4 100644 --- a/src/qt/bitmarkgui.cpp +++ b/src/qt/bitmarkgui.cpp @@ -967,11 +967,11 @@ static bool ThreadSafeMessageBox(BitmarkGUI *gui, const std::string& message, co void BitmarkGUI::subscribeToCoreSignals() { // Connect signals to client - uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); } void BitmarkGUI::unsubscribeFromCoreSignals() { // Disconnect signals from client - uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); } diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 3c6b406fed..1ba8be5e33 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -225,14 +225,14 @@ void ClientModel::subscribeToCoreSignals() { // Connect signals to client uiInterface.NotifyBlocksChanged.connect(boost::bind(NotifyBlocksChanged, this)); - uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, std::placeholders::_1)); - uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this, std::placeholders::_1, std::placeholders::_2)); + uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1)); + uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this, _1, _2)); } void ClientModel::unsubscribeFromCoreSignals() { // Disconnect signals from client uiInterface.NotifyBlocksChanged.disconnect(boost::bind(NotifyBlocksChanged, this)); - uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, std::placeholders::_1)); - uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this, std::placeholders::_1, std::placeholders::_2)); + uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1)); + uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this, _1, _2)); } diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 34cb5a4ec7..adbd7e4e89 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -124,25 +124,25 @@ static void ShowProgress(SplashScreen *splash, const std::string &title, int nPr #ifdef ENABLE_WALLET static void ConnectWallet(SplashScreen *splash, CWallet* wallet) { - wallet->ShowProgress.connect(boost::bind(ShowProgress, splash, std::placeholders::_1, std::placeholders::_2)); + wallet->ShowProgress.connect(boost::bind(ShowProgress, splash, _1, _2)); } #endif void SplashScreen::subscribeToCoreSignals() { // Connect signals to client - uiInterface.InitMessage.connect(boost::bind(InitMessage, this, std::placeholders::_1)); + uiInterface.InitMessage.connect(boost::bind(InitMessage, this, _1)); #ifdef ENABLE_WALLET - uiInterface.LoadWallet.connect(boost::bind(ConnectWallet, this, std::placeholders::_1)); + uiInterface.LoadWallet.connect(boost::bind(ConnectWallet, this, _1)); #endif } void SplashScreen::unsubscribeFromCoreSignals() { // Disconnect signals from client - uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, std::placeholders::_1)); + uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1)); #ifdef ENABLE_WALLET if(pwalletMain) - pwalletMain->ShowProgress.disconnect(boost::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2)); + pwalletMain->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); #endif } diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 09b3f78cb0..c1ab74e929 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -500,19 +500,19 @@ static void ShowProgress(WalletModel *walletmodel, const std::string &title, int void WalletModel::subscribeToCoreSignals() { // Connect signals to wallet - wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, std::placeholders::_1)); - wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6)); - wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - wallet->ShowProgress.connect(boost::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2)); + wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1)); + wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); + wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); + wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); } void WalletModel::unsubscribeFromCoreSignals() { // Disconnect signals from wallet - wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, std::placeholders::_1)); - wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6)); - wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2)); + wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1)); + wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); + wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); + wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); } // WalletModel::UnlockContext implementation From e42476f0a7b6e3986178696d6e866a9d03c18c17 Mon Sep 17 00:00:00 2001 From: Jimmy Pound Date: Fri, 2 Aug 2024 12:26:48 +0200 Subject: [PATCH 2/2] Fix for the bug when the node returns incorrect block headers for equihash and cryptonight blocks when "getheaders" are requested. --- src/core.h | 10 ++++++++++ src/txdb.cpp | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core.h b/src/core.h index 6ec7ad9e52..d3445080f2 100644 --- a/src/core.h +++ b/src/core.h @@ -751,6 +751,11 @@ class CBlock : public CBlockHeader block.nTime = nTime; block.nBits = nBits; block.nNonce = nNonce; + block.nNonce256 = nNonce256; + block.nSolution = nSolution; + block.hashReserved = hashReserved; + block.auxpow = auxpow; + return block; } @@ -963,6 +968,11 @@ class CBlockIndex block.nTime = nTime; block.nBits = nBits; block.nNonce = nNonce; + block.nNonce256 = nNonce256; + block.nSolution = nSolution; + block.hashReserved = hashReserved; + block.auxpow = pauxpow; + return block; } diff --git a/src/txdb.cpp b/src/txdb.cpp index 6a0bc49fad..e644194bc3 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -208,7 +208,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts() // Construct block index object CBlockIndex* pindexNew = InsertBlockIndex(diskindex.GetBlockHash()); pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev); - pindexNew->pauxpow = diskindex.pauxpow; + pindexNew->pauxpow = diskindex.pauxpow; pindexNew->nHeight = diskindex.nHeight; pindexNew->nMoneySupply = diskindex.nMoneySupply; pindexNew->nFile = diskindex.nFile; @@ -221,6 +221,9 @@ bool CBlockTreeDB::LoadBlockIndexGuts() pindexNew->nNonce = diskindex.nNonce; pindexNew->nStatus = diskindex.nStatus; pindexNew->nTx = diskindex.nTx; + pindexNew->nNonce256 = diskindex.nNonce256; + pindexNew->nSolution = diskindex.nSolution; + pindexNew->hashReserved = diskindex.hashReserved; if (!pindexNew->CheckIndex()) return error("LoadBlockIndex() : CheckIndex failed: %s", pindexNew->ToString());