From af8f9aef7e51bda974ed0f140edd84b1694cf897 Mon Sep 17 00:00:00 2001 From: nicksavers Date: Wed, 2 Jul 2014 14:47:41 +0200 Subject: [PATCH 1/4] Remove commented code --- .../src/test/java/org/ethereum/trie/MockDB.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/ethereumj-core/src/test/java/org/ethereum/trie/MockDB.java b/ethereumj-core/src/test/java/org/ethereum/trie/MockDB.java index 4933af27..38b5b2c5 100644 --- a/ethereumj-core/src/test/java/org/ethereum/trie/MockDB.java +++ b/ethereumj-core/src/test/java/org/ethereum/trie/MockDB.java @@ -127,18 +127,5 @@ public class MockDB implements DB { */ public int getAddedItems() { return addedItems; - } - -// @Override -// public void forEach(Consumer> action) { -// TODO Auto-generated method stub -// -// } - -// @Override -// public Spliterator> spliterator() { -// TODO Auto-generated method stub -// return null; -// } - + } } \ No newline at end of file From 3ccbb3cdaf0f08953f7cfdc4c232abf4563e7130 Mon Sep 17 00:00:00 2001 From: nicksavers Date: Wed, 2 Jul 2014 14:48:35 +0200 Subject: [PATCH 2/4] Lower case methodnames --- .../src/test/java/org/ethereum/core/WalletTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java b/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java index a25e911e..68f85b30 100644 --- a/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java @@ -19,7 +19,7 @@ import java.math.BigInteger; public class WalletTest { @Test - public void SaveTest1() throws TransformerException, ParserConfigurationException { + public void testSave1() throws TransformerException, ParserConfigurationException { Wallet wallet = new Wallet(); ECKey cowKey = ECKey.fromPrivate(HashUtil.sha3("cow".getBytes())); @@ -41,7 +41,7 @@ public class WalletTest { } @Test - public void LoadTest1() throws TransformerException, + public void testLoad1() throws TransformerException, ParserConfigurationException, IOException, SAXException { Wallet wallet = new Wallet(); wallet.load(); From 3e751ef2b42ade75f665130fb14a1ec3e2d80a62 Mon Sep 17 00:00:00 2001 From: nicksavers Date: Wed, 2 Jul 2014 14:50:29 +0200 Subject: [PATCH 3/4] Use uppercase for public static attribute --- .../src/main/java/org/ethereum/core/Block.java | 2 +- .../java/org/ethereum/manager/WorldManager.java | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/core/Block.java b/ethereumj-core/src/main/java/org/ethereum/core/Block.java index 0e07b3c4..90db08c0 100644 --- a/ethereumj-core/src/main/java/org/ethereum/core/Block.java +++ b/ethereumj-core/src/main/java/org/ethereum/core/Block.java @@ -36,7 +36,7 @@ public class Block { /* A scalar value equal to the mininum limit of gas expenditure per block */ private static long MIN_GAS_LIMIT = 125000L; - public static BigInteger coinbaseReward = BigInteger.valueOf(1500000000000000000L); + public static BigInteger BLOCK_REWARD = BigInteger.valueOf(1500000000000000000L); private BlockHeader header; diff --git a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java index 3ec6b421..11f3916b 100644 --- a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java +++ b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java @@ -27,14 +27,12 @@ import org.slf4j.LoggerFactory; import org.spongycastle.util.encoders.Hex; /** - * * WorldManager is the main class to handle the processing of transactions and * managing the world state. * * www.ethereumJ.com - * - * @author: Roman Mandeleil Created on: 01/06/2014 10:44 - * + * @author: Roman Mandeleil + * Created on: 01/06/2014 10:44 */ public class WorldManager { @@ -48,9 +46,8 @@ public class WorldManager { .synchronizedMap(new HashMap()); public DatabaseImpl chainDB = new DatabaseImpl("blockchain"); - public Repository repository = new Repository(); - + public static WorldManager instance = new WorldManager(); public WorldManager() { @@ -172,8 +169,7 @@ public class WorldManager { if (tx.getValue() != null) { BigInteger senderBalance = repository.getBalance(senderAddress); - BigInteger contractBalance = repository - .getBalance(contractAddress); + BigInteger contractBalance = repository.getBalance(contractAddress); if (senderBalance.compareTo(new BigInteger(1, tx.getValue())) >= 0) { @@ -302,7 +298,7 @@ public class WorldManager { // miner reward if (repository.getAccountState(block.getCoinbase()) == null) repository.createAccount(block.getCoinbase()); - repository.addBalance(block.getCoinbase(), Block.coinbaseReward); + repository.addBalance(block.getCoinbase(), Block.BLOCK_REWARD); int i = 0; List txList = block.getTransactionsList(); From ca4180f49eb5a077209ae1d44971bfc0cafd5a74 Mon Sep 17 00:00:00 2001 From: nicksavers Date: Wed, 2 Jul 2014 15:07:40 +0200 Subject: [PATCH 4/4] Ignore test of incomplete method --- ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java b/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java index 68f85b30..d01f9235 100644 --- a/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/core/WalletTest.java @@ -2,6 +2,7 @@ package org.ethereum.core; import org.ethereum.crypto.ECKey; import org.ethereum.crypto.HashUtil; +import org.junit.Ignore; import org.junit.Test; import org.xml.sax.SAXException; @@ -41,11 +42,11 @@ public class WalletTest { } @Test + @Ignore public void testLoad1() throws TransformerException, ParserConfigurationException, IOException, SAXException { Wallet wallet = new Wallet(); wallet.load(); - System.out.println(); } }