mirror of
https://github.com/status-im/ethereumj-personal.git
synced 2025-02-05 00:23:38 +00:00
Update comment in conflict state
This commit is contained in:
parent
bb2b8d7cb1
commit
d895438c31
@ -164,6 +164,29 @@ public class Blockchain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void applyBlock(Block block) {
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (Transaction tx : block.getTransactionsList()) {
|
||||||
|
stateLogger.debug("apply block: [ {} ] tx: [ {} ] ", block.getNumber(), i);
|
||||||
|
applyTransaction(block, tx, block.getCoinbase());
|
||||||
|
repository.dumpState(block.getNumber(), i, tx.getHash());
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
// miner reward
|
||||||
|
if (repository.getAccountState(block.getCoinbase()) == null)
|
||||||
|
repository.createAccount(block.getCoinbase());
|
||||||
|
repository.addBalance(block.getCoinbase(), Block.BLOCK_REWARD);
|
||||||
|
|
||||||
|
for (Block uncle : block.getUncleList()) {
|
||||||
|
repository.addBalance(uncle.getCoinbase(), Block.UNCLE_REWARD);
|
||||||
|
}
|
||||||
|
|
||||||
|
repository.dumpState(block.getNumber(), 0,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
public void storeBlock(Block block) {
|
public void storeBlock(Block block) {
|
||||||
/* Debug check to see if the state is still as expected */
|
/* Debug check to see if the state is still as expected */
|
||||||
if(logger.isWarnEnabled()) {
|
if(logger.isWarnEnabled()) {
|
||||||
@ -171,7 +194,7 @@ public class Blockchain {
|
|||||||
String worldStateRootHash = Hex.toHexString(WorldManager.getInstance().getRepository().getWorldState().getRootHash());
|
String worldStateRootHash = Hex.toHexString(WorldManager.getInstance().getRepository().getWorldState().getRootHash());
|
||||||
if(!blockStateRootHash.equals(worldStateRootHash)){
|
if(!blockStateRootHash.equals(worldStateRootHash)){
|
||||||
logger.error("ERROR: STATE CONFLICT! block: {} worldstate {} mismatch", block.getNumber(), worldStateRootHash);
|
logger.error("ERROR: STATE CONFLICT! block: {} worldstate {} mismatch", block.getNumber(), worldStateRootHash);
|
||||||
// Last conflict on block 1157 -> worldstate b1d9a978451ef04c1639011d9516473d51c608dbd25906c89be791707008d2de
|
// Last conflict on block 1501 -> worldstate 27920c6c7acd42c8a7ac8a835d4c0e0a45590deb094d6b72a8493fac5d7a3654
|
||||||
repository.close();
|
repository.close();
|
||||||
System.exit(-1); // Don't add block
|
System.exit(-1); // Don't add block
|
||||||
}
|
}
|
||||||
@ -183,33 +206,7 @@ public class Blockchain {
|
|||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("block added {}", block.toFlatString());
|
logger.debug("block added {}", block.toFlatString());
|
||||||
logger.info("*** Block chain size: [ {} ]", this.getSize());
|
logger.info("*** Last block added [ #{} ]", block.getNumber());
|
||||||
}
|
|
||||||
|
|
||||||
public void applyBlock(Block block) {
|
|
||||||
|
|
||||||
if(block.getNumber() == 1157)
|
|
||||||
logger.debug("block 1157");
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for (Transaction tx : block.getTransactionsList()) {
|
|
||||||
stateLogger.debug("apply block: [ {} ] tx: [ {} ] ", block.getNumber(), i);
|
|
||||||
applyTransaction(block, tx, block.getCoinbase());
|
|
||||||
repository.dumpState(block.getNumber(), i, tx.getHash());
|
|
||||||
++i;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// miner reward
|
|
||||||
if (repository.getAccountState(block.getCoinbase()) == null)
|
|
||||||
repository.createAccount(block.getCoinbase());
|
|
||||||
repository.addBalance(block.getCoinbase(), Block.BLOCK_REWARD);
|
|
||||||
for (Block uncle : block.getUncleList()) {
|
|
||||||
repository.addBalance(uncle.getCoinbase(), Block.UNCLE_REWARD);
|
|
||||||
}
|
|
||||||
|
|
||||||
repository.dumpState(block.getNumber(), 0,
|
|
||||||
null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyTransaction(Block block, Transaction tx, byte[] coinbase) {
|
public void applyTransaction(Block block, Transaction tx, byte[] coinbase) {
|
||||||
@ -285,6 +282,7 @@ public class Blockchain {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
repository.addBalance(senderAddress, gasDebit.negate());
|
repository.addBalance(senderAddress, gasDebit.negate());
|
||||||
|
senderAccount.subFromBalance(gasDebit); // balance will be read again below
|
||||||
|
|
||||||
// The coinbase get the gas cost
|
// The coinbase get the gas cost
|
||||||
if (coinbase != null)
|
if (coinbase != null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user