Skip to content

Commit c30b3e9

Browse files
committed
Merge bitcoin/bitcoin#25472: build: Increase MS Visual Studio minimum version
630c171 refactor: Drop no longer needed `util/designator.h` (Hennadii Stepanov) 88ec5d4 build: Increase MS Visual Studio minimum version (Hennadii Stepanov) 555f9dd rpc, refactor: Add `decodepsbt_outputs` (Hennadii Stepanov) 0c432cb rpc, refactor: Add `decodepsbt_inputs` (Hennadii Stepanov) 01d95a3 rpc, refactor: Add `getblock_prevout` (Hennadii Stepanov) Pull request description: Visual Studio 2022 with `/std:c++20` supports [designated initializers](bitcoin/bitcoin#24531). ACKs for top commit: sipsorcery: reACK 630c171. Tree-SHA512: 5b8933940dd69061c6b077512168bebb6fea05d429b63ffbab191950798b4c825e8484b1a651db0ae13f97eae481097d3c16395659c0f3b9f847af2aaf44b65d
2 parents 081965c + 630c171 commit c30b3e9

File tree

11 files changed

+246
-257
lines changed

11 files changed

+246
-257
lines changed

build_msvc/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Building Bitcoin Core with Visual Studio
33

44
Introduction
55
---------------------
6-
Solution and project files to build Bitcoin Core with `msbuild` or Visual Studio can be found in the `build_msvc` directory. The build has been tested with Visual Studio 2022 and Visual Studio 2019 (building with earlier versions of Visual Studio should not be expected to work).
6+
Visual Studio 2022 is minimum required to build Bitcoin Core.
7+
8+
Solution and project files to build with `msbuild` or Visual Studio can be found in the `build_msvc` directory.
79

810
To build Bitcoin Core from the command-line, it is sufficient to only install the Visual Studio Build Tools component.
911

build_msvc/bitcoin_config.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
/* Define this symbol if the consensus lib has been built */
5151
#define HAVE_CONSENSUS_LIB 1
5252

53-
/* define if the compiler supports basic C++17 syntax */
54-
#define HAVE_CXX17 1
53+
/* define if the compiler supports basic C++20 syntax */
54+
#define HAVE_CXX20 1
5555

5656
/* Define to 1 if you have the declaration of `be16toh', and to 0 if you
5757
don't. */

build_msvc/common.init.vcxproj.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787
<ClCompile>
8888
<WarningLevel>Level3</WarningLevel>
8989
<PrecompiledHeader>NotUsing</PrecompiledHeader>
90-
<AdditionalOptions>/utf-8 /Zc:__cplusplus /std:c++17 %(AdditionalOptions)</AdditionalOptions>
90+
<AdditionalOptions>/utf-8 /Zc:__cplusplus /std:c++20 %(AdditionalOptions)</AdditionalOptions>
9191
<DisableSpecificWarnings>4018;4244;4267;4334;4715;4805;4834</DisableSpecificWarnings>
9292
<TreatWarningAsError>true</TreatWarningAsError>
93-
<PreprocessorDefinitions>DISABLE_DESIGNATED_INITIALIZER_ERRORS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING;ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
93+
<PreprocessorDefinitions>_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING;ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
9494
<AdditionalIncludeDirectories>..\..\src;..\..\src\minisketch\include;..\..\src\univalue\include;..\..\src\secp256k1\include;..\..\src\leveldb\include;..\..\src\leveldb\helpers\memenv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
9595
</ClCompile>
9696
<Link>

build_msvc/msvc-autogen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def set_properties(vcxproj_filename, placeholder, content):
9393
def main():
9494
parser = argparse.ArgumentParser(description='Bitcoin-core msbuild configuration initialiser.')
9595
parser.add_argument('-toolset', nargs='?', default=DEFAULT_PLATFORM_TOOLSET,
96-
help='Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019, or v143 for Visual Studio 2022.'
96+
help='Optionally sets the msbuild platform toolset, e.g. v143 for Visual Studio 2022.'
9797
' default is %s.'%DEFAULT_PLATFORM_TOOLSET)
9898
args = parser.parse_args()
9999
set_properties(os.path.join(SOURCE_DIR, '../build_msvc/common.init.vcxproj'), '@TOOLSET@', args.toolset)

src/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ BITCOIN_CORE_H = \
261261
util/bip32.h \
262262
util/bytevectorhash.h \
263263
util/check.h \
264-
util/designator.h \
265264
util/epochguard.h \
266265
util/error.h \
267266
util/fastrange.h \

src/init.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
#include <txorphanage.h>
6565
#include <util/asmap.h>
6666
#include <util/check.h>
67-
#include <util/designator.h>
6867
#include <util/moneystr.h>
6968
#include <util/strencodings.h>
7069
#include <util/string.h>
@@ -1425,8 +1424,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14251424
assert(!node.chainman);
14261425

14271426
CTxMemPool::Options mempool_opts{
1428-
Desig(estimator) node.fee_estimator.get(),
1429-
Desig(check_ratio) chainparams.DefaultConsistencyChecks() ? 1 : 0,
1427+
.estimator = node.fee_estimator.get(),
1428+
.check_ratio = chainparams.DefaultConsistencyChecks() ? 1 : 0,
14301429
};
14311430
ApplyArgsManOptions(args, mempool_opts);
14321431
mempool_opts.check_ratio = std::clamp<int>(mempool_opts.check_ratio, 0, 1'000'000);

src/net.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <protocol.h>
2727
#include <random.h>
2828
#include <scheduler.h>
29-
#include <util/designator.h>
3029
#include <util/sock.h>
3130
#include <util/strencodings.h>
3231
#include <util/syscall_sandbox.h>
@@ -876,20 +875,20 @@ bool CConnman::AttemptToEvictConnection()
876875
if (node->fDisconnect)
877876
continue;
878877
NodeEvictionCandidate candidate{
879-
Desig(id) node->GetId(),
880-
Desig(m_connected) node->m_connected,
881-
Desig(m_min_ping_time) node->m_min_ping_time,
882-
Desig(m_last_block_time) node->m_last_block_time,
883-
Desig(m_last_tx_time) node->m_last_tx_time,
884-
Desig(fRelevantServices) HasAllDesirableServiceFlags(node->nServices),
885-
Desig(m_relay_txs) node->m_relays_txs.load(),
886-
Desig(fBloomFilter) node->m_bloom_filter_loaded.load(),
887-
Desig(nKeyedNetGroup) node->nKeyedNetGroup,
888-
Desig(prefer_evict) node->m_prefer_evict,
889-
Desig(m_is_local) node->addr.IsLocal(),
890-
Desig(m_network) node->ConnectedThroughNetwork(),
891-
Desig(m_noban) node->HasPermission(NetPermissionFlags::NoBan),
892-
Desig(m_conn_type) node->m_conn_type,
878+
.id = node->GetId(),
879+
.m_connected = node->m_connected,
880+
.m_min_ping_time = node->m_min_ping_time,
881+
.m_last_block_time = node->m_last_block_time,
882+
.m_last_tx_time = node->m_last_tx_time,
883+
.fRelevantServices = HasAllDesirableServiceFlags(node->nServices),
884+
.m_relay_txs = node->m_relays_txs.load(),
885+
.fBloomFilter = node->m_bloom_filter_loaded.load(),
886+
.nKeyedNetGroup = node->nKeyedNetGroup,
887+
.prefer_evict = node->m_prefer_evict,
888+
.m_is_local = node->addr.IsLocal(),
889+
.m_network = node->ConnectedThroughNetwork(),
890+
.m_noban = node->HasPermission(NetPermissionFlags::NoBan),
891+
.m_conn_type = node->m_conn_type,
893892
};
894893
vEvictionCandidates.push_back(candidate);
895894
}

