general info expose by AdminInfo been
This commit is contained in:
parent
c9ea4c07d4
commit
b75078e53d
|
@ -5,6 +5,7 @@ import org.ethereum.db.BlockStore;
|
|||
import org.ethereum.facade.Blockchain;
|
||||
import org.ethereum.facade.Repository;
|
||||
import org.ethereum.listener.EthereumListener;
|
||||
import org.ethereum.manager.AdminInfo;
|
||||
import org.ethereum.manager.WorldManager;
|
||||
import org.ethereum.net.BlockQueue;
|
||||
import org.ethereum.net.server.ChannelManager;
|
||||
|
@ -96,6 +97,9 @@ public class BlockchainImpl implements Blockchain {
|
|||
@Autowired
|
||||
ProgramInvokeFactory programInvokeFactory;
|
||||
|
||||
@Autowired
|
||||
private AdminInfo adminInfo;
|
||||
|
||||
private List<Chain> altChains = new ArrayList<>();
|
||||
private List<Block> garbage = new ArrayList<>();
|
||||
|
||||
|
@ -381,6 +385,7 @@ public class BlockchainImpl implements Blockchain {
|
|||
if(!blockStateRootHash.equals(worldStateRootHash)){
|
||||
|
||||
stateLogger.warn("BLOCK: STATE CONFLICT! block: {} worldstate {} mismatch", block.getNumber(), worldStateRootHash);
|
||||
adminInfo.lostConsensus();
|
||||
|
||||
// in case of rollback hard move the root
|
||||
// Block parentBlock = blockStore.getBlockByHash(block.getParentHash());
|
||||
|
@ -583,8 +588,9 @@ public class BlockchainImpl implements Blockchain {
|
|||
byte[] contractAddress, byte[] coinbase, boolean initResults) {
|
||||
|
||||
if (result.getException() != null) {
|
||||
stateLogger.debug("contract run halted by OutOfGas: contract={}",
|
||||
Hex.toHexString(contractAddress));
|
||||
stateLogger.debug("contract run halted by Exception: contract: [{}], exception: [{}]",
|
||||
Hex.toHexString(contractAddress),
|
||||
result.getException());
|
||||
throw result.getException();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.ethereum.facade;
|
|||
import org.ethereum.core.Transaction;
|
||||
import org.ethereum.core.Wallet;
|
||||
import org.ethereum.listener.EthereumListener;
|
||||
import org.ethereum.manager.AdminInfo;
|
||||
import org.ethereum.net.client.PeerClient;
|
||||
import org.ethereum.net.peerdiscovery.PeerInfo;
|
||||
import org.ethereum.net.server.ChannelManager;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetAddress;
|
||||
|
@ -128,6 +130,8 @@ public interface Ethereum {
|
|||
public void init();
|
||||
// 2. // is blockchain still loading - if buffer is not empty
|
||||
|
||||
public AdminInfo getAdminInfo();
|
||||
|
||||
public ChannelManager getChannelManager();
|
||||
|
||||
}
|
||||
|
|
|
@ -11,9 +11,11 @@ import org.ethereum.config.SystemProperties;
|
|||
import org.ethereum.core.Transaction;
|
||||
import org.ethereum.core.Wallet;
|
||||
import org.ethereum.listener.EthereumListener;
|
||||
import org.ethereum.manager.AdminInfo;
|
||||
import org.ethereum.manager.WorldManager;
|
||||
import org.ethereum.net.client.PeerClient;
|
||||
import org.ethereum.net.peerdiscovery.PeerInfo;
|
||||
import org.ethereum.net.server.ChannelManager;
|
||||
import org.ethereum.net.server.PeerServer;
|
||||
import org.ethereum.net.submit.TransactionExecutor;
|
||||
import org.ethereum.net.submit.TransactionTask;
|
||||
|
@ -42,6 +44,12 @@ public class EthereumImpl implements Ethereum {
|
|||
@Autowired
|
||||
WorldManager worldManager;
|
||||
|
||||
@Autowired
|
||||
AdminInfo adminInfo;
|
||||
|
||||
@Autowired
|
||||
ChannelManager channelManager;
|
||||
|
||||
@Autowired
|
||||
PeerServer peerServer;
|
||||
|
||||
|
@ -227,6 +235,13 @@ public class EthereumImpl implements Ethereum {
|
|||
return worldManager.getRepository();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminInfo getAdminInfo() {
|
||||
return adminInfo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChannelManager getChannelManager() {
|
||||
return channelManager;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package org.ethereum.manager;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* www.ethergit.com
|
||||
*
|
||||
* @author: Roman Mandeleil
|
||||
* Created on: 11/12/2014 11:24
|
||||
*/
|
||||
@Component
|
||||
public class AdminInfo {
|
||||
|
||||
|
||||
private long startupTimeStamp;
|
||||
private boolean consensus = true;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
startupTimeStamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public long getStartupTimeStamp() {
|
||||
return startupTimeStamp;
|
||||
}
|
||||
|
||||
public boolean isConsensus() {
|
||||
return consensus;
|
||||
}
|
||||
|
||||
public void lostConsensus(){
|
||||
consensus = false;
|
||||
}
|
||||
}
|
|
@ -54,6 +54,9 @@ public class WorldManager {
|
|||
|
||||
@Autowired
|
||||
private ChannelManager channelManager;
|
||||
|
||||
@Autowired
|
||||
private AdminInfo adminInfo;
|
||||
|
||||
private final Set<Transaction> pendingTransactions = Collections.synchronizedSet(new HashSet<Transaction>());
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ public class Channel {
|
|||
MessageEncoder messageEncoder;
|
||||
|
||||
|
||||
private long startupTS;
|
||||
|
||||
|
||||
public Channel() {
|
||||
|
@ -55,6 +56,8 @@ public class Channel {
|
|||
p2pHandler.setMsgQueue(msgQueue);
|
||||
ethHandler.setMsgQueue(msgQueue);
|
||||
shhHandler.setMsgQueue(msgQueue);
|
||||
|
||||
startupTS = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public P2pHandler getP2pHandler() {
|
||||
|
@ -101,4 +104,7 @@ public class Channel {
|
|||
ethHandler.doSync();
|
||||
}
|
||||
|
||||
public long getStartupTS() {
|
||||
return startupTS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,4 +111,8 @@ public class ChannelManager {
|
|||
}
|
||||
bestChannel.ethSync();
|
||||
}
|
||||
|
||||
public List<Channel> getChannels() {
|
||||
return channels;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -343,7 +343,10 @@ public class Program {
|
|||
if (result != null &&
|
||||
result.getException() != null &&
|
||||
result.getException() instanceof Program.OutOfGasException) {
|
||||
logger.info("contract run halted by OutOfGas: new contract init ={}" , Hex.toHexString(newAddress));
|
||||
logger.debug("contract run halted by Exception: contract: [{}], exception: [{}]",
|
||||
Hex.toHexString(newAddress),
|
||||
result.getException());
|
||||
|
||||
|
||||
track.rollback();
|
||||
stackPushZero();
|
||||
|
@ -443,7 +446,10 @@ public class Program {
|
|||
if (result != null &&
|
||||
result.getException() != null &&
|
||||
result.getException() instanceof Program.OutOfGasException) {
|
||||
gasLogger.info("contract run halted by OutOfGas: contract={}" , Hex.toHexString(contextAddress));
|
||||
gasLogger.debug("contract run halted by Exception: contract: [{}], exception: [{}]",
|
||||
Hex.toHexString(contextAddress),
|
||||
result.getException());
|
||||
|
||||
|
||||
trackRepository.rollback();
|
||||
stackPushZero();
|
||||
|
|
Loading…
Reference in New Issue