Skip to content

Commit

Permalink
Merge 91a9555 into baf1c7d
Browse files Browse the repository at this point in the history
  • Loading branch information
zilm13 committed Aug 9, 2018
2 parents baf1c7d + 91a9555 commit 60926e4
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 170 deletions.
Expand Up @@ -726,8 +726,7 @@ public String bindIp() {
if (!config.hasPath("peer.discovery.bind.ip") || config.getString("peer.discovery.bind.ip").trim().isEmpty()) {
if (bindIp == null) {
logger.info("Bind address wasn't set, Punching to identify it...");
try {
Socket s = new Socket("www.google.com", 80);
try (Socket s = new Socket("www.google.com", 80)) {
bindIp = s.getLocalAddress().getHostAddress();
logger.info("UDP local bound to: {}", bindIp);
} catch (IOException e) {
Expand Down
Expand Up @@ -128,7 +128,8 @@ public void init(DbSettings settings) {
tableCfg.setFilter(new BloomFilter(10, false));

// read options
readOpts = new ReadOptions().setPrefixSameAsStart(true)
readOpts = new ReadOptions();
readOpts = readOpts.setPrefixSameAsStart(true)
.setVerifyChecksums(false);

try {
Expand Down Expand Up @@ -211,6 +212,7 @@ public void close() {

logger.debug("Close db: {}", name);
db.close();
readOpts.close();

alive = false;

Expand Down
Expand Up @@ -24,6 +24,7 @@

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.stereotype.Component;


Expand Down Expand Up @@ -60,8 +61,8 @@ public static Ethereum createEthereum(SystemProperties config, Class userSpringC

public static Ethereum createEthereum(Class ... springConfigs) {
logger.info("Starting EthereumJ...");
ApplicationContext context = new AnnotationConfigApplicationContext(springConfigs);

AbstractApplicationContext context = new AnnotationConfigApplicationContext(springConfigs);
context.registerShutdownHook();
return context.getBean(Ethereum.class);
}
}
144 changes: 0 additions & 144 deletions ethereumj-core/src/main/java/org/ethereum/net/rlpx/Handshaker.java

This file was deleted.

Expand Up @@ -60,18 +60,19 @@ private void initBundled() throws IOException {
tmpDir.mkdirs();

InputStream is = getClass().getResourceAsStream("/native/" + getOS() + "/solc/file.list");
Scanner scanner = new Scanner(is);
while (scanner.hasNext()) {
String s = scanner.next();
File targetFile = new File(tmpDir, s);
InputStream fis = getClass().getResourceAsStream("/native/" + getOS() + "/solc/" + s);
Files.copy(fis, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
if (solc == null) {
// first file in the list denotes executable
solc = targetFile;
solc.setExecutable(true);
try (Scanner scanner = new Scanner(is)) {
while (scanner.hasNext()) {
String s = scanner.next();
File targetFile = new File(tmpDir, s);
InputStream fis = getClass().getResourceAsStream("/native/" + getOS() + "/solc/" + s);
Files.copy(fis, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
if (solc == null) {
// first file in the list denotes executable
solc = targetFile;
solc.setExecutable(true);
}
targetFile.deleteOnExit();
}
targetFile.deleteOnExit();
}
}

Expand Down
1 change: 1 addition & 0 deletions ethereumj-core/src/main/java/org/ethereum/vm/VM.java
Expand Up @@ -1404,6 +1404,7 @@ private void dumpLine(OpCode op, long gasBefore, long gasCost, long memWords, Pr
toHexString(key.getNoLeadZeroesData()),
toHexString(details.getStorage().get(key).getNoLeadZeroesData()));
}
break;
default:
break;
}
Expand Down
Expand Up @@ -79,15 +79,16 @@ public void importBlocks() throws Exception {
logger.info("#######################################");
BlockchainImpl blockchain = createBlockchain(GenesisLoader.loadGenesis(
getClass().getResourceAsStream("/genesis/frontier.json")));
Scanner scanner = new Scanner(new FileInputStream("D:\\ws\\ethereumj\\work\\blocks-rec.dmp"));
while (scanner.hasNext()) {
String blockHex = scanner.next();
Block block = new Block(Hex.decode(blockHex));
ImportResult result = blockchain.tryToConnect(block);
if (result != ImportResult.EXIST && result != ImportResult.IMPORTED_BEST) {
throw new RuntimeException(result + ": " + block + "");
try (Scanner scanner = new Scanner(new FileInputStream("D:\\ws\\ethereumj\\work\\blocks-rec.dmp"))) {
while (scanner.hasNext()) {
String blockHex = scanner.next();
Block block = new Block(Hex.decode(blockHex));
ImportResult result = blockchain.tryToConnect(block);
if (result != ImportResult.EXIST && result != ImportResult.IMPORTED_BEST) {
throw new RuntimeException(result + ": " + block + "");
}
System.out.println("Imported " + block.getShortDescr());
}
System.out.println("Imported " + block.getShortDescr());
}
}

Expand Down
3 changes: 1 addition & 2 deletions ethereumj-core/src/test/java/org/ethereum/net/UdpTest.java
Expand Up @@ -202,8 +202,7 @@ public void client() throws Exception {

public static String bindIp() {
String bindIp;
try {
Socket s = new Socket("www.google.com", 80);
try (Socket s = new Socket("www.google.com", 80)) {
bindIp = s.getLocalAddress().getHostAddress();
System.out.printf("UDP local bound to: %s%n", bindIp);
} catch (IOException e) {
Expand Down
Expand Up @@ -538,6 +538,7 @@ public void onRecvMessage(Channel channel, Message message) {
fatalErrors.incrementAndGet();
};
}
break;
default:
break;
}
Expand Down

0 comments on commit 60926e4

Please sign in to comment.