Checkpoint challenge timeout: remove td check after handshake (#2807)

* remove td check after handshake

* save
This commit is contained in:
Alex Sharov 2021-10-10 22:14:50 +07:00 committed by GitHub
parent bd099e4e3e
commit 64178ff80d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 11 deletions

View File

@ -17,7 +17,6 @@ import (
"syscall"
"time"
"github.com/holiman/uint256"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/grpcutil"
@ -213,13 +212,7 @@ func handShake(
return fmt.Errorf("%w", err1)
}
td, overflow := uint256.FromBig(reply.TD)
if overflow {
return fmt.Errorf("reply.TD higher than 2^256-1")
}
startSyncWithThisPeer := td.Cmp(ourTD) > 0 && startSync != nil
if startSyncWithThisPeer {
if startSync != nil {
if err := startSync(reply.Head); err != nil {
return err
}

2
go.mod
View File

@ -36,7 +36,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/julienschmidt/httprouter v1.3.0
github.com/kevinburke/go-bindata v3.21.0+incompatible
github.com/ledgerwatch/erigon-lib v0.0.0-20211010031123-2f008a96e9e6
github.com/ledgerwatch/erigon-lib v0.0.0-20211010115821-b4f62e5662a6
github.com/ledgerwatch/log/v3 v3.3.1
github.com/ledgerwatch/secp256k1 v0.0.0-20210626115225-cd5cd00ed72d
github.com/logrusorgru/aurora/v3 v3.0.0

4
go.sum
View File

@ -497,8 +497,8 @@ github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3P
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/ledgerwatch/erigon-lib v0.0.0-20211010031123-2f008a96e9e6 h1:DMhNrQilUOF5e0TmJY5nfz1xfUctqEAmFG0zWrFtl0Q=
github.com/ledgerwatch/erigon-lib v0.0.0-20211010031123-2f008a96e9e6/go.mod h1:R65M7eqckpbB9f4+WG6ftXVgPX2U1RhgrKE8lYgLzPI=
github.com/ledgerwatch/erigon-lib v0.0.0-20211010115821-b4f62e5662a6 h1:wtWGYHlhndsw6gYGu9zeBPQ6gzjSd7KUAOC3RvepRlY=
github.com/ledgerwatch/erigon-lib v0.0.0-20211010115821-b4f62e5662a6/go.mod h1:R65M7eqckpbB9f4+WG6ftXVgPX2U1RhgrKE8lYgLzPI=
github.com/ledgerwatch/log/v3 v3.3.1 h1:HmvLeTEvtCtqSvtu4t/a5MAdcLfeBcbIeowXbLYuzLc=
github.com/ledgerwatch/log/v3 v3.3.1/go.mod h1:S3VJqhhVX32rbp1JyyvhJou12twtFwNEPESBgpbNkRk=
github.com/ledgerwatch/secp256k1 v0.0.0-20210626115225-cd5cd00ed72d h1:/IKMrJdfRsoYNc36PXqP4xMH3vhW/8IQyBKGQbKZUno=