src/rpc/blockchain.cpp

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,29 @@ static CBlockUndo GetUndoChecked(BlockManager& blockman, const CBlockIndex* pblo
603603
return blockUndo;
604604
}
605605

606+
const RPCResult getblock_vin{
607+
RPCResult::Type::ARR, "vin", "",
608+
{
609+
{RPCResult::Type::OBJ, "", "",
610+
{
611+
{RPCResult::Type::ELISION, "", "The same output as verbosity = 2"},
612+
{RPCResult::Type::OBJ, "prevout", "(Only if undo information is available)",
613+
{
614+
{RPCResult::Type::BOOL, "generated", "Coinbase or not"},
615+
{RPCResult::Type::NUM, "height", "The height of the prevout"},
616+
{RPCResult::Type::NUM, "value", "The value in " + CURRENCY_UNIT},
617+
{RPCResult::Type::OBJ, "scriptPubKey", "",
618+
{
619+
{RPCResult::Type::STR, "asm", "The asm"},
620+
{RPCResult::Type::STR, "hex", "The hex"},
621+
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
622+
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
623+
}},
624+
}},
625+
}},
626+
}
627+
};
628+
606629
static RPCHelpMan getblock()
607630
{
608631
return RPCHelpMan{"getblock",
@@ -662,26 +685,7 @@ static RPCHelpMan getblock()
662685
{
663686
{RPCResult::Type::OBJ, "", "",
664687
{
665-
{RPCResult::Type::ARR, "vin", "",
666-
{
667-
{RPCResult::Type::OBJ, "", "",
668-
{
669-
{RPCResult::Type::ELISION, "", "The same output as verbosity = 2"},
670-
{RPCResult::Type::OBJ, "prevout", "(Only if undo information is available)",
671-
{
672-
{RPCResult::Type::BOOL, "generated", "Coinbase or not"},
673-
{RPCResult::Type::NUM, "height", "The height of the prevout"},
674-
{RPCResult::Type::NUM, "value", "The value in " + CURRENCY_UNIT},
675-
{RPCResult::Type::OBJ, "scriptPubKey", "",
676-
{
677-
{RPCResult::Type::STR, "asm", "The asm"},
678-
{RPCResult::Type::STR, "hex", "The hex"},
679-
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
680-
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
681-
}},
682-
}},
683-
}},
684-
}},
688+
getblock_vin,
685689
}},
686690
}},
687691
}},

0 commit comments

Comments
 (0)