mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Add Read/Write functions to txdb for PAK lists
This commit is contained in:
parent
2b4899dd3c
commit
bf66d77a8d
2 changed files with 13 additions and 0 deletions
11
src/txdb.cpp
11
src/txdb.cpp
|
|
@ -35,6 +35,7 @@ static const char DB_LAST_BLOCK = 'l';
|
|||
// ELEMENTS:
|
||||
static const char DB_PEGIN_FLAG = 'w';
|
||||
static const char DB_INVALID_BLOCK_Q = 'q';
|
||||
static const char DB_PAK = 'p';
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -279,6 +280,16 @@ bool CBlockTreeDB::WriteInvalidBlockQueue(const std::vector<uint256> &vBlocks) {
|
|||
return Write(std::make_pair(DB_INVALID_BLOCK_Q, uint256S("0")), vBlocks);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadPAKList(std::vector<std::vector<unsigned char> >& offline_list, std::vector<std::vector<unsigned char> >& online_list, bool& reject)
|
||||
{
|
||||
return Read(std::make_pair(DB_PAK, uint256S("1")), offline_list) && Read(std::make_pair(DB_PAK, uint256S("2")), online_list) && Read(std::make_pair(DB_PAK, uint256S("3")), reject);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::WritePAKList(const std::vector<std::vector<unsigned char> >& offline_list, const std::vector<std::vector<unsigned char> >& online_list, bool reject)
|
||||
{
|
||||
return Write(std::make_pair(DB_PAK, uint256S("1")), offline_list) && Write(std::make_pair(DB_PAK, uint256S("2")), online_list) && Write(std::make_pair(DB_PAK, uint256S("3")), reject);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex)
|
||||
{
|
||||
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ public:
|
|||
// ELEMENTS:
|
||||
bool ReadInvalidBlockQueue(std::vector<uint256> &vBlocks);
|
||||
bool WriteInvalidBlockQueue(const std::vector<uint256> &vBlocks);
|
||||
bool ReadPAKList(std::vector<std::vector<unsigned char> >& offline_list, std::vector<std::vector<unsigned char> >& online_list, bool& reject);
|
||||
bool WritePAKList(const std::vector<std::vector<unsigned char> >& offline_list, const std::vector<std::vector<unsigned char> >& online_list, bool reject);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_TXDB_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue