Skip to content

Commit

Permalink
address some feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
poopoothegorilla committed Jan 9, 2024
1 parent 9ed1651 commit 204d5ff
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions common/txmgr/address_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ func NewAddressState[
allTransactions: map[int64]*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]{},
}

as.Lock()
defer as.Unlock()

// Load all unstarted transactions from persistent storage
offset := 0
limit := 50
Expand Down Expand Up @@ -172,11 +169,24 @@ func NewAddressState[
}

func (as *AddressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) close() {
clear(as.idempotencyKeyToTx)

as.unstarted.Close()
as.unstarted = nil
as.inprogress = nil

clear(as.unconfirmed)
clear(as.idempotencyKeyToTx)
clear(as.confirmedMissingReceipt)
clear(as.confirmed)
clear(as.allTransactions)
clear(as.fatalErrored)

as.idempotencyKeyToTx = nil
as.unconfirmed = nil
as.confirmedMissingReceipt = nil
as.confirmed = nil
as.allTransactions = nil
as.fatalErrored = nil
}

func (as *AddressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) CountTransactionsByState(txState txmgrtypes.TxState) int {
Expand Down

0 comments on commit 204d5ff

Please sign in to comment.