Skip to content

Commit 368c918

Browse files
fix(transaction): reduce rpc calls in IsSynced
1 parent 682154c commit 368c918

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pkg/transaction/backend.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ type Backend interface {
2828
// with the given maxDelay as the maximum duration we can be behind the block
2929
// time.
3030
func IsSynced(ctx context.Context, backend Backend, maxDelay time.Duration) (bool, time.Time, error) {
31-
number, err := backend.BlockNumber(ctx)
32-
if err != nil {
33-
return false, time.Time{}, err
34-
}
35-
header, err := backend.HeaderByNumber(ctx, big.NewInt(int64(number)))
31+
header, err := backend.HeaderByNumber(ctx, nil)
3632
if errors.Is(err, ethereum.NotFound) {
3733
return false, time.Time{}, nil
3834
}

0 commit comments

Comments
 (0)