This commit is contained in:
romanman 2014-08-17 13:10:05 +03:00
commit cad8f4fb7f
3 changed files with 29 additions and 33 deletions

View File

@ -171,7 +171,7 @@ public class Blockchain {
stateLogger.debug("apply block: [ {} ] tx: [ {} ] ", block.getNumber(), i);
totalGasUsed += applyTransaction(block, txr.getTransaction());
if(!Arrays.equals(this.repository.getWorldState().getRootHash(), txr.getPostTxState()))
logger.warn("STATE CONFLICT {}..: {}", Hex.toHexString(txr.getTransaction().getHash()).substring(0, 8),
logger.warn("TX: STATE CONFLICT {}..: {}", Hex.toHexString(txr.getTransaction().getHash()).substring(0, 8),
Hex.toHexString(this.repository.getWorldState().getRootHash()));
if(block.getNumber() >= CONFIG.traceStartBlock())
repository.dumpState(block, totalGasUsed, i++, txr.getTransaction().getHash());
@ -197,8 +197,7 @@ public class Blockchain {
String blockStateRootHash = Hex.toHexString(block.getStateRoot());
String worldStateRootHash = Hex.toHexString(WorldManager.getInstance().getRepository().getWorldState().getRootHash());
if(!blockStateRootHash.equals(worldStateRootHash)){
logger.error("ERROR: STATE CONFLICT! block: {} worldstate {} mismatch", block.getNumber(), worldStateRootHash);
// Last conflict on block 1501 -> worldstate 27920c6c7acd42c8a7ac8a835d4c0e0a45590deb094d6b72a8493fac5d7a3654
logger.warn("BLOCK: STATE CONFLICT! block: {} worldstate {} mismatch", block.getNumber(), worldStateRootHash);
repository.close();
System.exit(-1); // Don't add block
}
@ -309,7 +308,7 @@ public class Blockchain {
}
// 4. THE SIMPLE VALUE/BALANCE CHANGE
// 3. THE SIMPLE VALUE/BALANCE CHANGE
if (tx.getValue() != null) {
BigInteger senderBalance = senderAccount.getBalance();
@ -329,7 +328,7 @@ public class Blockchain {
}
}
// 3. START TRACKING FOR REVERT CHANGES OPTION !!!
// 4. START TRACKING FOR REVERT CHANGES OPTION !!!
Repository trackRepository = repository.getTrack();
trackRepository.startTracking();
long gasUsed = 0;

View File

@ -84,11 +84,8 @@ public class Cache {
}
this.isDirty = false;
// If the nodes grows beyond the 200 entries we simple empty it
// FIXME come up with something better
if (this.nodes.size() > 200) {
this.nodes = new HashMap<>();
}
// TODO come up with a way to clean up this.nodes
// from memory without breaking consensus
}
public void undo() {

View File

@ -99,7 +99,7 @@ coinbase.secret = monkey
# posible values [true/false]
dump.full = false
dump.dir = dmp
dump.block = 1501
dump.block = -1
# clean the dump dir each start
dump.clean.on.restart = true