Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115266
checkpoints.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
checkpoints.cpp
View Options
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include
<checkpoints.h>
#include
<chainparams.h>
#include
<reverse_iterator.h>
// D6970 moved LookupBlockIndex from chain.h to validation.h TODO: remove this
// when LookupBlockIndex is refactored out of validation
#include
<validation.h>
#include
<cstdint>
namespace
Checkpoints
{
bool
CheckBlock
(
const
CCheckpointData
&
data
,
int
nHeight
,
const
BlockHash
&
hash
)
{
const
MapCheckpoints
&
checkpoints
=
data
.
mapCheckpoints
;
MapCheckpoints
::
const_iterator
i
=
checkpoints
.
find
(
nHeight
);
if
(
i
==
checkpoints
.
end
())
{
return
true
;
}
return
hash
==
i
->
second
;
}
CBlockIndex
*
GetLastCheckpoint
(
const
CCheckpointData
&
data
)
EXCLUSIVE_LOCKS_REQUIRED
(
cs_main
)
{
const
MapCheckpoints
&
checkpoints
=
data
.
mapCheckpoints
;
for
(
const
MapCheckpoints
::
value_type
&
i
:
reverse_iterate
(
checkpoints
))
{
const
BlockHash
&
hash
=
i
.
second
;
CBlockIndex
*
pindex
=
LookupBlockIndex
(
hash
);
if
(
pindex
)
{
return
pindex
;
}
}
return
nullptr
;
}
}
// namespace Checkpoints
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Mar 2, 10:33 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5183268
Default Alt Text
checkpoints.cpp (1 KB)
Attached To
rABC Bitcoin ABC
Event Timeline
Log In to Comment