diff --git a/pkg/updater/updater.go b/pkg/updater/updater.go index c924844..a020682 100644 --- a/pkg/updater/updater.go +++ b/pkg/updater/updater.go @@ -152,9 +152,9 @@ func (u *Updater) Start(ctx context.Context) <-chan struct{} { for i := 0; i < len(commitmentTxnHashes) && ok; i++ { if newPos, found := txnsInBlock[commitmentTxnHashes[i]]; !found || newPos != txnsInBlock[commitmentTxnHashes[0]]+i { ok = false + break } } - err = u.winnerRegister.AddSettlement( ctx, index[:], diff --git a/pkg/updater/updater_test.go b/pkg/updater/updater_test.go index 441b93b..c6150ff 100644 --- a/pkg/updater/updater_test.go +++ b/pkg/updater/updater_test.go @@ -73,12 +73,28 @@ func TestUpdater(t *testing.T) { commitments := make(map[string]preconf.PreConfCommitmentStorePreConfCommitment) for i, txn := range txns { idxBytes := getIdxBytes(int64(i)) + commitments[string(idxBytes[:])] = preconf.PreConfCommitmentStorePreConfCommitment{ Commiter: builderAddr, TxnHash: txn.Hash().Hex(), } } + // constructing bundles + for i := 0; i < 10; i++ { + idxBytes := getIdxBytes(int64(i + 10)) + + bundle := txns[i].Hash().Hex() + for j := i + 1; j < 10; j++ { + bundle += "," + txns[j].Hash().Hex() + } + + commitments[string(idxBytes[:])] = preconf.PreConfCommitmentStorePreConfCommitment{ + Commiter: builderAddr, + TxnHash: bundle, + } + } + testWinnerRegister := &testWinnerRegister{ winners: make(chan updater.BlockWinner), settlements: make(chan testSettlement), @@ -117,7 +133,7 @@ func TestUpdater(t *testing.T) { count := 0 for { - if count == 10 { + if count == 20 { break } settlement := <-testWinnerRegister.settlements