aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/chainparams.cpp18
-rw-r--r--src/kernel/chainparams.h26
2 files changed, 26 insertions, 18 deletions
diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp
index 7e69c097a6..ca418fc6ab 100644
--- a/src/kernel/chainparams.cpp
+++ b/src/kernel/chainparams.cpp
@@ -172,8 +172,8 @@ public:
}
};
- m_assumeutxo_data = MapAssumeutxo{
- // TODO to be specified in a future patch.
+ m_assumeutxo_data = {
+ // TODO to be specified in a future patch.
};
chainTxData = ChainTxData{
@@ -266,7 +266,7 @@ public:
}
};
- m_assumeutxo_data = MapAssumeutxo{
+ m_assumeutxo_data = {
// TODO to be specified in a future patch.
};
@@ -477,14 +477,12 @@ public:
}
};
- m_assumeutxo_data = MapAssumeutxo{
- {
- 110,
- {AssumeutxoHash{uint256S("0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618")}, 110},
- },
+ m_assumeutxo_data = {
{
- 200,
- {AssumeutxoHash{uint256S("0x51c8d11d8b5c1de51543c579736e786aa2736206d1e11e627568029ce092cf62")}, 200},
+ .height = 110,
+ .hash_serialized = AssumeutxoHash{uint256S("0x1ebbf5850204c0bdb15bf030f47c7fe91d45c44c712697e4509ba67adb01c618")},
+ .nChainTx = 110,
+ .blockhash = uint256S("0x696e92821f65549c7ee134edceeeeaaa4105647a3c4fd9f298c0aec0ab50425c")
},
};
diff --git a/src/kernel/chainparams.h b/src/kernel/chainparams.h
index ec1697493c..7a5539bc71 100644
--- a/src/kernel/chainparams.h
+++ b/src/kernel/chainparams.h
@@ -12,6 +12,7 @@
#include <uint256.h>
#include <util/chaintype.h>
#include <util/hash_type.h>
+#include <util/vector.h>
#include <cstdint>
#include <iterator>
@@ -44,17 +45,21 @@ struct AssumeutxoHash : public BaseHash<uint256> {
* as valid.
*/
struct AssumeutxoData {
+ int height;
+
//! The expected hash of the deserialized UTXO set.
- const AssumeutxoHash hash_serialized;
+ AssumeutxoHash hash_serialized;
//! Used to populate the nChainTx value, which is used during BlockManager::LoadBlockIndex().
//!
//! We need to hardcode the value here because this is computed cumulatively using block data,
//! which we do not necessarily have at the time of snapshot load.
- const unsigned int nChainTx;
-};
+ unsigned int nChainTx;
-using MapAssumeutxo = std::map<int, const AssumeutxoData>;
+ //! The hash of the base block for this snapshot. Used to refer to assumeutxo data
+ //! prior to having a loaded blockindex.
+ uint256 blockhash;
+};
/**
* Holds various statistics on transactions within a chain. Used to estimate
@@ -114,9 +119,14 @@ public:
const std::vector<uint8_t>& FixedSeeds() const { return vFixedSeeds; }
const CCheckpointData& Checkpoints() const { return checkpointData; }
- //! Get allowed assumeutxo configuration.
- //! @see ChainstateManager
- const MapAssumeutxo& Assumeutxo() const { return m_assumeutxo_data; }
+ std::optional<AssumeutxoData> AssumeutxoForHeight(int height) const
+ {
+ return FindFirst(m_assumeutxo_data, [&](const auto& d) { return d.height == height; });
+ }
+ std::optional<AssumeutxoData> AssumeutxoForBlockhash(const uint256& blockhash) const
+ {
+ return FindFirst(m_assumeutxo_data, [&](const auto& d) { return d.blockhash == blockhash; });
+ }
const ChainTxData& TxData() const { return chainTxData; }
@@ -169,7 +179,7 @@ protected:
bool fDefaultConsistencyChecks;
bool m_is_mockable_chain;
CCheckpointData checkpointData;
- MapAssumeutxo m_assumeutxo_data;
+ std::vector<AssumeutxoData> m_assumeutxo_data;
ChainTxData chainTxData;
};