Skip to content

Commit

Permalink
fix: check client state for channel open close event
Browse files Browse the repository at this point in the history
  • Loading branch information
ALPAC-4 committed Jan 8, 2025
1 parent a48fc2f commit f58ad8d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
25 changes: 15 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/db/controller/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { UpdateClientEvent, ClientTable } from 'src/types'
import { Header } from 'cosmjs-types/ibc/lightclients/tendermint/v1/tendermint'
import { RESTClient } from 'src/lib/restClient'
import { PacketController } from './packet'
import { ChannelController } from './channel'

export class ClientController {
static tableName = 'client'
Expand Down Expand Up @@ -33,8 +34,10 @@ export class ClientController {
])
insert(DB, ClientController.tableName, client)

// to recheck expired packets
// to recheck packets
PacketController.resetPacketInProgress()
// to recheck channel
ChannelController.resetPacketInProgress()

return client
}
Expand Down
4 changes: 3 additions & 1 deletion src/workers/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ export class WalletWorker {
filteredChannelOpenCloseEvents
.sort((a, b) => b.state - a.state) // to make execute close first
.filter(
(event) => connectionClientMap[event.connection_id] !== undefined
(event) =>
updateClientMsgs[connectionClientMap[event.connection_id]] !==
undefined
) // filter expired client
.map((event) => {
const clientId = connectionClientMap[event.connection_id]
Expand Down

0 comments on commit f58ad8d

Please sign in to comment.