Files
thehub/libs/server/pow.h
T

47 lines
1.9 KiB
C++
Raw Permalink Normal View History

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/>.
*/
2018-01-16 10:47:52 +00:00
#ifndef FLOWEE_POW_H
#define FLOWEE_POW_H
#include "consensus/params.h"
2017-11-08 14:10:06 +01:00
#include <cstdint>
class CBlockHeader;
2014-09-14 12:43:56 +02:00
class CBlockIndex;
class uint256;
2014-12-16 15:43:03 +01:00
class arith_uint256;
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);
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);
/** 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