diff options
-rw-r--r-- | src/bloom.cpp | 11 | ||||
-rw-r--r-- | src/bloom.h | 4 | ||||
-rw-r--r-- | src/init.cpp | 12 | ||||
-rw-r--r-- | src/interfaces/node.cpp | 22 | ||||
-rw-r--r-- | src/noui.cpp | 6 | ||||
-rw-r--r-- | src/script/sign.h | 16 | ||||
-rw-r--r-- | src/streams.h | 1 | ||||
-rw-r--r-- | src/ui_interface.cpp | 52 | ||||
-rw-r--r-- | src/ui_interface.h | 37 | ||||
-rw-r--r-- | src/wallet/rpcwallet.cpp | 5 | ||||
-rw-r--r-- | test/functional/data/rpc_psbt.json | 3 | ||||
-rwxr-xr-x | test/functional/example_test.py | 2 | ||||
-rw-r--r-- | test/functional/test_framework/netutil.py | 2 |
13 files changed, 112 insertions, 61 deletions
diff --git a/src/bloom.cpp b/src/bloom.cpp index 24eebe2e3e..94aae742f1 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -38,17 +38,6 @@ CBloomFilter::CBloomFilter(const unsigned int nElements, const double nFPRate, c { } -// Private constructor used by CRollingBloomFilter -CBloomFilter::CBloomFilter(const unsigned int nElements, const double nFPRate, const unsigned int nTweakIn) : - vData((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)) / 8), - isFull(false), - isEmpty(true), - nHashFuncs((unsigned int)(vData.size() * 8 / nElements * LN2)), - nTweak(nTweakIn), - nFlags(BLOOM_UPDATE_NONE) -{ -} - inline unsigned int CBloomFilter::Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const { // 0xFBA4C795 chosen as it guarantees a reasonable bit difference between nHashNum values. diff --git a/src/bloom.h b/src/bloom.h index e136fcebfc..7d3aa878b0 100644 --- a/src/bloom.h +++ b/src/bloom.h @@ -53,10 +53,6 @@ private: unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const; - // Private constructor for CRollingBloomFilter, no restrictions on size - CBloomFilter(const unsigned int nElements, const double nFPRate, const unsigned int nTweak); - friend class CRollingBloomFilter; - public: /** * Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements diff --git a/src/init.cpp b/src/init.cpp index 482107c06f..2131a6adc0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -328,12 +328,12 @@ static void registerSignalHandler(int signal, void(*handler)(int)) static void OnRPCStarted() { - uiInterface.NotifyBlockTip.connect(&RPCNotifyBlockChange); + uiInterface.NotifyBlockTip_connect(&RPCNotifyBlockChange); } static void OnRPCStopped() { - uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange); + uiInterface.NotifyBlockTip_disconnect(&RPCNotifyBlockChange); RPCNotifyBlockChange(false, nullptr); g_best_block_cv.notify_all(); LogPrint(BCLog::RPC, "RPC stopped.\n"); @@ -1287,7 +1287,7 @@ bool AppInitMain() */ if (gArgs.GetBoolArg("-server", false)) { - uiInterface.InitMessage.connect(SetRPCWarmupStatus); + uiInterface.InitMessage_connect(SetRPCWarmupStatus); if (!AppInitServers()) return InitError(_("Unable to start HTTP server. See debug log for details.")); } @@ -1644,13 +1644,13 @@ bool AppInitMain() // Either install a handler to notify us when genesis activates, or set fHaveGenesis directly. // No locking, as this happens before any background thread is started. if (chainActive.Tip() == nullptr) { - uiInterface.NotifyBlockTip.connect(BlockNotifyGenesisWait); + uiInterface.NotifyBlockTip_connect(BlockNotifyGenesisWait); } else { fHaveGenesis = true; } if (gArgs.IsArgSet("-blocknotify")) - uiInterface.NotifyBlockTip.connect(BlockNotifyCallback); + uiInterface.NotifyBlockTip_connect(BlockNotifyCallback); std::vector<fs::path> vImportFiles; for (const std::string& strFile : gArgs.GetArgs("-loadblock")) { @@ -1668,7 +1668,7 @@ bool AppInitMain() while (!fHaveGenesis && !ShutdownRequested()) { condvar_GenesisWait.wait_for(lock, std::chrono::milliseconds(500)); } - uiInterface.NotifyBlockTip.disconnect(BlockNotifyGenesisWait); + uiInterface.NotifyBlockTip_disconnect(BlockNotifyGenesisWait); } if (ShutdownRequested()) { diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index 106dd38f60..1da58fe487 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -233,44 +233,44 @@ class NodeImpl : public Node } std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override { - return MakeHandler(::uiInterface.InitMessage.connect(fn)); + return MakeHandler(::uiInterface.InitMessage_connect(fn)); } std::unique_ptr<Handler> handleMessageBox(MessageBoxFn fn) override { - return MakeHandler(::uiInterface.ThreadSafeMessageBox.connect(fn)); + return MakeHandler(::uiInterface.ThreadSafeMessageBox_connect(fn)); } std::unique_ptr<Handler> handleQuestion(QuestionFn fn) override { - return MakeHandler(::uiInterface.ThreadSafeQuestion.connect(fn)); + return MakeHandler(::uiInterface.ThreadSafeQuestion_connect(fn)); } std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) override { - return MakeHandler(::uiInterface.ShowProgress.connect(fn)); + return MakeHandler(::uiInterface.ShowProgress_connect(fn)); } std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) override { CHECK_WALLET( - return MakeHandler(::uiInterface.LoadWallet.connect([fn](std::shared_ptr<CWallet> wallet) { fn(MakeWallet(wallet)); }))); + return MakeHandler(::uiInterface.LoadWallet_connect([fn](std::shared_ptr<CWallet> wallet) { fn(MakeWallet(wallet)); }))); } std::unique_ptr<Handler> handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn) override { - return MakeHandler(::uiInterface.NotifyNumConnectionsChanged.connect(fn)); + return MakeHandler(::uiInterface.NotifyNumConnectionsChanged_connect(fn)); } std::unique_ptr<Handler> handleNotifyNetworkActiveChanged(NotifyNetworkActiveChangedFn fn) override { - return MakeHandler(::uiInterface.NotifyNetworkActiveChanged.connect(fn)); + return MakeHandler(::uiInterface.NotifyNetworkActiveChanged_connect(fn)); } std::unique_ptr<Handler> handleNotifyAlertChanged(NotifyAlertChangedFn fn) override { - return MakeHandler(::uiInterface.NotifyAlertChanged.connect(fn)); + return MakeHandler(::uiInterface.NotifyAlertChanged_connect(fn)); } std::unique_ptr<Handler> handleBannedListChanged(BannedListChangedFn fn) override { - return MakeHandler(::uiInterface.BannedListChanged.connect(fn)); + return MakeHandler(::uiInterface.BannedListChanged_connect(fn)); } std::unique_ptr<Handler> handleNotifyBlockTip(NotifyBlockTipFn fn) override { - return MakeHandler(::uiInterface.NotifyBlockTip.connect([fn](bool initial_download, const CBlockIndex* block) { + return MakeHandler(::uiInterface.NotifyBlockTip_connect([fn](bool initial_download, const CBlockIndex* block) { fn(initial_download, block->nHeight, block->GetBlockTime(), GuessVerificationProgress(Params().TxData(), block)); })); @@ -278,7 +278,7 @@ class NodeImpl : public Node std::unique_ptr<Handler> handleNotifyHeaderTip(NotifyHeaderTipFn fn) override { return MakeHandler( - ::uiInterface.NotifyHeaderTip.connect([fn](bool initial_download, const CBlockIndex* block) { + ::uiInterface.NotifyHeaderTip_connect([fn](bool initial_download, const CBlockIndex* block) { fn(initial_download, block->nHeight, block->GetBlockTime(), GuessVerificationProgress(Params().TxData(), block)); })); diff --git a/src/noui.cpp b/src/noui.cpp index 59eec19c2c..e6d01e7b26 100644 --- a/src/noui.cpp +++ b/src/noui.cpp @@ -52,7 +52,7 @@ static void noui_InitMessage(const std::string& message) void noui_connect() { // Connect bitcoind signal handlers - uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox); - uiInterface.ThreadSafeQuestion.connect(noui_ThreadSafeQuestion); - uiInterface.InitMessage.connect(noui_InitMessage); + uiInterface.ThreadSafeMessageBox_connect(noui_ThreadSafeMessageBox); + uiInterface.ThreadSafeQuestion_connect(noui_ThreadSafeQuestion); + uiInterface.InitMessage_connect(noui_InitMessage); } diff --git a/src/script/sign.h b/src/script/sign.h index d2033af731..7ade715ee2 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -223,7 +223,8 @@ struct PSBTInput // If there is a non-witness utxo, then don't add the witness one. if (non_witness_utxo) { SerializeToVector(s, PSBT_IN_NON_WITNESS_UTXO); - SerializeToVector(s, non_witness_utxo); + OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS); + SerializeToVector(os, non_witness_utxo); } else if (!witness_utxo.IsNull()) { SerializeToVector(s, PSBT_IN_WITNESS_UTXO); SerializeToVector(s, witness_utxo); @@ -297,13 +298,17 @@ struct PSBTInput // Do stuff based on type switch(type) { case PSBT_IN_NON_WITNESS_UTXO: + { if (non_witness_utxo) { throw std::ios_base::failure("Duplicate Key, input non-witness utxo already provided"); } else if (key.size() != 1) { throw std::ios_base::failure("Non-witness utxo key is more than one byte type"); } - UnserializeFromVector(s, non_witness_utxo); + // Set the stream to unserialize with witness since this is always a valid network transaction + OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() & ~SERIALIZE_TRANSACTION_NO_WITNESS); + UnserializeFromVector(os, non_witness_utxo); break; + } case PSBT_IN_WITNESS_UTXO: if (!witness_utxo.IsNull()) { throw std::ios_base::failure("Duplicate Key, input witness utxo already provided"); @@ -547,7 +552,8 @@ struct PartiallySignedTransaction SerializeToVector(s, PSBT_GLOBAL_UNSIGNED_TX); // Write serialized tx to a stream - SerializeToVector(s, *tx); + OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS); + SerializeToVector(os, *tx); // Write the unknown things for (auto& entry : unknown) { @@ -601,7 +607,9 @@ struct PartiallySignedTransaction throw std::ios_base::failure("Global unsigned tx key is more than one byte type"); } CMutableTransaction mtx; - UnserializeFromVector(s, mtx); + // Set the stream to serialize with non-witness since this should always be non-witness + OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS); + UnserializeFromVector(os, mtx); tx = std::move(mtx); // Make sure that all scriptSigs and scriptWitnesses are empty for (const CTxIn& txin : tx->vin) { diff --git a/src/streams.h b/src/streams.h index 2dcca6646d..096ebfc9c2 100644 --- a/src/streams.h +++ b/src/streams.h @@ -61,6 +61,7 @@ public: int GetVersion() const { return nVersion; } int GetType() const { return nType; } + size_t size() const { return stream->size(); } }; template<typename S> diff --git a/src/ui_interface.cpp b/src/ui_interface.cpp index 336d193b4e..22b4768059 100644 --- a/src/ui_interface.cpp +++ b/src/ui_interface.cpp @@ -5,8 +5,60 @@ #include <ui_interface.h> #include <util.h> +#include <boost/signals2/last_value.hpp> +#include <boost/signals2/signal.hpp> + CClientUIInterface uiInterface; +struct UISignals { + boost::signals2::signal<CClientUIInterface::ThreadSafeMessageBoxSig, boost::signals2::last_value<bool>> ThreadSafeMessageBox; + boost::signals2::signal<CClientUIInterface::ThreadSafeQuestionSig, boost::signals2::last_value<bool>> ThreadSafeQuestion; + boost::signals2::signal<CClientUIInterface::InitMessageSig> InitMessage; + boost::signals2::signal<CClientUIInterface::NotifyNumConnectionsChangedSig> NotifyNumConnectionsChanged; + boost::signals2::signal<CClientUIInterface::NotifyNetworkActiveChangedSig> NotifyNetworkActiveChanged; + boost::signals2::signal<CClientUIInterface::NotifyAlertChangedSig> NotifyAlertChanged; + boost::signals2::signal<CClientUIInterface::LoadWalletSig> LoadWallet; + boost::signals2::signal<CClientUIInterface::ShowProgressSig> ShowProgress; + boost::signals2::signal<CClientUIInterface::NotifyBlockTipSig> NotifyBlockTip; + boost::signals2::signal<CClientUIInterface::NotifyHeaderTipSig> NotifyHeaderTip; + boost::signals2::signal<CClientUIInterface::BannedListChangedSig> BannedListChanged; +} g_ui_signals; + +#define ADD_SIGNALS_IMPL_WRAPPER(signal_name) \ + boost::signals2::connection CClientUIInterface::signal_name##_connect(std::function<signal_name##Sig> fn) \ + { \ + return g_ui_signals.signal_name.connect(fn); \ + } \ + void CClientUIInterface::signal_name##_disconnect(std::function<signal_name##Sig> fn) \ + { \ + return g_ui_signals.signal_name.disconnect(&fn); \ + } + +ADD_SIGNALS_IMPL_WRAPPER(ThreadSafeMessageBox); +ADD_SIGNALS_IMPL_WRAPPER(ThreadSafeQuestion); +ADD_SIGNALS_IMPL_WRAPPER(InitMessage); +ADD_SIGNALS_IMPL_WRAPPER(NotifyNumConnectionsChanged); +ADD_SIGNALS_IMPL_WRAPPER(NotifyNetworkActiveChanged); +ADD_SIGNALS_IMPL_WRAPPER(NotifyAlertChanged); +ADD_SIGNALS_IMPL_WRAPPER(LoadWallet); +ADD_SIGNALS_IMPL_WRAPPER(ShowProgress); +ADD_SIGNALS_IMPL_WRAPPER(NotifyBlockTip); +ADD_SIGNALS_IMPL_WRAPPER(NotifyHeaderTip); +ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged); + +bool CClientUIInterface::ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, caption, style); } +bool CClientUIInterface::ThreadSafeQuestion(const std::string& message, const std::string& non_interactive_message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, caption, style); } +void CClientUIInterface::InitMessage(const std::string& message) { return g_ui_signals.InitMessage(message); } +void CClientUIInterface::NotifyNumConnectionsChanged(int newNumConnections) { return g_ui_signals.NotifyNumConnectionsChanged(newNumConnections); } +void CClientUIInterface::NotifyNetworkActiveChanged(bool networkActive) { return g_ui_signals.NotifyNetworkActiveChanged(networkActive); } +void CClientUIInterface::NotifyAlertChanged() { return g_ui_signals.NotifyAlertChanged(); } +void CClientUIInterface::LoadWallet(std::shared_ptr<CWallet> wallet) { return g_ui_signals.LoadWallet(wallet); } +void CClientUIInterface::ShowProgress(const std::string& title, int nProgress, bool resume_possible) { return g_ui_signals.ShowProgress(title, nProgress, resume_possible); } +void CClientUIInterface::NotifyBlockTip(bool b, const CBlockIndex* i) { return g_ui_signals.NotifyBlockTip(b, i); } +void CClientUIInterface::NotifyHeaderTip(bool b, const CBlockIndex* i) { return g_ui_signals.NotifyHeaderTip(b, i); } +void CClientUIInterface::BannedListChanged() { return g_ui_signals.BannedListChanged(); } + + bool InitError(const std::string& str) { uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR); diff --git a/src/ui_interface.h b/src/ui_interface.h index a570573991..992c585b10 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -6,15 +6,18 @@ #ifndef BITCOIN_UI_INTERFACE_H #define BITCOIN_UI_INTERFACE_H +#include <functional> #include <memory> #include <stdint.h> #include <string> -#include <boost/signals2/last_value.hpp> -#include <boost/signals2/signal.hpp> - class CWallet; class CBlockIndex; +namespace boost { +namespace signals2 { +class connection; +} +} // namespace boost /** General change type (added, updated, removed). */ enum ChangeType @@ -72,43 +75,49 @@ public: MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL) }; +#define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, args...) \ + rtype signal_name(args); \ + using signal_name##Sig = rtype(args); \ + boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn); \ + void signal_name##_disconnect(std::function<signal_name##Sig> fn); + /** Show message box. */ - boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox; + ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const std::string& message, const std::string& caption, unsigned int style); /** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */ - boost::signals2::signal<bool (const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeQuestion; + ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style); /** Progress message during initialization. */ - boost::signals2::signal<void (const std::string &message)> InitMessage; + ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message); /** Number of network connections changed. */ - boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged; + ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections); /** Network activity state changed. */ - boost::signals2::signal<void (bool networkActive)> NotifyNetworkActiveChanged; + ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive); /** * Status bar alerts changed. */ - boost::signals2::signal<void ()> NotifyAlertChanged; + ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, ); /** A wallet has been loaded. */ - boost::signals2::signal<void (std::shared_ptr<CWallet> wallet)> LoadWallet; + ADD_SIGNALS_DECL_WRAPPER(LoadWallet, void, std::shared_ptr<CWallet> wallet); /** * Show progress e.g. for verifychain. * resume_possible indicates shutting down now will result in the current progress action resuming upon restart. */ - boost::signals2::signal<void (const std::string &title, int nProgress, bool resume_possible)> ShowProgress; + ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible); /** New block has been accepted */ - boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyBlockTip; + ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, bool, const CBlockIndex*); /** Best header has changed */ - boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyHeaderTip; + ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, bool, const CBlockIndex*); /** Banlist did change. */ - boost::signals2::signal<void (void)> BannedListChanged; + ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void); }; /** Show warning message **/ diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 4aed097364..281fd46146 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4547,11 +4547,6 @@ bool FillPSBT(const CWallet* pwallet, PartiallySignedTransaction& psbtx, const C const CTxOut& out = txConst->vout.at(i); PSBTOutput& psbt_out = psbtx.outputs.at(i); - // Dummy tx so we can use ProduceSignature to get stuff out - CMutableTransaction dummy_tx; - dummy_tx.vin.push_back(CTxIn()); - dummy_tx.vout.push_back(CTxOut()); - // Fill a SignatureData with output info SignatureData sigdata; psbt_out.FillSignatureData(sigdata); diff --git a/test/functional/data/rpc_psbt.json b/test/functional/data/rpc_psbt.json index 70388841d1..9f970b4961 100644 --- a/test/functional/data/rpc_psbt.json +++ b/test/funct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FkHwhwAAAAAAAA==" ], "creator" : [ { diff --git a/test/functional/example_test.py b/test/functional/example_test.py index 714d977380..a8c1474876 100755 --- a/test/functional/example_test.py +++ b/test/functional/example_test.py @@ -15,8 +15,8 @@ from collections import defaultdict # Avoid wildcard * imports if possible from test_framework.blocktools import (create_block, create_coinbase) +from test_framework.messages import CInv from test_framework.mininode import ( - CInv, P2PInterface, mininode_lock, msg_block, diff --git a/test/functional/test_framework/netutil.py b/test/functional/test_framework/netutil.py index 5f1613d668..45c182f630 100644 --- a/test/functional/test_framework/netutil.py +++ b/test/functional/test_framework/netutil.py @@ -107,7 +107,7 @@ def all_interfaces(): max_possible *= 2 else: break - namestr = names.tostring() + namestr = names.tobytes() return [(namestr[i:i+16].split(b'\0', 1)[0], socket.inet_ntoa(namestr[i+20:i+24])) for i in range(0, outbytes, struct_size)] |