BSHA3
0.17.99
P2P Blockchain, based on Bitcoin
src
primitives
block.cpp
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-2018 The Bitcoin Core developers
3
// Distributed under the MIT software license, see the accompanying
4
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6
#include <
primitives/block.h
>
7
8
#include <hash.h>
9
#include <
tinyformat.h
>
10
#include <
utilstrencodings.h
>
11
#include <
crypto/common.h
>
12
13
uint256
CBlockHeader::GetHash
()
const
14
{
15
return
SerializeHash
(*
this
);
16
}
17
18
std::string
CBlock::ToString
()
const
19
{
20
std::stringstream s;
21
s <<
strprintf
(
"CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n"
,
22
GetHash
().
ToString
(),
// TODO
23
nVersion
,
24
hashPrevBlock
.
ToString
(),
25
hashMerkleRoot
.
ToString
(),
26
nTime
,
nBits
,
nNonce
,
27
vtx
.size());
28
for
(
const
auto
& tx :
vtx
) {
29
s <<
" "
<< tx->ToString() <<
"\n"
;
30
}
31
return
s.str();
32
}
CBlockHeader::nNonce
uint32_t nNonce
Definition:
block.h:29
strprintf
#define strprintf
Definition:
tinyformat.h:1066
SerializeHash
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
Definition:
hash.h:235
CBlock::ToString
std::string ToString() const
Definition:
block.cpp:18
CBlockHeader::nTime
uint32_t nTime
Definition:
block.h:27
utilstrencodings.h
CBlockHeader::hashMerkleRoot
uint256 hashMerkleRoot
Definition:
block.h:26
CBlockHeader::hashPrevBlock
uint256 hashPrevBlock
Definition:
block.h:25
tinyformat.h
base_blob::ToString
std::string ToString() const
Definition:
uint256.cpp:62
CBlockHeader::GetHash
uint256 GetHash() const
Definition:
block.cpp:13
uint256
256-bit opaque blob.
Definition:
uint256.h:122
CBlock::vtx
std::vector< CTransactionRef > vtx
Definition:
block.h:78
common.h
CBlockHeader::nVersion
int32_t nVersion
Definition:
block.h:24
block.h
CBlockHeader::nBits
uint32_t nBits
Definition:
block.h:28
Generated on Wed Nov 28 2018 15:30:28 for BSHA3 by
1.8.14