You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

checkpoints.cpp 866B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) 2009-2016 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #include "checkpoints.h"
  5. #include "chain.h"
  6. #include "chainparams.h"
  7. #include "reverse_iterator.h"
  8. #include "validation.h"
  9. #include "uint256.h"
  10. #include <stdint.h>
  11. namespace Checkpoints {
  12. CBlockIndex* GetLastCheckpoint(const CCheckpointData& data)
  13. {
  14. const MapCheckpoints& checkpoints = data.mapCheckpoints;
  15. for (const MapCheckpoints::value_type& i : reverse_iterate(checkpoints))
  16. {
  17. const uint256& hash = i.second;
  18. BlockMap::const_iterator t = mapBlockIndex.find(hash);
  19. if (t != mapBlockIndex.end())
  20. return t->second;
  21. }
  22. return nullptr;
  23. }
  24. } // namespace Checkpoints