Ethereum
PoC-8
The C++ Implementation of Ethereum
LogEntry.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
*/
17
18
#include "
LogEntry.h
"
19
20
#include <
libdevcore/RLP.h
>
21
#include <
libdevcore/SHA3.h
>
22
23
namespace
dev
24
{
25
namespace
eth
26
{
27
28
LogEntry::LogEntry
(
RLP
const
& _r)
29
{
30
assert(_r.
itemCount
() == 3);
31
address
= (
Address
)_r[0];
32
topics
= _r[1].
toVector
<
h256
>();
33
data
= _r[2].
toBytes
();
34
}
35
36
void
LogEntry::streamRLP
(
RLPStream
& _s)
const
37
{
38
_s.
appendList
(3) <<
address
<<
topics
<<
data
;
39
}
40
41
LogBloom
LogEntry::bloom
()
const
42
{
43
LogBloom
ret;
44
ret.
shiftBloom
<3>(
sha3
(
address
.
ref
()));
45
for
(
auto
t:
topics
)
46
ret.
shiftBloom
<3>(
sha3
(t.ref()));
47
return
ret;
48
}
49
50
}
51
}
dev::FixedHash::shiftBloom
FixedHash & shiftBloom(FixedHash< M > const &_h)
Definition:
FixedHash.h:175
dev::eth::LogEntry::LogEntry
LogEntry()=default
dev::sha3
bool sha3(bytesConstRef _input, bytesRef o_output) noexcept
Definition:
SHA3.cpp:28
LogEntry.h
dev::FixedHash::ref
bytesRef ref()
Definition:
FixedHash.h:132
dev::eth::LogEntry::address
Address address
Definition:
LogEntry.h:46
dev::eth::LogEntry::topics
h256s topics
Definition:
LogEntry.h:47
dev::FixedHash< 32 >
dev::RLP::toVector
std::vector< T > toVector(int _flags=LaissezFaire) const
Definition:
RLP.h:186
dev::eth::LogEntry::streamRLP
void streamRLP(RLPStream &_s) const
Definition:
LogEntry.cpp:36
SHA3.h
dev::eth::LogEntry::data
bytes data
Definition:
LogEntry.h:48
dev::RLPStream
Class for writing to an RLP bytestream.
Definition:
RLP.h:370
dev::RLP::itemCount
size_t itemCount() const
Definition:
RLP.h:101
dev
Definition:
Address.cpp:21
dev::RLP
Definition:
RLP.h:48
dev::Address
h160 Address
Definition:
Address.h:30
RLP.h
dev::RLPStream::appendList
RLPStream & appendList(size_t _items)
Appends a list.
Definition:
RLP.cpp:268
dev::eth::LogEntry::bloom
LogBloom bloom() const
Definition:
LogEntry.cpp:41
dev::RLP::toBytes
bytes toBytes(int _flags=LaissezFaire) const
Converts to bytearray.
Definition:
RLP.h:177
libethcore
LogEntry.cpp
Generated on Fri Sep 20 2019 00:00:00 for Ethereum by
1.8.18