Skip to content

Commit

Permalink
we don't care about timestamp in snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomedica committed Sep 9, 2024
1 parent dcc9705 commit 4b30492
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions x/auth/ante/unorderedtx/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,9 @@ func (m *Manager) exportSnapshot(height uint64, snapshotWriter func([]byte) erro
w := bufio.NewWriter(&buf)

keys := slices.SortedFunc(maps.Keys(m.txHashes), func(i, j TxHash) int { return bytes.Compare(i[:], j[:]) })
timestamp := time.Unix(int64(height), 0)
for _, txHash := range keys {
timeoutTime := m.txHashes[txHash]
if timestamp.After(timeoutTime) {
// skip expired txs that have yet to be purged
continue
}

// right now we dont have access block time at this flow, so we would just include the expired txs
// and let it be purge during purge loop
chunk := unorderedTxToBytes(txHash, uint64(timeoutTime.Unix()))
Expand Down
5 changes: 3 additions & 2 deletions x/auth/ante/unorderedtx/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ func (s *Snapshotter) restore(height uint64, payloadReader snapshot.ExtensionPay

timestamp := binary.BigEndian.Uint64(payload[i+txHashSize : i+chunkSize])

// purge any expired txs
if timestamp != 0 && timestamp > height {
// add all txs, we don't care at this point if they are expired,
// we'll let the purge loop handle that
if timestamp != 0 {
s.m.Add(txHash, time.Unix(int64(timestamp), 0))
}

Expand Down

0 comments on commit 4b30492

Please sign in to comment.