Raven Core
3.0.0
P2P Digital Currency
src
primitives
block.cpp
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-2016 The Bitcoin Core developers
3
// Copyright (c) 2017-2019 The Raven Core developers
4
// Distributed under the MIT software license, see the accompanying
5
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
6
7
#include "
primitives/block.h
"
8
9
#include "hash.h"
10
#include "
tinyformat.h
"
11
#include "
utilstrencodings.h
"
12
#include "
crypto/common.h
"
13
14
uint256
CBlockHeader::GetHash
()
const
15
{
16
return
HashX16R
(
BEGIN
(
nVersion
),
END
(
nNonce
),
hashPrevBlock
);
17
}
18
19
std::string
CBlock::ToString
()
const
20
{
21
std::stringstream s;
22
s <<
strprintf
(
"CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n"
,
23
GetHash
().ToString(),
24
nVersion
,
25
hashPrevBlock
.
ToString
(),
26
hashMerkleRoot
.
ToString
(),
27
nTime
,
nBits
,
nNonce
,
28
vtx.size());
29
for
(
const
auto
& tx : vtx) {
30
s <<
" "
<< tx->ToString() <<
"\n"
;
31
}
32
return
s.str();
33
}
CBlockHeader::nNonce
uint32_t nNonce
Definition:
block.h:30
strprintf
#define strprintf
Definition:
tinyformat.h:1054
CBlock::ToString
std::string ToString() const
Definition:
block.cpp:19
CBlockHeader::nTime
uint32_t nTime
Definition:
block.h:28
HashX16R
uint256 HashX16R(const T1 pbegin, const T1 pend, const uint256 PrevBlockHash)
Definition:
hash.h:361
BEGIN
#define BEGIN(a)
Utilities for converting data from/to strings.
Definition:
utilstrencodings.h:17
utilstrencodings.h
CBlockHeader::hashMerkleRoot
uint256 hashMerkleRoot
Definition:
block.h:27
CBlockHeader::hashPrevBlock
uint256 hashPrevBlock
Definition:
block.h:26
END
#define END(a)
Definition:
utilstrencodings.h:18
tinyformat.h
base_blob::ToString
std::string ToString() const
Definition:
uint256.cpp:63
CBlockHeader::GetHash
uint256 GetHash() const
Definition:
block.cpp:14
uint256
256-bit opaque blob.
Definition:
uint256.h:123
common.h
CBlockHeader::nVersion
int32_t nVersion
Definition:
block.h:25
block.h
CBlockHeader::nBits
uint32_t nBits
Definition:
block.h:29
Generated on Mon Jul 29 2019 02:32:19 for Raven Core by
1.8.13