adapting for poc-7 final (eth:45)
This commit is contained in:
parent
f443bb6157
commit
da2bdb02a0
|
@ -40,7 +40,6 @@ public class Block {
|
||||||
private BlockHeader header;
|
private BlockHeader header;
|
||||||
|
|
||||||
/* Transactions */
|
/* Transactions */
|
||||||
private List<TransactionReceipt> txReceiptList = new CopyOnWriteArrayList<>() ;
|
|
||||||
private List<Transaction> transactionsList = new CopyOnWriteArrayList<>();
|
private List<Transaction> transactionsList = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
/* Uncles */
|
/* Uncles */
|
||||||
|
@ -62,11 +61,11 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block(byte[] parentHash, byte[] unclesHash, byte[] coinbase, byte[] logsBloom,
|
public Block(byte[] parentHash, byte[] unclesHash, byte[] coinbase, byte[] logsBloom,
|
||||||
byte[] difficulty, long number, long minGasPrice, long gasLimit,
|
byte[] difficulty, long number, long gasLimit,
|
||||||
long gasUsed, long timestamp, byte[] extraData, byte[] nonce,
|
long gasUsed, long timestamp, byte[] extraData, byte[] nonce,
|
||||||
List<Transaction> transactionsList, List<BlockHeader> uncleList) {
|
List<Transaction> transactionsList, List<BlockHeader> uncleList) {
|
||||||
this.header = new BlockHeader(parentHash, unclesHash, coinbase, logsBloom,
|
this.header = new BlockHeader(parentHash, unclesHash, coinbase, logsBloom,
|
||||||
difficulty, number, minGasPrice, gasLimit, gasUsed,
|
difficulty, number, gasLimit, gasUsed,
|
||||||
timestamp, extraData, nonce);
|
timestamp, extraData, nonce);
|
||||||
|
|
||||||
this.transactionsList = transactionsList;
|
this.transactionsList = transactionsList;
|
||||||
|
@ -192,11 +191,6 @@ public class Block {
|
||||||
return this.header.getNumber();
|
return this.header.getNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getMinGasPrice() {
|
|
||||||
if (!parsed) parseRLP();
|
|
||||||
return this.header.getMinGasPrice();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getGasLimit() {
|
public long getGasLimit() {
|
||||||
if (!parsed) parseRLP();
|
if (!parsed) parseRLP();
|
||||||
return this.header.getGasLimit();
|
return this.header.getGasLimit();
|
||||||
|
@ -227,11 +221,6 @@ public class Block {
|
||||||
return transactionsList;
|
return transactionsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TransactionReceipt> getTxReceiptList() {
|
|
||||||
if (!parsed) parseRLP();
|
|
||||||
return txReceiptList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<BlockHeader> getUncleList() {
|
public List<BlockHeader> getUncleList() {
|
||||||
if (!parsed) parseRLP();
|
if (!parsed) parseRLP();
|
||||||
return uncleList;
|
return uncleList;
|
||||||
|
@ -252,11 +241,6 @@ public class Block {
|
||||||
toStringBuff.append("BlockData [ ");
|
toStringBuff.append("BlockData [ ");
|
||||||
toStringBuff.append("hash=" + ByteUtil.toHexString(this.getHash())).append("\n");
|
toStringBuff.append("hash=" + ByteUtil.toHexString(this.getHash())).append("\n");
|
||||||
toStringBuff.append(header.toString());
|
toStringBuff.append(header.toString());
|
||||||
|
|
||||||
for (TransactionReceipt txReceipt : getTxReceiptList()) {
|
|
||||||
toStringBuff.append("\n");
|
|
||||||
toStringBuff.append(txReceipt.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
toStringBuff.append("\nUncles [\n");
|
toStringBuff.append("\nUncles [\n");
|
||||||
for (BlockHeader uncle : getUncleList()){
|
for (BlockHeader uncle : getUncleList()){
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.ethereum.core;
|
||||||
|
|
||||||
import org.ethereum.crypto.HashUtil;
|
import org.ethereum.crypto.HashUtil;
|
||||||
import org.ethereum.util.RLP;
|
import org.ethereum.util.RLP;
|
||||||
import org.ethereum.util.RLPItem;
|
|
||||||
import org.ethereum.util.RLPList;
|
import org.ethereum.util.RLPList;
|
||||||
import org.ethereum.util.Utils;
|
import org.ethereum.util.Utils;
|
||||||
|
|
||||||
|
@ -51,10 +50,6 @@ public class BlockHeader {
|
||||||
/* A scalar value equal to the number of ancestor blocks.
|
/* A scalar value equal to the number of ancestor blocks.
|
||||||
* The genesis block has a number of zero */
|
* The genesis block has a number of zero */
|
||||||
private long number;
|
private long number;
|
||||||
/* A scalar value equal to the minimum price of gas a transaction
|
|
||||||
* must have provided in order to be sufficient for inclusion
|
|
||||||
* by this miner in this block */
|
|
||||||
private long minGasPrice;
|
|
||||||
/* A scalar value equal to the current limit of gas expenditure per block */
|
/* A scalar value equal to the current limit of gas expenditure per block */
|
||||||
private long gasLimit;
|
private long gasLimit;
|
||||||
/* A scalar value equal to the total gas used in transactions in this block */
|
/* A scalar value equal to the total gas used in transactions in this block */
|
||||||
|
@ -68,42 +63,41 @@ public class BlockHeader {
|
||||||
|
|
||||||
public BlockHeader(RLPList rlpHeader) {
|
public BlockHeader(RLPList rlpHeader) {
|
||||||
|
|
||||||
this.parentHash = ((RLPItem) rlpHeader.get(0)).getRLPData();
|
this.parentHash = rlpHeader.get(0).getRLPData();
|
||||||
this.unclesHash = ((RLPItem) rlpHeader.get(1)).getRLPData();
|
this.unclesHash = rlpHeader.get(1).getRLPData();
|
||||||
this.coinbase = ((RLPItem) rlpHeader.get(2)).getRLPData();
|
this.coinbase = rlpHeader.get(2).getRLPData();
|
||||||
this.stateRoot = ((RLPItem) rlpHeader.get(3)).getRLPData();
|
this.stateRoot = rlpHeader.get(3).getRLPData();
|
||||||
|
|
||||||
this.txTrieRoot = ((RLPItem) rlpHeader.get(4)).getRLPData();
|
this.txTrieRoot = rlpHeader.get(4).getRLPData();
|
||||||
if(this.txTrieRoot == null)
|
if(this.txTrieRoot == null)
|
||||||
this.txTrieRoot = EMPTY_TRIE_HASH;
|
this.txTrieRoot = EMPTY_TRIE_HASH;
|
||||||
|
|
||||||
this.recieptTrieRoot = ((RLPItem) rlpHeader.get(5)).getRLPData();
|
this.recieptTrieRoot = rlpHeader.get(5).getRLPData();
|
||||||
if(this.recieptTrieRoot == null)
|
if(this.recieptTrieRoot == null)
|
||||||
this.recieptTrieRoot = EMPTY_TRIE_HASH;
|
this.recieptTrieRoot = EMPTY_TRIE_HASH;
|
||||||
|
|
||||||
this.logsBloom = ((RLPItem) rlpHeader.get(6)).getRLPData();
|
this.logsBloom = rlpHeader.get(6).getRLPData();
|
||||||
this.difficulty = ((RLPItem) rlpHeader.get(7)).getRLPData();
|
this.difficulty = rlpHeader.get(7).getRLPData();
|
||||||
|
|
||||||
byte[] nrBytes = ((RLPItem) rlpHeader.get(8)).getRLPData();
|
byte[] nrBytes = rlpHeader.get(8).getRLPData();
|
||||||
byte[] gpBytes = ((RLPItem) rlpHeader.get(9)).getRLPData();
|
byte[] glBytes = rlpHeader.get(9).getRLPData();
|
||||||
byte[] glBytes = ((RLPItem) rlpHeader.get(10)).getRLPData();
|
byte[] guBytes = rlpHeader.get(10).getRLPData();
|
||||||
byte[] guBytes = ((RLPItem) rlpHeader.get(11)).getRLPData();
|
byte[] tsBytes = rlpHeader.get(11).getRLPData();
|
||||||
byte[] tsBytes = ((RLPItem) rlpHeader.get(12)).getRLPData();
|
|
||||||
|
|
||||||
this.number = nrBytes == null ? 0 : (new BigInteger(1, nrBytes)).longValue();
|
this.number = nrBytes == null ? 0 : (new BigInteger(1, nrBytes)).longValue();
|
||||||
this.minGasPrice = gpBytes == null ? 0 : (new BigInteger(1, gpBytes)).longValue();
|
|
||||||
this.gasLimit = glBytes == null ? 0 : (new BigInteger(1, glBytes)).longValue();
|
this.gasLimit = glBytes == null ? 0 : (new BigInteger(1, glBytes)).longValue();
|
||||||
this.gasUsed = guBytes == null ? 0 : (new BigInteger(1, guBytes)).longValue();
|
this.gasUsed = guBytes == null ? 0 : (new BigInteger(1, guBytes)).longValue();
|
||||||
this.timestamp = tsBytes == null ? 0 : (new BigInteger(1, tsBytes)).longValue();
|
this.timestamp = tsBytes == null ? 0 : (new BigInteger(1, tsBytes)).longValue();
|
||||||
|
|
||||||
this.extraData = ((RLPItem) rlpHeader.get(13)).getRLPData();
|
this.extraData = rlpHeader.get(12).getRLPData();
|
||||||
this.nonce = ((RLPItem) rlpHeader.get(14)).getRLPData();
|
this.nonce = rlpHeader.get(13).getRLPData();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockHeader(byte[] parentHash, byte[] unclesHash, byte[] coinbase,
|
public BlockHeader(byte[] parentHash, byte[] unclesHash, byte[] coinbase,
|
||||||
byte[] logsBloom, byte[] difficulty, long number,
|
byte[] logsBloom, byte[] difficulty, long number,
|
||||||
long minGasPrice, long gasLimit, long gasUsed, long timestamp,
|
long gasLimit, long gasUsed, long timestamp,
|
||||||
byte[] extraData, byte[] nonce) {
|
byte[] extraData, byte[] nonce) {
|
||||||
this.parentHash = parentHash;
|
this.parentHash = parentHash;
|
||||||
this.unclesHash = unclesHash;
|
this.unclesHash = unclesHash;
|
||||||
|
@ -111,7 +105,6 @@ public class BlockHeader {
|
||||||
this.logsBloom = logsBloom;
|
this.logsBloom = logsBloom;
|
||||||
this.difficulty = difficulty;
|
this.difficulty = difficulty;
|
||||||
this.number = number;
|
this.number = number;
|
||||||
this.minGasPrice = minGasPrice;
|
|
||||||
this.gasLimit = gasLimit;
|
this.gasLimit = gasLimit;
|
||||||
this.gasUsed = gasUsed;
|
this.gasUsed = gasUsed;
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
|
@ -200,12 +193,6 @@ public class BlockHeader {
|
||||||
public void setNumber(long number) {
|
public void setNumber(long number) {
|
||||||
this.number = number;
|
this.number = number;
|
||||||
}
|
}
|
||||||
public long getMinGasPrice() {
|
|
||||||
return minGasPrice;
|
|
||||||
}
|
|
||||||
public void setMinGasPrice(long minGasPrice) {
|
|
||||||
this.minGasPrice = minGasPrice;
|
|
||||||
}
|
|
||||||
public long getGasLimit() {
|
public long getGasLimit() {
|
||||||
return gasLimit;
|
return gasLimit;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +243,6 @@ public class BlockHeader {
|
||||||
byte[] logsBloom = RLP.encodeElement(this.logsBloom);
|
byte[] logsBloom = RLP.encodeElement(this.logsBloom);
|
||||||
byte[] difficulty = RLP.encodeElement(this.difficulty);
|
byte[] difficulty = RLP.encodeElement(this.difficulty);
|
||||||
byte[] number = RLP.encodeBigInteger(BigInteger.valueOf(this.number));
|
byte[] number = RLP.encodeBigInteger(BigInteger.valueOf(this.number));
|
||||||
byte[] minGasPrice = RLP.encodeBigInteger(BigInteger.valueOf(this.minGasPrice));
|
|
||||||
byte[] gasLimit = RLP.encodeBigInteger(BigInteger.valueOf(this.gasLimit));
|
byte[] gasLimit = RLP.encodeBigInteger(BigInteger.valueOf(this.gasLimit));
|
||||||
byte[] gasUsed = RLP.encodeBigInteger(BigInteger.valueOf(this.gasUsed));
|
byte[] gasUsed = RLP.encodeBigInteger(BigInteger.valueOf(this.gasUsed));
|
||||||
byte[] timestamp = RLP.encodeBigInteger(BigInteger.valueOf(this.timestamp));
|
byte[] timestamp = RLP.encodeBigInteger(BigInteger.valueOf(this.timestamp));
|
||||||
|
@ -265,11 +251,11 @@ public class BlockHeader {
|
||||||
byte[] nonce = RLP.encodeElement(this.nonce);
|
byte[] nonce = RLP.encodeElement(this.nonce);
|
||||||
return RLP.encodeList(parentHash, unclesHash, coinbase,
|
return RLP.encodeList(parentHash, unclesHash, coinbase,
|
||||||
stateRoot, txTrieRoot, recieptTrieRoot, logsBloom, difficulty, number,
|
stateRoot, txTrieRoot, recieptTrieRoot, logsBloom, difficulty, number,
|
||||||
minGasPrice, gasLimit, gasUsed, timestamp, extraData, nonce);
|
gasLimit, gasUsed, timestamp, extraData, nonce);
|
||||||
} else {
|
} else {
|
||||||
return RLP.encodeList(parentHash, unclesHash, coinbase,
|
return RLP.encodeList(parentHash, unclesHash, coinbase,
|
||||||
stateRoot, txTrieRoot, recieptTrieRoot, logsBloom, difficulty, number,
|
stateRoot, txTrieRoot, recieptTrieRoot, logsBloom, difficulty, number,
|
||||||
minGasPrice, gasLimit, gasUsed, timestamp, extraData);
|
gasLimit, gasUsed, timestamp, extraData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +274,6 @@ public class BlockHeader {
|
||||||
toStringBuff.append(" reciptsTrieHash=" + toHexString(recieptTrieRoot)).append("\n");
|
toStringBuff.append(" reciptsTrieHash=" + toHexString(recieptTrieRoot)).append("\n");
|
||||||
toStringBuff.append(" difficulty=" + toHexString(difficulty)).append("\n");
|
toStringBuff.append(" difficulty=" + toHexString(difficulty)).append("\n");
|
||||||
toStringBuff.append(" number=" + number).append("\n");
|
toStringBuff.append(" number=" + number).append("\n");
|
||||||
toStringBuff.append(" minGasPrice=" + minGasPrice).append("\n");
|
|
||||||
toStringBuff.append(" gasLimit=" + gasLimit).append("\n");
|
toStringBuff.append(" gasLimit=" + gasLimit).append("\n");
|
||||||
toStringBuff.append(" gasUsed=" + gasUsed).append("\n");
|
toStringBuff.append(" gasUsed=" + gasUsed).append("\n");
|
||||||
toStringBuff.append(" timestamp=" + timestamp + " (" + Utils.longToDateTime(timestamp) + ")").append("\n");
|
toStringBuff.append(" timestamp=" + timestamp + " (" + Utils.longToDateTime(timestamp) + ")").append("\n");
|
||||||
|
@ -305,7 +290,6 @@ public class BlockHeader {
|
||||||
toStringBuff.append(" txTrieHash=" + toHexString(txTrieRoot)).append("");
|
toStringBuff.append(" txTrieHash=" + toHexString(txTrieRoot)).append("");
|
||||||
toStringBuff.append(" difficulty=" + toHexString(difficulty)).append("");
|
toStringBuff.append(" difficulty=" + toHexString(difficulty)).append("");
|
||||||
toStringBuff.append(" number=" + number).append("");
|
toStringBuff.append(" number=" + number).append("");
|
||||||
toStringBuff.append(" minGasPrice=" + minGasPrice).append("");
|
|
||||||
toStringBuff.append(" gasLimit=" + gasLimit).append("");
|
toStringBuff.append(" gasLimit=" + gasLimit).append("");
|
||||||
toStringBuff.append(" gasUsed=" + gasUsed).append("");
|
toStringBuff.append(" gasUsed=" + gasUsed).append("");
|
||||||
toStringBuff.append(" timestamp=" + timestamp).append("");
|
toStringBuff.append(" timestamp=" + timestamp).append("");
|
||||||
|
|
|
@ -100,12 +100,6 @@ public class BlockchainImpl implements Blockchain {
|
||||||
private List<Chain> altChains = new ArrayList<>();
|
private List<Chain> altChains = new ArrayList<>();
|
||||||
private List<Block> garbage = new ArrayList<>();
|
private List<Block> garbage = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getGasPrice() {
|
|
||||||
// In case of the genesis block we don't want to rely on the min gas price
|
|
||||||
return bestBlock.isGenesis() ? bestBlock.getMinGasPrice() : INITIAL_MIN_GAS_PRICE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] getBestBlockHash() {
|
public byte[] getBestBlockHash() {
|
||||||
return getBestBlock().getHash();
|
return getBestBlock().getHash();
|
||||||
|
@ -541,6 +535,9 @@ public class BlockchainImpl implements Blockchain {
|
||||||
if (CONFIG.playVM())
|
if (CONFIG.playVM())
|
||||||
vm.play(program);
|
vm.play(program);
|
||||||
|
|
||||||
|
// todo: recepit save logs
|
||||||
|
// todo: receipt calc and save blooms
|
||||||
|
|
||||||
program.saveProgramTraceToFile(Hex.toHexString(tx.getHash()));
|
program.saveProgramTraceToFile(Hex.toHexString(tx.getHash()));
|
||||||
ProgramResult result = program.getResult();
|
ProgramResult result = program.getResult();
|
||||||
applyProgramResult(result, gasDebit, gasPrice, trackTx,
|
applyProgramResult(result, gasDebit, gasPrice, trackTx,
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class Genesis extends Block {
|
||||||
public static byte[] DIFFICULTY = BigInteger.valueOf(2).pow(17).toByteArray();
|
public static byte[] DIFFICULTY = BigInteger.valueOf(2).pow(17).toByteArray();
|
||||||
public static long NUMBER = 0;
|
public static long NUMBER = 0;
|
||||||
public static long MIN_GAS_PRICE = 0;
|
public static long MIN_GAS_PRICE = 0;
|
||||||
public static long GAS_LIMIT = 1000000;
|
public static long GAS_LIMIT = 0;
|
||||||
public static long GAS_USED = 0;
|
public static long GAS_USED = 0;
|
||||||
public static long TIMESTAMP = 0;
|
public static long TIMESTAMP = 0;
|
||||||
public static byte[] EXTRA_DATA = new byte[0];
|
public static byte[] EXTRA_DATA = new byte[0];
|
||||||
|
@ -62,7 +62,7 @@ public class Genesis extends Block {
|
||||||
|
|
||||||
private Genesis() {
|
private Genesis() {
|
||||||
super(PARENT_HASH, UNCLES_HASH, COINBASE, LOG_BLOOM, DIFFICULTY,
|
super(PARENT_HASH, UNCLES_HASH, COINBASE, LOG_BLOOM, DIFFICULTY,
|
||||||
NUMBER, MIN_GAS_PRICE, GAS_LIMIT, GAS_USED, TIMESTAMP,
|
NUMBER, GAS_LIMIT, GAS_USED, TIMESTAMP,
|
||||||
EXTRA_DATA, NONCE, null, null);
|
EXTRA_DATA, NONCE, null, null);
|
||||||
|
|
||||||
Trie state = new TrieImpl(null);
|
Trie state = new TrieImpl(null);
|
||||||
|
|
|
@ -19,7 +19,6 @@ public interface Blockchain {
|
||||||
public void tryToConnect(Block block);
|
public void tryToConnect(Block block);
|
||||||
public void storeBlock(Block block);
|
public void storeBlock(Block block);
|
||||||
public Block getBlockByNumber(long blockNr);
|
public Block getBlockByNumber(long blockNr);
|
||||||
public long getGasPrice();
|
|
||||||
public void setBestBlock(Block block);
|
public void setBestBlock(Block block);
|
||||||
public Block getBestBlock();
|
public Block getBestBlock();
|
||||||
public BlockQueue getQueue();
|
public BlockQueue getQueue();
|
||||||
|
|
|
@ -73,7 +73,6 @@ public class JSONHelper {
|
||||||
blockNode.put("difficulty", new BigInteger(1, block.calcDifficulty()).toString());
|
blockNode.put("difficulty", new BigInteger(1, block.calcDifficulty()).toString());
|
||||||
blockNode.put("extra_data", "0x");
|
blockNode.put("extra_data", "0x");
|
||||||
blockNode.put("gas_used", String.valueOf(gasUsed));
|
blockNode.put("gas_used", String.valueOf(gasUsed));
|
||||||
blockNode.put("min_gas_price", String.valueOf(block.getMinGasPrice()));
|
|
||||||
blockNode.put("nonce", "0x" + Hex.toHexString(block.getNonce()));
|
blockNode.put("nonce", "0x" + Hex.toHexString(block.getNonce()));
|
||||||
blockNode.put("number", String.valueOf(block.getNumber()));
|
blockNode.put("number", String.valueOf(block.getNumber()));
|
||||||
blockNode.put("prevhash", "0x" + Hex.toHexString(block.getParentHash()));
|
blockNode.put("prevhash", "0x" + Hex.toHexString(block.getParentHash()));
|
||||||
|
|
|
@ -42,7 +42,7 @@ import static org.ethereum.net.message.StaticMessages.GET_TRANSACTIONS_MESSAGE;
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class EthHandler extends SimpleChannelInboundHandler<EthMessage> {
|
public class EthHandler extends SimpleChannelInboundHandler<EthMessage> {
|
||||||
|
|
||||||
public final static byte VERSION = 43;
|
public final static byte VERSION = 45;
|
||||||
public final static byte NETWORK_ID = 0x0;
|
public final static byte NETWORK_ID = 0x0;
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger("net");
|
private final static Logger logger = LoggerFactory.getLogger("net");
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class ShhHandler extends SimpleChannelInboundHandler<ShhMessage> {
|
public class ShhHandler extends SimpleChannelInboundHandler<ShhMessage> {
|
||||||
|
|
||||||
public final static byte VERSION = 2;
|
public final static byte VERSION = 1;
|
||||||
private MessageQueue msgQueue = null;
|
private MessageQueue msgQueue = null;
|
||||||
|
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
|
|
@ -31,12 +31,12 @@ log4j.logger.peerdiscovery = TRACE
|
||||||
log4j.logger.peermonitor = TRACE
|
log4j.logger.peermonitor = TRACE
|
||||||
log4j.logger.java.nio = ERROR
|
log4j.logger.java.nio = ERROR
|
||||||
log4j.logger.io.netty = ERROR
|
log4j.logger.io.netty = ERROR
|
||||||
log4j.logger.wire = ERROR
|
log4j.logger.wire = DEBUG
|
||||||
log4j.logger.VM = ERROR
|
log4j.logger.VM = ERROR
|
||||||
log4j.logger.main = ERROR
|
log4j.logger.main = ERROR
|
||||||
log4j.logger.trie = ERROR
|
log4j.logger.trie = ERROR
|
||||||
log4j.logger.state = INFO
|
log4j.logger.state = INFO
|
||||||
log4j.logger.repository = TRACE
|
log4j.logger.repository = ERROR
|
||||||
log4j.logger.blockchain = DEBUG
|
log4j.logger.blockchain = DEBUG
|
||||||
log4j.logger.txs = ERROR
|
log4j.logger.txs = ERROR
|
||||||
log4j.logger.ui = ERROR
|
log4j.logger.ui = ERROR
|
||||||
|
|
|
@ -6,6 +6,8 @@ import org.ethereum.core.BlockchainImpl;
|
||||||
import org.ethereum.core.Genesis;
|
import org.ethereum.core.Genesis;
|
||||||
import org.ethereum.facade.Blockchain;
|
import org.ethereum.facade.Blockchain;
|
||||||
import org.ethereum.manager.WorldManager;
|
import org.ethereum.manager.WorldManager;
|
||||||
|
import org.ethereum.util.RLP;
|
||||||
|
import org.ethereum.util.RLPList;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -54,8 +56,8 @@ public class BlockTest {
|
||||||
|
|
||||||
|
|
||||||
// https://ethereum.etherpad.mozilla.org/12
|
// https://ethereum.etherpad.mozilla.org/12
|
||||||
private String PoC7_GENESIS_HEX_RLP_ENCODED = "f9012ff9012aa00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0c67c70f5d7d3049337d1dcc0503a249881120019a8e7322774dbfe57b463718ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b84000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0";
|
private String PoC7_GENESIS_HEX_RLP_ENCODED = "f9012bf90126a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0c67c70f5d7d3049337d1dcc0503a249881120019a8e7322774dbfe57b463718ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b84000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008080808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0";
|
||||||
private String PoC7_GENESIS_HEX_HASH = "955f36d073ccb026b78ab3424c15cf966a7563aa270413859f78702b9e8e22cb";
|
private String PoC7_GENESIS_HEX_HASH = "4713ad990f439d0b559eb1a3ff0c744dc763df1914ec0aaaf3de3f43ef3c952c";
|
||||||
|
|
||||||
String block_2 = "f8b5f8b1a0cf4b25b08b39350304fe12a16e4216c01a426f8f3dbf0d392b5b45"
|
String block_2 = "f8b5f8b1a0cf4b25b08b39350304fe12a16e4216c01a426f8f3dbf0d392b5b45"
|
||||||
+ "8ffb6a399da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a1"
|
+ "8ffb6a399da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a1"
|
||||||
|
@ -125,6 +127,8 @@ public class BlockTest {
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
Block genesis = Genesis.getInstance();
|
Block genesis = Genesis.getInstance();
|
||||||
|
logger.info(genesis.toString());
|
||||||
|
|
||||||
logger.info("genesis hash: [{}]", Hex.toHexString(genesis.getHash()));
|
logger.info("genesis hash: [{}]", Hex.toHexString(genesis.getHash()));
|
||||||
logger.info("genesis rlp: [{}]", Hex.toHexString(genesis.getEncoded()));
|
logger.info("genesis rlp: [{}]", Hex.toHexString(genesis.getEncoded()));
|
||||||
assertEquals(PoC7_GENESIS_HEX_HASH, Hex.toHexString(genesis.getHash()));
|
assertEquals(PoC7_GENESIS_HEX_HASH, Hex.toHexString(genesis.getHash()));
|
||||||
|
|
|
@ -105,14 +105,14 @@ public class MinerTest {
|
||||||
byte[] stateRoot = Hex.decode("50188ab86bdf164ac90eb2835a04a8930aae5393c3a2ef1166fb95028f9456b8");
|
byte[] stateRoot = Hex.decode("50188ab86bdf164ac90eb2835a04a8930aae5393c3a2ef1166fb95028f9456b8");
|
||||||
|
|
||||||
Block newBlock = new Block(parentHash, unclesHash, coinbase, null,
|
Block newBlock = new Block(parentHash, unclesHash, coinbase, null,
|
||||||
difficulty, number, minGasPrice, gasLimit, gasUsed, timestamp,
|
difficulty, number, gasLimit, gasUsed, timestamp,
|
||||||
null, nonce, null, null);
|
null, nonce, null, null);
|
||||||
// Setting stateRoot manually, because don't have state available.
|
// Setting stateRoot manually, because don't have state available.
|
||||||
return newBlock;
|
return newBlock;
|
||||||
} else{
|
} else{
|
||||||
|
|
||||||
Block newBlock = new Block(lastBlock.getHash(), lastBlock.getUnclesHash(), lastBlock.getCoinbase(), null,
|
Block newBlock = new Block(lastBlock.getHash(), lastBlock.getUnclesHash(), lastBlock.getCoinbase(), null,
|
||||||
lastBlock.getDifficulty(), lastBlock.getNumber() + 1, lastBlock.getMinGasPrice(),
|
lastBlock.getDifficulty(), lastBlock.getNumber() + 1,
|
||||||
lastBlock.getGasLimit(), lastBlock.getGasUsed(), lastBlock.getTimestamp(),
|
lastBlock.getGasLimit(), lastBlock.getGasUsed(), lastBlock.getTimestamp(),
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class MinerThread implements Runnable {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Block newBlock = new Block(lastBlock.getHash(), lastBlock.getUnclesHash(), coinbase, lastBlock.getLogBloom(),
|
Block newBlock = new Block(lastBlock.getHash(), lastBlock.getUnclesHash(), coinbase, lastBlock.getLogBloom(),
|
||||||
difficulty , lastBlock.getNumber() + 1, lastBlock.getMinGasPrice(),
|
difficulty , lastBlock.getNumber() + 1,
|
||||||
lastBlock.getGasLimit(), lastBlock.getGasUsed(), System.currentTimeMillis() / 1000,
|
lastBlock.getGasLimit(), lastBlock.getGasUsed(), System.currentTimeMillis() / 1000,
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue