commitUncle¶
| Source (upstream pre-purge) | Current | |
|---|---|---|
| File | miner/worker.go |
uncles_pow.go |
| Symbol | worker.commitUncle |
uncleEnv.commitUncle |
| Ref | dde2da0ef~1 |
etc/v1.17.3-full-node |
Uncle validation. Char-for-char from pre-purge except the receiver (uncleEnv) and the dropped isTTDReached merge guard (ETC is perpetual PoW).
3-way merge — purge → getc ← upstream¶
pre-purgefork-only
// commitUncle validates an uncle header against the block being sealed and adds
// it to the uncle set, returning an error if it is not acceptable.
func (env *uncleEnv) commitUncle(uncle *types.Header) error {
↗ hash := uncle.Hash()
if _, exist := env.uncles[hash]; exist {
return errors.New("uncle not unique")
}
if env.header.ParentHash == uncle.ParentHash {
return errors.New("uncle is sibling")
}
if !env.ancestors.Contains(uncle.ParentHash) {
return errors.New("uncle's parent unknown")
}
if env.family.Contains(hash) {
return errors.New("uncle already included")
}
env.uncles[hash] = uncle
return nil
}
core-geth validation — +3 -5
| | | |---|---| | File | [`worker.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/miner/worker.go) | | Symbol | `worker.commitUncle` | | Ref | `v1.12.20` |--- a/core-geth/miner/worker.go
+++ b/etc/miner/uncles_pow.go
@@ -1,8 +1,6 @@
-// commitUncle adds the given block to uncle block set, returns error if failed to add.
-func (w *worker) commitUncle(env *environment, uncle *types.Header) error {
- if w.isTTDReached(env.header) {
- return errors.New("ignore uncle for beacon block")
- }
+// commitUncle validates an uncle header against the block being sealed and adds
+// it to the uncle set, returning an error if it is not acceptable.
+func (env *uncleEnv) commitUncle(uncle *types.Header) error {
hash := uncle.Hash()
if _, exist := env.uncles[hash]; exist {
return errors.New("uncle not unique")