Update checkpoint sync for merge (#4085)

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
pull/4161/head
matkt 2 years ago committed by GitHub
parent 45ce87e5b2
commit f885c46713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      config/src/main/resources/goerli.json
  2. 6
      config/src/main/resources/mainnet.json
  3. 6
      config/src/main/resources/ropsten.json
  4. 5
      config/src/main/resources/sepolia.json
  5. 8
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionService.java

@ -22,9 +22,9 @@
]
},
"checkpoint": {
"hash": "0x2ae30061bdfc7f6dad5b07361dce436502eb0fde68645de12bae4929be619188",
"number": 6720000,
"totalDifficulty": "0x967F81",
"hash": "0x50e55c39a725f062af438c5332a5c5bec9a36d02c829ee6ac2cc27d1db719446",
"number": 4350000,
"totalDifficulty": "0x61DBBF",
"_comment": "must be the beginning of an epoch"
}
},

@ -35,9 +35,9 @@
]
},
"checkpoint": {
"hash": "0x844d581cb00058d19f0584fb582fa2de208876ee56bbae27446a679baf4633f4",
"number": 14700000,
"totalDifficulty": "0xA2539264C62BF98CFC6"
"hash": "0x44bca881b07a6a09f83b130798072441705d9a665c5ac8bdf2f39a3cdf3bee29",
"number": 11052984,
"totalDifficulty": "0x3D103014E5C74E5E196"
}
},
"nonce": "0x42",

@ -23,9 +23,9 @@
]
},
"checkpoint": {
"hash": "0x43de216f876d897e59b9757dd24186e5b53be28bc425ca6a966335b48daaa50c",
"number": 12200000,
"totalDifficulty": "0x928D05243C1CF4"
"hash": "0xeefb1f70bf7bed6394ed7d6f812f422aa37bf7680e1b75fa551d40e849f10a87",
"number": 12269949,
"totalDifficulty": "0x94730AAE0106DC"
}
},
"nonce": "0x0000000000000042",

@ -19,6 +19,11 @@
"enode://9246d00bc8fd1742e5ad2428b80fc4dc45d786283e05ef6edbd9002cbc335d40998444732fbe921cb88e1d2c73d1b1de53bae6a2237996e9bfe14f871baf7066@18.168.182.86:30303",
"enode://ec66ddcf1a974950bd4c782789a7e04f8aa7110a72569b6e65fcd51e937e74eed303b1ea734e4d19cfaec9fbff9b6ee65bf31dcb50ba79acce9dd63a6aca61c7@52.14.151.177:30303"
]
},
"checkpoint": {
"hash": "0x491ebac1b7f9c0eb426047a495dc577140cb3e09036cd3f7266eda86b635d9fa",
"number": 1273020,
"totalDifficulty": "0x13DE1653E7D280"
}
},
"alloc":{

@ -22,7 +22,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.request.
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.chain.BlockAddedEvent;
import org.hyperledger.besu.ethereum.chain.BlockAddedObserver;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import java.util.ArrayList;
import java.util.Collections;
@ -46,8 +46,8 @@ public class NewBlockHeadersSubscriptionService implements BlockAddedObserver {
@Override
public void onBlockAdded(final BlockAddedEvent event) {
if (event.isNewCanonicalHead()) {
final List<Block> blocks = new ArrayList<>();
Block blockPtr = event.getBlock();
final List<BlockHeader> blocks = new ArrayList<>();
BlockHeader blockPtr = event.getBlock().getHeader();
while (!blockPtr.getHash().equals(event.getCommonAncestorHash())) {
blocks.add(blockPtr);
@ -55,7 +55,7 @@ public class NewBlockHeadersSubscriptionService implements BlockAddedObserver {
blockPtr =
blockchainQueries
.getBlockchain()
.getBlockByHash(blockPtr.getHeader().getParentHash())
.getBlockHeader(blockPtr.getParentHash())
.orElseThrow(() -> new IllegalStateException("The block was on a orphaned chain."));
}

Loading…
Cancel
Save