2017-11-08 14:10:06 +01:00
/*
* This file is part of the Flowee project
* Copyright (c) 2009-2010 Satoshi Nakamoto
* Copyright (c) 2009-2015 The Bitcoin Core developers
* Copyright (c) 2017 Tom Zander <tomz@freedommail.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2014-03-10 08:46:53 -07:00
2018-01-16 10:47:52 +00:00
# ifndef FLOWEE_POW_H
# define FLOWEE_POW_H
2014-03-10 08:46:53 -07:00
2015-02-15 02:21:42 +01:00
# include "consensus/params.h"
2017-11-08 14:10:06 +01:00
# include <cstdint>
2014-03-10 08:46:53 -07:00
class CBlockHeader ;
2014-09-14 12:43:56 +02:00
class CBlockIndex ;
2014-03-10 08:46:53 -07:00
class uint256 ;
2014-12-16 15:43:03 +01:00
class arith_uint256 ;
2014-03-10 08:46:53 -07:00
2017-11-08 14:10:06 +01:00
uint32_t GetNextWorkRequired ( const CBlockIndex * pindexLast , const CBlockHeader * pblock , const Consensus : : Params & ) ;
uint32_t CalculateNextWorkRequired ( const CBlockIndex * pindexLast , int64_t nFirstBlockTime , const Consensus : : Params & ) ;
uint32_t CalculateNextCashWorkRequired ( const CBlockIndex * pindexPrev , const CBlockHeader * pblock , const Consensus : : Params & params ) ;
2014-03-10 08:46:53 -07:00
2017-11-08 14:10:06 +01:00
/**
* Check whether a block hash satisfies the proof-of-work requirement specified by nBits
*/
2020-03-30 22:19:36 +02:00
bool CheckProofOfWork ( const uint256 & hash , uint32_t nBits , const Consensus : : Params & ) ;
2014-12-16 15:43:03 +01:00
arith_uint256 GetBlockProof ( const CBlockIndex & block ) ;
2014-07-05 12:05:33 +02:00
2015-03-17 06:35:59 -07:00
/** Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds. */
int64_t GetBlockProofEquivalentTime ( const CBlockIndex & to , const CBlockIndex & from , const CBlockIndex & tip , const Consensus : : Params & ) ;
2018-01-16 10:47:52 +00:00
# endif