2017-11-09 19:34:51 +01:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
|
|
|
|
* Copyright (C) 2009-2010 Satoshi Nakamoto
|
|
|
|
|
* Copyright (C) 2009-2015 The Bitcoin Core developers
|
|
|
|
|
*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*/
|
2013-01-08 03:02:51 -08:00
|
|
|
|
2021-11-02 10:08:27 +01:00
|
|
|
#include "MutableBlock.h"
|
2013-04-13 00:13:08 -05:00
|
|
|
|
2014-09-24 23:32:36 -04:00
|
|
|
#include "hash.h"
|
2014-08-20 10:51:18 +02:00
|
|
|
#include "tinyformat.h"
|
2014-09-24 23:32:36 -04:00
|
|
|
#include "utilstrencodings.h"
|
2014-12-19 11:39:38 +01:00
|
|
|
#include "crypto/common.h"
|
2013-01-08 04:17:15 -08:00
|
|
|
|
2021-11-02 10:49:17 +01:00
|
|
|
uint256 BlockHeaderFields::createHash() const
|
2013-06-25 03:03:03 +02:00
|
|
|
{
|
2015-01-18 19:23:05 +01:00
|
|
|
return SerializeHash(*this);
|
2013-06-25 03:03:03 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-15 21:35:08 +02:00
|
|
|
#if 0
|
2021-11-02 09:36:09 +01:00
|
|
|
std::string MutableBlock::toString() const
|
2013-06-25 03:03:03 +02:00
|
|
|
{
|
2014-08-20 10:26:27 +02:00
|
|
|
std::stringstream s;
|
2026-04-15 21:35:08 +02:00
|
|
|
s << strprintf("MutableBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
|
2021-11-02 09:28:35 +01:00
|
|
|
createHash().ToString(),
|
2013-06-25 03:03:03 +02:00
|
|
|
nVersion,
|
2014-01-16 16:15:27 +01:00
|
|
|
hashPrevBlock.ToString(),
|
|
|
|
|
hashMerkleRoot.ToString(),
|
2013-06-25 03:03:03 +02:00
|
|
|
nTime, nBits, nNonce,
|
|
|
|
|
vtx.size());
|
2026-04-15 21:35:08 +02:00
|
|
|
for (unsigned int i = 0; i < vtx.size(); i++) {
|
2014-08-20 10:26:27 +02:00
|
|
|
s << " " << vtx[i].ToString() << "\n";
|
2013-06-25 03:03:03 +02:00
|
|
|
}
|
2014-08-20 10:26:27 +02:00
|
|
|
return s.str();
|
2013-06-25 03:03:03 +02:00
|
|
|
}
|
2026-04-15 21:35:08 +02:00
|
|
|
#endif
|