Skip to content

Commit

Permalink
bugfix: Accept Transactions when at the Fray
Browse files Browse the repository at this point in the history
  • Loading branch information
gameofpointers committed Feb 14, 2023
1 parent 8e832c9 commit 00f368c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 2 additions & 5 deletions eth/fetcher/block_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/dominant-strategies/go-quai/common"
"github.com/dominant-strategies/go-quai/common/prque"
"github.com/dominant-strategies/go-quai/consensus"
"github.com/dominant-strategies/go-quai/core"
"github.com/dominant-strategies/go-quai/core/types"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/metrics"
Expand Down Expand Up @@ -823,10 +822,8 @@ func (f *BlockFetcher) importBlocks(peer string, block *types.Block) {
}
// Run the actual import and log any issues
if _, err := f.insertChain(types.Blocks{block}); err != nil {
if err.Error() != core.ErrAddedFutureCache.Error() {
log.Debug("Propagated block import failed", "peer", peer, "number", block.Number(), "hash", hash, "err", err)
return
}
log.Debug("Propagated block import failed", "peer", peer, "number", block.Number(), "hash", hash, "err", err)
return
}
// If import succeeded, broadcast the block
blockAnnounceOutTimer.UpdateSince(block.ReceivedAt)
Expand Down
6 changes: 6 additions & 0 deletions eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ func newHandler(config *handlerConfig) (*handler, error) {
if err == nil {
atomic.StoreUint32(&h.acceptTxs, 1) // Mark initial sync done on any fetcher import
}
// If the error is related to synchronization of sub, we can still accept the transactions
// This is a good approximation on reaching the fray
if err != nil && err.Error() == core.ErrAddedFutureCache.Error() {
atomic.StoreUint32(&h.acceptTxs, 1) // Mark initial sync done on any fetcher import
return n, nil
}
return n, err
}
h.blockFetcher = fetcher.NewBlockFetcher(false, nil, h.core.GetBlockByHash, validator, h.BroadcastBlock, heighter, nil, inserter, h.removePeer)
Expand Down

0 comments on commit 00f368c

Please sign in to comment.