Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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 <streams.h>
10 #include <tinyformat.h>
11 #include <utilstrencodings.h>
12 #include <crypto/common.h>
13 
15 {
16  std::vector<unsigned char> vch(80);
18  ss << *this;
19  return HashX11((const char *)vch.data(), (const char *)vch.data() + vch.size());
20 }
21 
22 std::string CBlock::ToString() const
23 {
24  std::stringstream s;
25  s << strprintf("CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
26  GetHash().ToString(),
27  nVersion,
30  nTime, nBits, nNonce,
31  vtx.size());
32  for (const auto& tx : vtx) {
33  s << " " << tx->ToString() << "\n";
34  }
35  return s.str();
36 }
uint32_t nNonce
Definition: block.h:29
#define strprintf
Definition: tinyformat.h:1066
std::string ToString() const
Definition: block.cpp:22
uint32_t nTime
Definition: block.h:27
uint256 hashMerkleRoot
Definition: block.h:26
uint256 hashPrevBlock
Definition: block.h:25
std::string ToString() const
Definition: uint256.cpp:62
uint256 GetHash() const
Definition: block.cpp:14
256-bit opaque blob.
Definition: uint256.h:123
std::vector< CTransactionRef > vtx
Definition: block.h:76
static const int PROTOCOL_VERSION
network protocol versioning
Definition: version.h:14
int32_t nVersion
Definition: block.h:24
uint256 HashX11(const T1 pbegin, const T1 pend)
Definition: hash.h:302
uint32_t nBits
Definition: block.h:28
Released under the MIT license