Skip to content

Commit

Permalink
fix test, remove chanFinalised from runSeq
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Sep 21, 2024
1 parent c88e865 commit 422c104
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ type Builder struct {
junoEndpoint string
snBlockTraces []rpc.TracedBlockTransaction

// Todo: simplify the channel logic?
chanNumTxnsToShadow chan int
chanNumTxnsToShadow chan int // Todo: can remove when we execute transactions in blocks
chanFinaliseBlock chan struct{}
chanFinalised chan struct{}

Expand All @@ -70,13 +69,11 @@ func New(privKey *ecdsa.PrivateKey, ownAddr *felt.Felt, bc *blockchain.Blockchai
blockTime time.Duration, pool *mempool.Pool, log utils.Logger,
) *Builder {
return &Builder{
ownAddress: *ownAddr,
privKey: privKey,
blockTime: blockTime,
log: log,
listener: &SelectiveListener{},
chanFinaliseBlock: make(chan struct{}),
chanFinalised: make(chan struct{}, 1),
ownAddress: *ownAddr,
privKey: privKey,
blockTime: blockTime,
log: log,
listener: &SelectiveListener{},

bc: bc,
pool: pool,
Expand Down Expand Up @@ -156,13 +153,12 @@ func (b *Builder) runSequencer(ctx context.Context) error {
case <-ctx.Done():
<-doneListen
return nil
case <-b.chanFinaliseBlock:
case <-time.After(b.blockTime):
b.log.Infof("Finalising new block")
err := b.Finalise(b.Sign)
if err != nil {
return err
}
<-b.chanFinalised
}
}
}
Expand Down

0 comments on commit 422c104

Please sign in to comment.