mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
Adjusted difficulty and skip get tx messages
This commit is contained in:
parent
a76b7dadae
commit
25e6c4eff8
@ -264,6 +264,7 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error {
|
|||||||
|
|
||||||
expd := CalcDifficulty(block, parent)
|
expd := CalcDifficulty(block, parent)
|
||||||
if expd.Cmp(block.Header().Difficulty) < 0 {
|
if expd.Cmp(block.Header().Difficulty) < 0 {
|
||||||
|
fmt.Println("parent\n", parent)
|
||||||
return fmt.Errorf("Difficulty check failed for block %v, %v", block.Header().Difficulty, expd)
|
return fmt.Errorf("Difficulty check failed for block %v, %v", block.Header().Difficulty, expd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ func CalcDifficulty(block, parent *types.Block) *big.Int {
|
|||||||
|
|
||||||
bh, ph := block.Header(), parent.Header()
|
bh, ph := block.Header(), parent.Header()
|
||||||
adjust := new(big.Int).Rsh(ph.Difficulty, 10)
|
adjust := new(big.Int).Rsh(ph.Difficulty, 10)
|
||||||
if bh.Time >= ph.Time+5 {
|
if bh.Time >= ph.Time+13 {
|
||||||
diff.Sub(ph.Difficulty, adjust)
|
diff.Sub(ph.Difficulty, adjust)
|
||||||
} else {
|
} else {
|
||||||
diff.Add(ph.Difficulty, adjust)
|
diff.Add(ph.Difficulty, adjust)
|
||||||
|
@ -122,7 +122,7 @@ func (self *ethProtocol) handle() error {
|
|||||||
defer msg.Discard()
|
defer msg.Discard()
|
||||||
|
|
||||||
switch msg.Code {
|
switch msg.Code {
|
||||||
|
case GetTxMsg: // ignore
|
||||||
case StatusMsg:
|
case StatusMsg:
|
||||||
return self.protoError(ErrExtraStatusMsg, "")
|
return self.protoError(ErrExtraStatusMsg, "")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user