Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,9 @@ public class CommonParameter {
public String nodeExternalIp;
@Getter
@Setter
public boolean nodeDiscoveryPublicHomeNode;
@Getter
@Setter
public long nodeDiscoveryPingTimeout;
@Getter
@Setter
public long nodeP2pPingInterval;
@Getter
@Setter
public int nodeP2pVersion;
@Getter
@Setter
public String p2pNodeId;
@Getter
@Setter
public boolean nodeEnableIpv6 = false;
@Getter
@Setter
Expand Down
4 changes: 0 additions & 4 deletions common/src/main/java/org/tron/core/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ public class Constant {
public static final String NODE_MAX_CONNECTIONS_WITH_SAME_IP = "node.maxConnectionsWithSameIp";
public static final String NODE_MIN_PARTICIPATION_RATE = "node.minParticipationRate";
public static final String NODE_LISTEN_PORT = "node.listen.port";
public static final String NODE_DISCOVERY_PUBLIC_HOME_NODE = "node.discovery.public.home.node";
public static final String NODE_DISCOVERY_PING_TIMEOUT = "node.discovery.ping.timeout";

public static final String NODE_P2P_PING_INTERVAL = "node.p2p.pingInterval";
public static final String NODE_P2P_VERSION = "node.p2p.version";
public static final String NODE_ENABLE_IPV6 = "node.enableIpv6";
public static final String NODE_DNS_TREE_URLS = "node.dns.treeUrls";
Expand Down
16 changes: 0 additions & 16 deletions framework/src/main/java/org/tron/core/config/args/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ public static void clearParam() {
PARAMETER.nodeListenPort = 0;
PARAMETER.nodeDiscoveryBindIp = "";
PARAMETER.nodeExternalIp = "";
PARAMETER.nodeDiscoveryPublicHomeNode = false;
PARAMETER.nodeDiscoveryPingTimeout = 15000;
PARAMETER.nodeP2pPingInterval = 0L;
PARAMETER.nodeP2pVersion = 0;
PARAMETER.nodeEnableIpv6 = false;
PARAMETER.dnsTreeUrls = new ArrayList<>();
Expand Down Expand Up @@ -170,7 +167,6 @@ public static void clearParam() {
PARAMETER.forbidTransferToContract = 0;
PARAMETER.tcpNettyWorkThreadNum = 0;
PARAMETER.udpNettyWorkThreadNum = 0;
PARAMETER.p2pNodeId = "";
PARAMETER.solidityNode = false;
PARAMETER.trustNodeAddr = "";
PARAMETER.walletExtensionApi = false;
Expand Down Expand Up @@ -639,18 +635,6 @@ public static void setParam(final String[] args, final String confFileName) {
bindIp(config);
externalIp(config);

PARAMETER.nodeDiscoveryPublicHomeNode =
config.hasPath(Constant.NODE_DISCOVERY_PUBLIC_HOME_NODE) && config
.getBoolean(Constant.NODE_DISCOVERY_PUBLIC_HOME_NODE);

PARAMETER.nodeDiscoveryPingTimeout =
config.hasPath(Constant.NODE_DISCOVERY_PING_TIMEOUT)
? config.getLong(Constant.NODE_DISCOVERY_PING_TIMEOUT) : 15000;

PARAMETER.nodeP2pPingInterval =
config.hasPath(Constant.NODE_P2P_PING_INTERVAL)
? config.getLong(Constant.NODE_P2P_PING_INTERVAL) : 0;

PARAMETER.nodeP2pVersion =
config.hasPath(Constant.NODE_P2P_VERSION)
? config.getInt(Constant.NODE_P2P_VERSION) : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
import org.tron.core.config.args.Args;



public class ArgsTest {

private static final String dbPath = "output_arg_test";

@Before
public void init() {
Args.setParam(new String[]{"--output-directory", dbPath, "--p2p-disable", "true",
Args.setParam(new String[] {"--output-directory", dbPath, "--p2p-disable", "true",
"--debug"}, Constant.TEST_CONF);
}

Expand All @@ -32,7 +31,6 @@ public void destroy() {
public void testConfig() {
Assert.assertEquals(Args.getInstance().getMaxTransactionPendingSize(), 2000);
Assert.assertEquals(Args.getInstance().getPendingTransactionTimeout(), 60_000);
Assert.assertEquals(Args.getInstance().getNodeDiscoveryPingTimeout(), 15_000);
Assert.assertEquals(Args.getInstance().getMaxFastForwardNum(), 3);
Assert.assertEquals(Args.getInstance().getBlockCacheTimeout(), 60);
Assert.assertEquals(Args.getInstance().isNodeDetectEnable(), false);
Expand Down
35 changes: 35 additions & 0 deletions framework/src/test/java/org/tron/core/WalletTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.tron.api.GrpcAPI.AssetIssueList;
import org.tron.api.GrpcAPI.BlockList;
import org.tron.api.GrpcAPI.ExchangeList;
import org.tron.api.GrpcAPI.NumberMessage;
import org.tron.api.GrpcAPI.ProposalList;
import org.tron.common.BaseTest;
import org.tron.common.crypto.ECKey;
Expand Down Expand Up @@ -531,6 +532,16 @@ public void getPaginatedProposalList() {

}

@Test
public void testGetProposalById() {
buildProposal();
//
Proposal proposal = wallet.getProposalById(ByteString.copyFrom(ByteArray.fromLong(1L)));
Assert.assertNotNull(proposal);
proposal = wallet.getProposalById(ByteString.copyFrom(ByteArray.fromLong(3L)));
Assert.assertNull(proposal);
}

@Test
public void getPaginatedExchangeList() {
buildExchange();
Expand All @@ -541,6 +552,24 @@ public void getPaginatedExchangeList() {
exchangeList.getExchangesList().get(1).getCreatorAddress().toStringUtf8());
}

@Test
public void testGetExchangeById() {
buildExchange();
//
Exchange exchange = wallet.getExchangeById(ByteString.copyFrom(ByteArray.fromLong(1L)));
Assert.assertNotNull(exchange);
exchange = wallet.getExchangeById(ByteString.copyFrom(ByteArray.fromLong(3L)));
Assert.assertNull(exchange);
}

@Test
public void testGetExchangeList() {
buildExchange();
//
ExchangeList exchangeList = wallet.getExchangeList();
Assert.assertEquals(2, exchangeList.getExchangesCount());
}

@Test
public void getBlock() {
GrpcAPI.BlockReq req = GrpcAPI.BlockReq.getDefaultInstance();
Expand All @@ -567,6 +596,12 @@ public void getBlock() {
assertEquals(block, wallet.getBlock(req));
}

@Test
public void testGetNextMaintenanceTime() {
NumberMessage numberMessage = wallet.getNextMaintenanceTime();
Assert.assertEquals(0, numberMessage.getNum());
}

//@Test
public void testChainParameters() {

Expand Down