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

[Merged by Bors] - refactor: remove unused error return #6233

Closed
wants to merge 2 commits into from
Closed
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
13 changes: 7 additions & 6 deletions txs/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@
if err := addToProposal(db, lid, pid, tids); err != nil {
return fmt.Errorf("linking txs to proposal: %w", err)
}
return c.updateLayer(lid, types.EmptyBlockID, tids)
c.updateLayer(lid, types.EmptyBlockID, tids)
return nil
}

// LinkTXsWithBlock associates the transactions to a block.
Expand All @@ -632,27 +633,27 @@
return nil
}
if err := addToBlock(db, lid, bid, tids); err != nil {
return err
return fmt.Errorf("add to block: %w", err)

Check warning on line 636 in txs/cache.go

View check run for this annotation

Codecov / codecov/patch

txs/cache.go#L636

Added line #L636 was not covered by tests
}
return c.updateLayer(lid, bid, tids)
c.updateLayer(lid, bid, tids)
return nil
}

// updateLayer associates the transactions to a layer and optionally a block.
// A transaction is tagged with a layer when it's included in a proposal/block.
// If a transaction is included in multiple proposals/blocks in different layers,
// the lowest layer is retained.
func (c *Cache) updateLayer(lid types.LayerID, bid types.BlockID, tids []types.TransactionID) error {
func (c *Cache) updateLayer(lid types.LayerID, bid types.BlockID, tids []types.TransactionID) {
c.mu.Lock()
defer c.mu.Unlock()

for _, ID := range tids {
if _, ok := c.cachedTXs[ID]; !ok {
// transaction is not considered best in its nonce group
return nil
return

Check warning on line 653 in txs/cache.go

View check run for this annotation

Codecov / codecov/patch

txs/cache.go#L653

Added line #L653 was not covered by tests
}
c.cachedTXs[ID].UpdateLayerMaybe(lid, bid)
}
return nil
}

func (c *Cache) applyEmptyLayer(db *sql.Database, lid types.LayerID) error {
Expand Down
Loading