Resolve rebase conflict and little cleanup

This commit is contained in:
nicksavers 2014-10-31 20:13:00 +01:00
parent a63f100dda
commit e6a229bf21
6 changed files with 69 additions and 77 deletions

View File

@ -8,8 +8,8 @@ import java.util.Map;
* <br>
* The codes for these commands are the first byte in every packet.
*
* @see <a href="https://github.com/ethereum/wiki/wiki/Wire-Protocol">
* https://github.com/ethereum/wiki/wiki/Wire-Protocol</a>
* @see <a href="https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol">
* https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol</a>
*/
public enum EthMessageCodes {
@ -20,8 +20,6 @@ public enum EthMessageCodes {
* send after the initial handshake and prior to any ethereum related messages. */
STATUS(0x00),
/* Ethereum */
/** [+0x01] Request the peer to send all transactions
* currently in the queue. */
GET_TRANSACTIONS(0x01),
@ -88,11 +86,7 @@ public enum EthMessageCodes {
}
public static boolean inRange(byte code){
if (code >= STATUS.asByte() && code <= PACKET_COUNT.asByte())
return true;
else
return false;
return code >= STATUS.asByte() && code <= PACKET_COUNT.asByte();
}
public static void setOffset(byte offset){

View File

@ -63,7 +63,7 @@ public class MessageFactory {
switch (receivedCommand) {
case STATUS:
break;
case MESSAGE:
case MESSAGES:
break;
case ADD_FILTER:
break;

View File

@ -7,13 +7,13 @@ import java.util.Map;
* A list of commands for the Ethereum network protocol.
* <br>
* The codes for these commands are the first byte in every packet.
*
* @see <a href="https://github.com/ethereum/wiki/wiki/Wire-Protocol">
* https://github.com/ethereum/wiki/wiki/Wire-Protocol</a>
* ÐΞV
* @see <a href="https://github.com/ethereum/wiki/wiki/ÐΞVp2p-Wire-Protocol">
* https://github.com/ethereum/wiki/wiki/ÐΞVp2p-Wire-Protocol</a>
*/
public enum P2pMessageCodes {
/* P2P */
/* P2P protocol */
/** [0x00, P2P_VERSION, CLIEND_ID, CAPS, LISTEN_PORT, CLIENT_ID] <br>
* First packet sent over the connection, and sent once by both sides.

View File

@ -22,12 +22,12 @@ public class ProgramInvokeFactory {
private static final Logger logger = LoggerFactory.getLogger("VM");
/**
* This attribute defines the number of resursive calls allowed in the EVM
* This attribute defines the number of recursive calls allowed in the EVM
* Note: For the JVM to reach this level without a StackOverflow exception,
* ethereumj may need to be started with a JVM argument to increase
* the stack size. For example: -Xss10m
*/
private static final int MAX_CREATE_CALL_DEPTH = 1024;
private static final int MAX_DEPTH = 1024;
// Invocation by the wire tx
public static ProgramInvoke createProgramInvoke(Transaction tx, Block block, Repository repository) {
@ -180,12 +180,11 @@ public class ProgramInvokeFactory {
gasLimit.longValue());
}
int newCallDepth = program.invokeData.getCallDeep() + 1;
if (newCallDepth > MAX_CREATE_CALL_DEPTH)
if (program.invokeData.getCallDeep() >= MAX_DEPTH)
throw program.new OutOfGasException();
return new ProgramInvokeImpl(address, origin, caller, balance, gasPrice, gas, callValue,
data, lastHash, coinbase, timestamp, number, difficulty, gasLimit,
repository, newCallDepth);
repository, program.invokeData.getCallDeep()+1);
}
}

View File

@ -166,9 +166,8 @@ public class VM {
program.spendGas(gasCost, op.name());
// Avoid overflows
if(newMemSize.compareTo(MAX_GAS) == 1) {
if(newMemSize.compareTo(MAX_GAS) == 1)
throw program.new OutOfGasException();
}
// memory gas calc
long memoryUsage = (newMemSize.longValue() + 31) / 32 * 32;