Merge with pull req#4

This commit is contained in:
romanman 2014-05-17 09:47:27 +03:00
parent 1e8697ae8b
commit 5108f8d797
2 changed files with 16 additions and 3 deletions

View File

@ -127,8 +127,8 @@ public class Block {
byte[] glBytes = ((RLPItem) params.get(9)).getData(); byte[] glBytes = ((RLPItem) params.get(9)).getData();
byte[] guBytes = ((RLPItem) params.get(10)).getData(); byte[] guBytes = ((RLPItem) params.get(10)).getData();
this.timestamp = (new BigInteger(tsBytes)).longValue(); this.timestamp = tsBytes == null ? 0 : (new BigInteger(tsBytes)).longValue();
this.number = (new BigInteger(nrBytes)).longValue(); this.number = nrBytes == null ? 0 : (new BigInteger(nrBytes)).longValue();
this.minGasPrice = gpBytes == null ? 0 : (new BigInteger(gpBytes)).longValue(); this.minGasPrice = gpBytes == null ? 0 : (new BigInteger(gpBytes)).longValue();
this.gasLimit = glBytes == null ? 0 : (new BigInteger(glBytes)).longValue(); this.gasLimit = glBytes == null ? 0 : (new BigInteger(glBytes)).longValue();
this.gasUsed = guBytes == null ? 0 : (new BigInteger(guBytes)).longValue(); this.gasUsed = guBytes == null ? 0 : (new BigInteger(guBytes)).longValue();
@ -224,11 +224,17 @@ public class Block {
public List<Transaction> getTransactionsList() { public List<Transaction> getTransactionsList() {
if (!parsed) parseRLP(); if (!parsed) parseRLP();
if (transactionsList == null) {
this.transactionsList = new ArrayList<Transaction>();
}
return transactionsList; return transactionsList;
} }
public List<Block> getUncleList() { public List<Block> getUncleList() {
if (!parsed) parseRLP(); if (!parsed) parseRLP();
if (uncleList == null) {
this.uncleList = new ArrayList<Block>();
}
return uncleList; return uncleList;
} }
@ -247,11 +253,11 @@ public class Block {
", stateHash=" + Utils.toHexString(stateRoot) + ", stateHash=" + Utils.toHexString(stateRoot) +
", txTrieHash=" + Utils.toHexString(txTrieRoot) + ", txTrieHash=" + Utils.toHexString(txTrieRoot) +
", difficulty=" + Utils.toHexString(difficulty) + ", difficulty=" + Utils.toHexString(difficulty) +
", timestamp=" + timestamp +
", number=" + number + ", number=" + number +
", minGasPrice=" + minGasPrice + ", minGasPrice=" + minGasPrice +
", gasLimit=" + gasLimit + ", gasLimit=" + gasLimit +
", gasUsed=" + gasUsed + ", gasUsed=" + gasUsed +
", timestamp=" + timestamp +
", extraData=" + Utils.toHexString(extraData) + ", extraData=" + Utils.toHexString(extraData) +
", nonce=" + Utils.toHexString(nonce) + ", nonce=" + Utils.toHexString(nonce) +
']'; ']';

View File

@ -32,6 +32,13 @@ public class ConnectionConsole extends JFrame implements PeerListener{
private RSyntaxTextArea textArea; private RSyntaxTextArea textArea;
/**
* ERROR (exceptions) WARN (when something happens that's not supposed to)
* INFO (wire output)
* DEBUG (test/displaying intermediate values),
* TRACE (start/end method)
*/
public ConnectionConsole() { public ConnectionConsole() {
final ConnectionConsole thisConsole = this; final ConnectionConsole thisConsole = this;