Skip to content
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

try forcing index syncing if both hashes are 0'd #21

Draft
wants to merge 1 commit into
base: hemi
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"time"
"unicode"

"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/hemilabs/heminetwork/cmd/btctool/bdf"
"github.com/hemilabs/heminetwork/service/tbc"
Expand Down Expand Up @@ -405,6 +406,16 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
// blocks have been received then the else condition below will be hit.
continue
} else {
emptyHash := &chainhash.Hash{}

if emptyHash.IsEqual(&utxoHH.Hash) && emptyHash.IsEqual(&txHH.Hash) {
log.Info("both utxo and header hash are zeroed, not synced yet, force syncing")
err := vm.TBCFullNode.SyncIndexersToHash(ctx.Context, &genesisHash)
if err != nil {
log.Crit("could not sync indexers to hash", "error", err)
}
}

// All blocks are available to index up to the genesis header, so move the indexer forward
err := vm.TBCIndexToHeader(genesisHeader)
if err != nil {
Expand Down