-
Notifications
You must be signed in to change notification settings - Fork 21k
eth/catalyst: add catalyst API prototype #22641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
d9916d1
fad2587
9a35a22
ccfb737
26ee92a
dfdff92
dae9d1a
de593d0
ce8fff9
0602ca7
8e3adf9
78e41ff
05f75c5
1fdba04
d267c14
5c627ef
24909f0
da28171
3f3e879
ef204fe
8871cb7
40cb7cb
962079c
71165f4
16be944
33c465b
09e3867
2c22b5c
7adf70b
01d16e5
0eda836
0a5bf45
43b88ae
558649e
7b0a22d
77e5444
b75abfe
be735b8
b311fc8
dc8295a
d00d4da
5521b0a
7eea1cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1693,6 +1693,44 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) { | |
return n, err | ||
} | ||
|
||
// InsertChainWithoutSealVerification works exactly the same | ||
// except for seal verification, seal verification is omitted | ||
func (bc *BlockChain) InsertChainWithoutSealVerification(chain types.Blocks) (int, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is ever called with a slice containing one block, AFAICT. Might just make it take a single block on input, and throw away the whole sanity check loop |
||
// Sanity check that we have something meaningful to import | ||
if len(chain) == 0 { | ||
return 0, nil | ||
} | ||
|
||
bc.blockProcFeed.Send(true) | ||
defer bc.blockProcFeed.Send(false) | ||
|
||
// Remove already known canon-blocks | ||
var ( | ||
block, prev *types.Block | ||
) | ||
// Do a sanity check that the provided chain is actually ordered and linked | ||
for i := 1; i < len(chain); i++ { | ||
block = chain[i] | ||
prev = chain[i-1] | ||
if block.NumberU64() != prev.NumberU64()+1 || block.ParentHash() != prev.Hash() { | ||
// Chain broke ancestry, log a message (programming error) and skip insertion | ||
log.Error("Non contiguous block insert", "number", block.Number(), "hash", block.Hash(), | ||
"parent", block.ParentHash(), "prevnumber", prev.Number(), "prevhash", prev.Hash()) | ||
|
||
return 0, fmt.Errorf("non contiguous insert: item %d is #%d [%x…], item %d is #%d [%x…] (parent [%x…])", i-1, prev.NumberU64(), | ||
prev.Hash().Bytes()[:4], i, block.NumberU64(), block.Hash().Bytes()[:4], block.ParentHash().Bytes()[:4]) | ||
} | ||
} | ||
// Pre-checks passed, start the full block imports | ||
bc.wg.Add(1) | ||
bc.chainmu.Lock() | ||
n, err := bc.insertChain(chain, false) | ||
bc.chainmu.Unlock() | ||
bc.wg.Done() | ||
|
||
return n, err | ||
} | ||
|
||
// insertChain is the internal implementation of InsertChain, which assumes that | ||
// 1) chains are contiguous, and 2) The chain mutex is held. | ||
// | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,9 +220,14 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { | |
EventMux: eth.eventMux, | ||
Checkpoint: checkpoint, | ||
Whitelist: config.Whitelist, | ||
Catalyst: config.Catalyst, | ||
}); err != nil { | ||
return nil, err | ||
} | ||
if config.Catalyst { | ||
// Activate transaction processing by default in catalyst mode | ||
eth.handler.acceptTxs = 1 | ||
} | ||
eth.miner = miner.New(eth, &config.Miner, chainConfig, eth.EventMux(), eth.engine, eth.isLocalBlock) | ||
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData)) | ||
|
||
|
@@ -337,6 +342,11 @@ func (s *Ethereum) APIs() []rpc.API { | |
Version: "1.0", | ||
Service: s.netRPCService, | ||
Public: true, | ||
}, { | ||
Namespace: "eth2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See https://notes.ethereum.org/@n0ble/rayonism-the-merge-spec There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The preference is to use |
||
Version: "1.0", | ||
Service: NewEth2API(s), | ||
Public: true, | ||
}, | ||
}...) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activate
--nodiscover
when set