Skip to content

Commit

Permalink
fix: review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Alok committed Feb 7, 2024
1 parent 4d8b208 commit 00cd6eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (u *Updater) Start(ctx context.Context) <-chan struct{} {

txnsInBlock := make(map[string]int)
for posInBlock, tx := range blk.Transactions() {
txnsInBlock[tx.Hash().Hex()[2:]] = posInBlock
txnsInBlock[strings.TrimPrefix(tx.Hash().Hex(), "0x")] = posInBlock
}

commitmentIndexes, err := u.preconfClient.GetCommitmentsByBlockNumber(
Expand Down
9 changes: 5 additions & 4 deletions pkg/updater/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"hash"
"math/big"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -79,12 +80,12 @@ func TestUpdater(t *testing.T) {
if i%2 == 0 {
commitments[string(idxBytes[:])] = preconf.PreConfCommitmentStorePreConfCommitment{
Commiter: builderAddr,
TxnHash: txn.Hash().Hex()[2:],
TxnHash: strings.TrimPrefix(txn.Hash().Hex(), "0x"),
}
} else {
commitments[string(idxBytes[:])] = preconf.PreConfCommitmentStorePreConfCommitment{
Commiter: otherBuilderAddr,
TxnHash: txn.Hash().Hex()[2:],
TxnHash: strings.TrimPrefix(txn.Hash().Hex(), "0x"),
}
}
}
Expand All @@ -93,9 +94,9 @@ func TestUpdater(t *testing.T) {
for i := 0; i < 10; i++ {
idxBytes := getIdxBytes(int64(i + 10))

bundle := txns[i].Hash().Hex()[2:]
bundle := strings.TrimPrefix(txns[i].Hash().Hex(), "0x")
for j := i + 1; j < 10; j++ {
bundle += "," + txns[j].Hash().Hex()[2:]
bundle += "," + strings.TrimPrefix(txns[j].Hash().Hex(), "0x")
}

commitments[string(idxBytes[:])] = preconf.PreConfCommitmentStorePreConfCommitment{
Expand Down

0 comments on commit 00cd6eb

Please sign in to comment.