From 6e7b402fe9e787aa10038ea89d80e255b6f6d79d Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 28 Apr 2023 10:09:46 +0100 Subject: [PATCH 1/4] partial Merge bitcoin/bitcoin#27483: Bump python minimum version to 3.8 fac395e5eb2cd3210ba6345f777a586a9bec84e3 ci: Bump ci/lint/Dockerfile (MarcoFalke) fa6eb6516727a8675dc6e46634d8343e282528ab test: Use python3.8 pow() (MarcoFalke) 88881cf7ac029aea660c2413ca8e2a5136fcd41b Bump python minimum version to 3.8 (MarcoFalke) Pull request description: There is no pressing reason to drop support for 3.7, however there are several maintenance issues: * There is no supported operating system that ships 3.7 by default. (debian:buster is EOL and unmaintained to the extent that it doesn't run in the CI environment. See https://github.com/bitcoin/bitcoin/pull/27340#issuecomment-1484988445) * Compiling python 3.7 from source is also unsupported on at least macos, according to https://github.com/bitcoin/bitcoin/pull/24017#issuecomment-1107820790 * Recent versions of lief require 3.8, see https://github.com/bitcoin/bitcoin/pull/27507#issuecomment-1517561645 Fix all maintenance issues by bumping the minimum. ACKs for top commit: RandyMcMillan: ACK fac395e fjahr: ACK fac395e5eb2cd3210ba6345f777a586a9bec84e3 fanquake: ACK fac395e5eb2cd3210ba6345f777a586a9bec84e3 Tree-SHA512: c198decdbbe29d186d73ea3f6549d8a38479383495d14a965a2f9211ce39637b43f13a4c2a5d3bf56e2d468be4bbe49b4ee8e8e19ec69936ff43ddf2b714c712 --- test/functional/test_framework/util.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 6619b0c750..ac6703174d 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -613,18 +613,7 @@ def modinv(a, n): """Compute the modular inverse of a modulo n using the extended Euclidean Algorithm. See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integers. """ - # TODO: Change to pow(a, -1, n) available in Python 3.8 - t1, t2 = 0, 1 - r1, r2 = n, a - while r2 != 0: - q = r1 // r2 - t1, t2 = t2, t1 - q * t2 - r1, r2 = r2, r1 - q * r2 - if r1 > 1: - return None - if t1 < 0: - t1 += n - return t1 + return pow(a, -1, n) class TestFrameworkUtil(unittest.TestCase): def test_modinv(self): From bbcb2d39987d552b428391b880bf3b037bfa1837 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Thu, 14 Apr 2022 09:40:30 +0200 Subject: [PATCH 2/4] Merge bitcoin/bitcoin#23416: doc: Remove fee delta TODO from txmempool.cpp fa32cc0682a0aa3420e6a11031721fcb6c50fa44 doc: Remove fee delta TODO from txmempool.cpp (MarcoFalke) Pull request description: This refactor request was added in commit eb306664e786ae43d539fde66f0fbe2a3e89d910, though it didn't explain why the refactor is needed and what the goal is. Given that this wasn't touched for more than 5 years, it doesn't seem critical. Generally, non-trivial `TODO`s make more sense as GitHub issues, so that they can be discussed and triaged more easily. ACKs for top commit: laanwj: Code review ACK fa32cc0682a0aa3420e6a11031721fcb6c50fa44 Tree-SHA512: 6629fef543e815136c82c38aa8ba2c4de68a5fe94c6954f2559e468f7e59052e02dd7c221d3b159be0314eaf0dbb18f74814297c58f76e2289c47e8d4f49be4e --- src/txmempool.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index ee7a2cf549..1374c5df19 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -366,8 +366,6 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces mapLinks.insert(make_pair(newit, TxLinks())); // Update transaction for any feeDelta created by PrioritiseTransaction - // TODO: refactor so that the fee delta is calculated before inserting - // into mapTx. CAmount delta{0}; ApplyDelta(entry.GetTx().GetHash(), delta); if (delta) { From 01adc81ebff38b5e4a34a74a59488b317bc801d1 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 21 May 2020 10:58:07 -0400 Subject: [PATCH 3/4] Merge #18997: gui: Remove un-actionable TODO 4444dbf4d5047dd1c92973f7167a74a0779e61a3 gui: Remove un-actionable TODO (MarcoFalke) Pull request description: With encryption turned on by default for all wallets in consideration (#18889), I believe that wallet decryption will not be implemented ever or at least any time soon. So remove that TODO comment for now. If deemed important, a brainstorming issue can be opened instead. Also remove some TODOs in the RPC console, which I don't understand. Maybe the gui was meant to show the debug log interactively? In any case, if deemed important, this should be filed as a brainstorming feature request, so that trade-offs of different solutions can be discussed. ACKs for top commit: laanwj: Thanks. ACK 4444dbf4d5047dd1c92973f7167a74a0779e61a3 achow101: ACK 4444dbf4d5047dd1c92973f7167a74a0779e61a3 Tree-SHA512: f7ddb37a14178f575da5409ea1c34e34bde37d79b2b56eaaf606a069e2b91c9d7b734529f5c68664b2fa5aa831117c8d19cce823743671cd6c31b81d68b8c70c --- src/qt/bitcoingui.cpp | 6 +++--- src/qt/rpcconsole.cpp | 5 +---- src/qt/walletmodel.cpp | 10 ++-------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 03ef6acbc0..641f0b25db 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1814,7 +1814,7 @@ void BitcoinGUI::setEncryptionStatus(int status) changePassphraseAction->setEnabled(true); unlockWalletAction->setVisible(false); lockWalletAction->setVisible(true); - encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported + encryptWalletAction->setEnabled(false); break; case WalletModel::UnlockedForMixingOnly: labelWalletEncryptionIcon->show(); @@ -1823,7 +1823,7 @@ void BitcoinGUI::setEncryptionStatus(int status) changePassphraseAction->setEnabled(true); unlockWalletAction->setVisible(true); lockWalletAction->setVisible(true); - encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported + encryptWalletAction->setEnabled(false); break; case WalletModel::Locked: labelWalletEncryptionIcon->show(); @@ -1832,7 +1832,7 @@ void BitcoinGUI::setEncryptionStatus(int status) changePassphraseAction->setEnabled(true); unlockWalletAction->setVisible(true); lockWalletAction->setVisible(false); - encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported + encryptWalletAction->setEnabled(false); break; } } diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 0770dc94de..4c1514874c 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -40,17 +40,14 @@ #include #include #include -#include #include +#include #include #include #include #include #include -// TODO: add a scrollback limit, as there is currently none -// TODO: make it possible to filter out categories (esp debug messages when implemented) -// TODO: receive errors and debug messages through ClientModel const int CONSOLE_HISTORY = 50; const QSize FONT_RANGE(4, 40); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index da0ebe9a4b..b1896ef887 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -363,16 +363,10 @@ WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase) { - if(encrypted) - { - // Encrypt + if (encrypted) { return m_wallet->encryptWallet(passphrase); } - else - { - // Decrypt -- TODO; not supported yet - return false; - } + return false; } bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase, bool fMixing) From 0fa3aa65caf4457b5652b762e2cb2cacb281e169 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 20 May 2020 07:27:49 -0400 Subject: [PATCH 4/4] Merge #18996: net: Remove un-actionable TODO fabea6d404571d046365f4f083da3569d2cbf4f7 net: Run clang-format on protocol.h (MarcoFalke) facdeea2b25ef36e37b6ada58ea390a72d11a4b2 net: Remove un-actionable TODO (MarcoFalke) Pull request description: The first commit removes a TODO that is infeasible to solve. Currently, most (de)serializable classes in Bitcoin Core have public members. For example `CMessageHeader`, `FlatFilePos`, `CBlock`, `CTransaction`, `CCoin`, ... So either this TODO comment should apply to all classes or to none. Fix that discrepancy by removing it from the source code for now. If deemed important, the TODO can be discussed in a brainstorming issue later. Also run clang format on the header file in a new commit. Happy to drop this commit if it is too controversial, but I think it is trivial to review and makes the workflow of developers using clang-format-diff easier. ACKs for top commit: practicalswift: ACK fabea6d404571d046365f4f083da3569d2cbf4f7 naumenkogs: ACK fabea6d. Not sure why that TODO was there in the first place, but Marco's justification seems correct. hebasto: ACK fabea6d404571d046365f4f083da3569d2cbf4f7, agree with both changes: removing TODO and applying the `clang-format-diff.py`. Tree-SHA512: b79ae07be27e5a40fc9f411a5e9ae91aecb2fdedbcbf74699614a1004f4ef816bf396903ec6c06eb1395fd83a2047620c7583acbaadfb8c4e613319a63062c3c --- src/protocol.h | 150 +++++++++++++++++++++++++------------------------ 1 file changed, 76 insertions(+), 74 deletions(-) diff --git a/src/protocol.h b/src/protocol.h index ebabae1be0..266382dccd 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -66,17 +66,17 @@ namespace NetMsgType { * The version message provides information about the transmitting node to the * receiving node at the beginning of a connection. */ -extern const char *VERSION; +extern const char* VERSION; /** * The verack message acknowledges a previously-received version message, * informing the connecting node that it can begin to send other messages. */ -extern const char *VERACK; +extern const char* VERACK; /** * The addr (IP address) message relays connection information for peers on the * network. */ -extern const char *ADDR; +extern const char* ADDR; /** * The addrv2 message relays connection information for peers on the network just * like the addr message, but is extended to allow gossiping of longer node @@ -93,70 +93,70 @@ extern const char *SENDADDRV2; * The inv message (inventory message) transmits one or more inventories of * objects known to the transmitting peer. */ -extern const char *INV; +extern const char* INV; /** * The getdata message requests one or more data objects from another node. */ -extern const char *GETDATA; +extern const char* GETDATA; /** * The merkleblock message is a reply to a getdata message which requested a * block using the inventory type MSG_MERKLEBLOCK. * @since protocol version 70001 as described by BIP37. */ -extern const char *MERKLEBLOCK; +extern const char* MERKLEBLOCK; /** * The getblocks message requests an inv message that provides block header * hashes starting from a particular point in the block chain. */ -extern const char *GETBLOCKS; +extern const char* GETBLOCKS; /** * The getheaders message requests a headers message that provides block * headers starting from a particular point in the block chain. * @since protocol version 31800. */ -extern const char *GETHEADERS; +extern const char* GETHEADERS; /** * The tx message transmits a single transaction. */ -extern const char *TX; +extern const char* TX; /** * The headers message sends one or more block headers to a node which * previously requested certain headers with a getheaders message. * @since protocol version 31800. */ -extern const char *HEADERS; +extern const char* HEADERS; /** * The block message transmits a single serialized block. */ -extern const char *BLOCK; +extern const char* BLOCK; /** * The getaddr message requests an addr message from the receiving node, * preferably one with lots of IP addresses of other receiving nodes. */ -extern const char *GETADDR; +extern const char* GETADDR; /** * The mempool message requests the TXIDs of transactions that the receiving * node has verified as valid but which have not yet appeared in a block. * @since protocol version 60002. */ -extern const char *MEMPOOL; +extern const char* MEMPOOL; /** * The ping message is sent periodically to help confirm that the receiving * peer is still connected. */ -extern const char *PING; +extern const char* PING; /** * The pong message replies to a ping message, proving to the pinging node that * the ponging node is still alive. * @since protocol version 60001 as described by BIP31. */ -extern const char *PONG; +extern const char* PONG; /** * The notfound message is a reply to a getdata message which requested an * object the receiving node does not have available for relay. * @since protocol version 70001. */ -extern const char *NOTFOUND; +extern const char* NOTFOUND; /** * The filterload message tells the receiving peer to filter all relayed * transactions and requested merkle blocks through the provided filter. @@ -164,7 +164,7 @@ extern const char *NOTFOUND; * Only available with service bit NODE_BLOOM since protocol version * 70011 as described by BIP111. */ -extern const char *FILTERLOAD; +extern const char* FILTERLOAD; /** * The filteradd message tells the receiving peer to add a single element to a * previously-set bloom filter, such as a new public key. @@ -172,7 +172,7 @@ extern const char *FILTERLOAD; * Only available with service bit NODE_BLOOM since protocol version * 70011 as described by BIP111. */ -extern const char *FILTERADD; +extern const char* FILTERADD; /** * The filterclear message tells the receiving peer to remove a previously-set * bloom filter. @@ -180,13 +180,13 @@ extern const char *FILTERADD; * Only available with service bit NODE_BLOOM since protocol version * 70011 as described by BIP111. */ -extern const char *FILTERCLEAR; +extern const char* FILTERCLEAR; /** * Indicates that a node prefers to receive new block announcements via a * "headers" message rather than an "inv". * @since protocol version 70012 as described by BIP130. */ -extern const char *SENDHEADERS; +extern const char* SENDHEADERS; /** * Contains a 1-byte bool and 8-byte LE version number. @@ -195,25 +195,25 @@ extern const char *SENDHEADERS; * "cmpctblock" message rather than an "inv", depending on message contents. * @since protocol version 70209 as described by BIP 152 */ -extern const char *SENDCMPCT; +extern const char* SENDCMPCT; /** * Contains a CBlockHeaderAndShortTxIDs object - providing a header and * list of "short txids". * @since protocol version 70209 as described by BIP 152 */ -extern const char *CMPCTBLOCK; +extern const char* CMPCTBLOCK; /** * Contains a BlockTransactionsRequest * Peer should respond with "blocktxn" message. * @since protocol version 70209 as described by BIP 152 */ -extern const char *GETBLOCKTXN; +extern const char* GETBLOCKTXN; /** * Contains a BlockTransactions. * Sent in response to a "getblocktxn" message. * @since protocol version 70209 as described by BIP 152 */ -extern const char *BLOCKTXN; +extern const char* BLOCKTXN; /** * getcfilters requests compact filters for a range of blocks. * Only available with service bit NODE_COMPACT_FILTERS as described by @@ -244,61 +244,61 @@ extern const char* CFHEADERS; * Only available with service bit NODE_COMPACT_FILTERS as described by * BIP 157 & 158. */ -extern const char *GETCFCHECKPT; +extern const char* GETCFCHECKPT; /** * cfcheckpt is a response to a getcfcheckpt request containing a vector of * evenly spaced filter headers for blocks on the requested chain. */ -extern const char *CFCHECKPT; +extern const char* CFCHECKPT; // Dash message types // NOTE: do NOT declare non-implmented here, we don't want them to be exposed to the outside // TODO: add description -extern const char *SPORK; -extern const char *GETSPORKS; -extern const char *DSACCEPT; -extern const char *DSVIN; -extern const char *DSFINALTX; -extern const char *DSSIGNFINALTX; -extern const char *DSCOMPLETE; -extern const char *DSSTATUSUPDATE; -extern const char *DSTX; -extern const char *DSQUEUE; -extern const char *SENDDSQUEUE; -extern const char *SYNCSTATUSCOUNT; -extern const char *MNGOVERNANCESYNC; -extern const char *MNGOVERNANCEOBJECT; -extern const char *MNGOVERNANCEOBJECTVOTE; -extern const char *GETMNLISTDIFF; -extern const char *MNLISTDIFF; -extern const char *QSENDRECSIGS; -extern const char *QFCOMMITMENT; -extern const char *QCONTRIB; -extern const char *QCOMPLAINT; -extern const char *QJUSTIFICATION; -extern const char *QPCOMMITMENT; -extern const char *QWATCH; -extern const char *QSIGSESANN; -extern const char *QSIGSHARESINV; -extern const char *QGETSIGSHARES; -extern const char *QBSIGSHARES; -extern const char *QSIGREC; -extern const char *QSIGSHARE; +extern const char* SPORK; +extern const char* GETSPORKS; +extern const char* DSACCEPT; +extern const char* DSVIN; +extern const char* DSFINALTX; +extern const char* DSSIGNFINALTX; +extern const char* DSCOMPLETE; +extern const char* DSSTATUSUPDATE; +extern const char* DSTX; +extern const char* DSQUEUE; +extern const char* SENDDSQUEUE; +extern const char* SYNCSTATUSCOUNT; +extern const char* MNGOVERNANCESYNC; +extern const char* MNGOVERNANCEOBJECT; +extern const char* MNGOVERNANCEOBJECTVOTE; +extern const char* GETMNLISTDIFF; +extern const char* MNLISTDIFF; +extern const char* QSENDRECSIGS; +extern const char* QFCOMMITMENT; +extern const char* QCONTRIB; +extern const char* QCOMPLAINT; +extern const char* QJUSTIFICATION; +extern const char* QPCOMMITMENT; +extern const char* QWATCH; +extern const char* QSIGSESANN; +extern const char* QSIGSHARESINV; +extern const char* QGETSIGSHARES; +extern const char* QBSIGSHARES; +extern const char* QSIGREC; +extern const char* QSIGSHARE; extern const char* QGETDATA; extern const char* QDATA; -extern const char *CLSIG; -extern const char *ISLOCK; -extern const char *ISDLOCK; -extern const char *MNAUTH; -extern const char *GETHEADERS2; -extern const char *SENDHEADERS2; -extern const char *HEADERS2; -extern const char *GETQUORUMROTATIONINFO; -extern const char *QUORUMROTATIONINFO; +extern const char* CLSIG; +extern const char* ISLOCK; +extern const char* ISDLOCK; +extern const char* MNAUTH; +extern const char* GETHEADERS2; +extern const char* SENDHEADERS2; +extern const char* HEADERS2; +extern const char* GETQUORUMROTATIONINFO; +extern const char* QUORUMROTATIONINFO; }; /* Get a vector of all valid message types (see above) */ -const std::vector &getAllNetMessageTypes(); +const std::vector& getAllNetMessageTypes(); /* Whether the message type violates blocks-relay-only policy */ bool NetMessageViolatesBlocksOnly(const std::string& msg_type); @@ -375,7 +375,8 @@ void SetServiceFlagsIBDCache(bool status); * == GetDesirableServiceFlags(services), ie determines whether the given * set of service flags are sufficient for a peer to be "relevant". */ -static inline bool HasAllDesirableServiceFlags(ServiceFlags services) { +static inline bool HasAllDesirableServiceFlags(ServiceFlags services) +{ return !(GetDesirableServiceFlags(services) & (~services)); } @@ -383,7 +384,8 @@ static inline bool HasAllDesirableServiceFlags(ServiceFlags services) { * Checks if a peer with the given service flags may be capable of having a * robust address-storage DB. */ -static inline bool MayHaveUsefulAddressDB(ServiceFlags services) { +static inline bool MayHaveUsefulAddressDB(ServiceFlags services) +{ return (services & NODE_NETWORK) || (services & NODE_NETWORK_LIMITED); } @@ -500,11 +502,11 @@ enum GetDataMsg { MSG_TX = 1, MSG_BLOCK = 2, // The following can only occur in getdata. Invs always use TX or BLOCK. - MSG_FILTERED_BLOCK = 3, //!< Defined in BIP37 + MSG_FILTERED_BLOCK = 3, //!< Defined in BIP37 // Dash message types // NOTE: we must keep this enum consistent and backwards compatible - /* MSG_LEGACY_TXLOCK_REQUEST = 4, */ // Legacy InstantSend and not used anymore - /* MSG_TXLOCK_VOTE = 5, */ // Legacy InstantSend and not used anymore + /* MSG_LEGACY_TXLOCK_REQUEST = 4, */ // Legacy InstantSend and not used anymore + /* MSG_TXLOCK_VOTE = 5, */ // Legacy InstantSend and not used anymore MSG_SPORK = 6, /* 7 - 15 were used in old Dash versions and were mainly budget and MN broadcast/ping related*/ MSG_DSTX = 16, @@ -513,14 +515,14 @@ enum GetDataMsg { /* 19 was used for MSG_MASTERNODE_VERIFY and is not supported anymore */ // Nodes may always request a MSG_CMPCT_BLOCK in a getdata, however, // MSG_CMPCT_BLOCK should not appear in any invs except as a part of getdata. - MSG_CMPCT_BLOCK = 20, //!< Defined in BIP152 + MSG_CMPCT_BLOCK = 20, //!< Defined in BIP152 MSG_QUORUM_FINAL_COMMITMENT = 21, - /* MSG_QUORUM_DUMMY_COMMITMENT = 22, */ // was shortly used on testnet/devnet/regtest + /* MSG_QUORUM_DUMMY_COMMITMENT = 22, */ // was shortly used on testnet/devnet/regtest MSG_QUORUM_CONTRIB = 23, MSG_QUORUM_COMPLAINT = 24, MSG_QUORUM_JUSTIFICATION = 25, MSG_QUORUM_PREMATURE_COMMITMENT = 26, - /* MSG_QUORUM_DEBUG_STATUS = 27, */ // was shortly used on testnet/devnet/regtest + /* MSG_QUORUM_DEBUG_STATUS = 27, */ // was shortly used on testnet/devnet/regtest MSG_QUORUM_RECOVERED_SIG = 28, MSG_CLSIG = 29, MSG_ISLOCK = 30,