Ethereum
PoC-8
The C++ Implementation of Ethereum
BlockDetails.cpp
Go to the documentation of this file.
1
/*
2
This file is part of cpp-ethereum.
3
4
cpp-ethereum is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
cpp-ethereum is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16
*/
22
#include "
BlockDetails.h
"
23
24
#include <
libdevcore/Common.h
>
25
using namespace
std
;
26
using namespace
dev
;
27
using namespace
dev::eth
;
28
29
BlockDetails::BlockDetails(
RLP
const
& _r)
30
{
31
number = _r[0].
toInt
<
unsigned
>();
32
totalDifficulty = _r[1].
toInt
<
u256
>();
33
parent = _r[2].
toHash
<
h256
>();
34
children = _r[3].
toVector
<
h256
>();
35
size = _r.
size
();
36
}
37
38
bytes
BlockDetails::rlp
()
const
39
{
40
auto
ret =
rlpList
(number, totalDifficulty, parent, children);
41
size = ret.size();
42
return
ret;
43
}
dev::eth
Definition:
BasicAuthority.h:32
dev::rlp
bytes rlp(_T _t)
Export a single item in RLP format, returning a byte array.
Definition:
RLP.h:453
dev::FixedHash< 32 >
dev::RLP::toVector
std::vector< T > toVector(int _flags=LaissezFaire) const
Definition:
RLP.h:186
dev::RLP::size
size_t size() const
Definition:
RLP.h:105
Common.h
dev::bytes
std::vector< byte > bytes
Definition:
Common.h:72
std
Definition:
FixedHash.h:393
dev::u256
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
Definition:
Common.h:121
dev::RLP::toInt
_T toInt(int _flags=Strict) const
Converts to int of type given; if isData(), decodes as big-endian bytestream.
Definition:
RLP.h:257
dev::RLP::toHash
_N toHash(int _flags=Strict) const
Definition:
RLP.h:288
dev
Definition:
Address.cpp:21
dev::rlpList
bytes rlpList()
Export a list of items in RLP format, returning a byte array.
Definition:
RLP.h:456
dev::RLP
Definition:
RLP.h:48
BlockDetails.h
libethereum
BlockDetails.cpp
Generated on Fri Sep 20 2019 00:00:00 for Ethereum by
1.8.18