Coverage Summary for Class: EthAdapter (org.ethereum.net.eth.handler)
Class |
Class, %
|
Method, %
|
Line, %
|
EthAdapter |
0%
(0/1)
|
0%
(0/6)
|
0%
(0/7)
|
1 /*
2 * This file is part of RskJ
3 * Copyright (C) 2017 RSK Labs Ltd.
4 * (derived from ethereumJ library, Copyright (c) 2016 <ether.camp>)
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package org.ethereum.net.eth.handler;
21
22 import org.ethereum.net.eth.EthVersion;
23 import org.ethereum.net.eth.message.EthMessage;
24 import org.ethereum.sync.SyncStatistics;
25
26 import static org.ethereum.net.eth.EthVersion.*;
27
28 /**
29 * It's quite annoying to always check {@code if (eth != null)} before accessing it. <br>
30 *
31 * This adapter helps to avoid such checks. It provides meaningful answers to Eth client
32 * assuming that Eth hasn't been initialized yet. <br>
33 *
34 * Check {@link org.ethereum.net.server.Channel} for example.
35 *
36 * @author Mikhail Kalinin
37 * @since 20.08.2015
38 */
39 public class EthAdapter implements Eth {
40
41 private final SyncStatistics syncStats = new SyncStatistics();
42
43 @Override
44 public boolean hasStatusPassed() {
45 return false;
46 }
47
48 @Override
49 public boolean hasStatusSucceeded() {
50 return false;
51 }
52
53 @Override
54 public SyncStatistics getStats() {
55 return syncStats;
56 }
57
58 @Override
59 public EthVersion getVersion() {
60 return fromCode(UPPER);
61 }
62
63 @Override
64 public void sendStatus() {
65 }
66
67 @Override
68 public void dropConnection() {
69 }
70
71 @Override
72 public void sendMessage(EthMessage message) {
73 }
74
75 @Override
76 public boolean isUsingNewProtocol() {
77 return false;
78 }
79 }