Dash Core  0.12.2.1
P2P Digital Currency
block.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 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 
14 {
15  return HashX11(BEGIN(nVersion), END(nNonce));
16 }
17 
18 std::string CBlock::ToString() const
19 {
20  std::stringstream s;
21  s << strprintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
22  GetHash().ToString(),
23  nVersion,
26  nTime, nBits, nNonce,
27  vtx.size());
28  for (unsigned int i = 0; i < vtx.size(); i++)
29  {
30  s << " " << vtx[i].ToString() << "\n";
31  }
32  return s.str();
33 }
uint256 hashMerkleRoot
Definition: block.h:26
#define strprintf
Definition: tinyformat.h:1011
uint32_t nTime
Definition: block.h:27
std::vector< CTransaction > vtx
Definition: block.h:77
uint256 hashPrevBlock
Definition: block.h:25
#define BEGIN(a)
uint32_t nBits
Definition: block.h:28
#define END(a)
std::string ToString() const
Definition: uint256.cpp:65
std::string ToString() const
Definition: block.cpp:18
uint32_t nNonce
Definition: block.h:29
int32_t nVersion
Definition: block.h:24
uint256 GetHash() const
Definition: block.cpp:13
uint256 HashX11(const T1 pbegin, const T1 pend)
Definition: hash.h:283