Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin committed May 15, 2024
1 parent 7dc2193 commit 302e506
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mempool/v1/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (txmp *TxMempool) RemoveTxByKey(txKey types.TxKey) error {
// The caller must hold txmp.mtx excluxively.
func (txmp *TxMempool) removeTxByKey(key types.TxKey) error {
if elt, ok := txmp.txByKey[key]; ok {
w := elt.Value.(*WrappedTx)
w, _ := elt.Value.(*WrappedTx)
delete(txmp.txByKey, key)
delete(txmp.txBySender, w.sender)
txmp.txs.Remove(elt)
Expand Down
9 changes: 5 additions & 4 deletions settlement/dymension/dymension.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (d *HubClient) PostBatch(batch *types.Batch, daClient da.Client, daResult *
case <-d.ctx.Done():
return d.ctx.Err()
default:
err := d.submitBatch(msgUpdateState)
err := d.broadcastBatch(msgUpdateState)
if err != nil {
d.logger.Error(
"Submit batch",
Expand Down Expand Up @@ -275,7 +275,8 @@ func (d *HubClient) PostBatch(batch *types.Batch, daClient da.Client, daResult *
// Check if the batch was accepted by the settlement layer, and we've just missed the event.
includedBatch, err := d.pollForBatchInclusion(batch.EndHeight)
if err == nil && !includedBatch {
batchAcceptanceAttempts -= 1
// no error, but still not included
batchAcceptanceAttempts--
if batchAcceptanceAttempts > 0 {
timer.Reset(d.batchAcceptanceTimeout)
continue
Expand Down Expand Up @@ -403,7 +404,7 @@ func (d *HubClient) GetSequencers(rollappID string) ([]*types.Sequencer, error)
return sequencersList, nil
}

func (d *HubClient) submitBatch(msgUpdateState *rollapptypes.MsgUpdateState) error {
func (d *HubClient) broadcastBatch(msgUpdateState *rollapptypes.MsgUpdateState) error {
err := d.RunWithRetry(func() error {
txResp, err := d.client.BroadcastTx(d.config.DymAccountName, msgUpdateState)
if err != nil || txResp.Code != 0 {
Expand All @@ -421,7 +422,7 @@ func (d *HubClient) eventHandler() {
if err != nil {
panic("Error subscribing to events")
}
//TODO: add defer unsubscribeAll
// TODO: add defer unsubscribeAll

for {
select {
Expand Down

0 comments on commit 302e506

Please sign in to comment.