mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
rpc: Enhance metadata of the dumptxoutset output
The following data is added: - A newly introduced utxo set magic - A version number - The network magic - The block height
This commit is contained in:
@@ -542,3 +542,33 @@ std::unique_ptr<const CChainParams> CChainParams::TestNet()
|
||||
{
|
||||
return std::make_unique<const CTestNetParams>();
|
||||
}
|
||||
|
||||
std::vector<int> CChainParams::GetAvailableSnapshotHeights() const
|
||||
{
|
||||
std::vector<int> heights;
|
||||
heights.reserve(m_assumeutxo_data.size());
|
||||
|
||||
for (const auto& data : m_assumeutxo_data) {
|
||||
heights.emplace_back(data.height);
|
||||
}
|
||||
return heights;
|
||||
}
|
||||
|
||||
std::optional<ChainType> GetNetworkForMagic(MessageStartChars& message)
|
||||
{
|
||||
const auto mainnet_msg = CChainParams::Main()->MessageStart();
|
||||
const auto testnet_msg = CChainParams::TestNet()->MessageStart();
|
||||
const auto regtest_msg = CChainParams::RegTest({})->MessageStart();
|
||||
const auto signet_msg = CChainParams::SigNet({})->MessageStart();
|
||||
|
||||
if (std::equal(message.begin(), message.end(), mainnet_msg.data())) {
|
||||
return ChainType::MAIN;
|
||||
} else if (std::equal(message.begin(), message.end(), testnet_msg.data())) {
|
||||
return ChainType::TESTNET;
|
||||
} else if (std::equal(message.begin(), message.end(), regtest_msg.data())) {
|
||||
return ChainType::REGTEST;
|
||||
} else if (std::equal(message.begin(), message.end(), signet_msg.data())) {
|
||||
return ChainType::SIGNET;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user