-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TXM In-memory: step 3-02-PruneUnstartedTxQueue #12227
TXM In-memory: step 3-02-PruneUnstartedTxQueue #12227
Conversation
I see that you haven't updated any README files. Would it make sense to do so? |
Quality Gate failedFailed conditions See analysis details on SonarQube Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
for _, txState := range txStates { | ||
switch txState { | ||
case TxUnstarted: | ||
filter2 := func(tx *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) bool { | ||
if tx.State != TxUnstarted { | ||
return false | ||
} | ||
return filter(tx) | ||
} | ||
txs = append(txs, as._findTxs(as.allTxs, filter2, txIDs...)...) | ||
case TxInProgress: | ||
if as.inprogressTx != nil && filter(as.inprogressTx) { | ||
txs = append(txs, *as.inprogressTx) | ||
} | ||
case TxUnconfirmed: | ||
txs = append(txs, as._findTxs(as.unconfirmedTxs, filter, txIDs...)...) | ||
case TxConfirmedMissingReceipt: | ||
txs = append(txs, as._findTxs(as.confirmedMissingReceiptTxs, filter, txIDs...)...) | ||
case TxConfirmed: | ||
txs = append(txs, as._findTxs(as.confirmedTxs, filter, txIDs...)...) | ||
case TxFatalError: | ||
txs = append(txs, as._findTxs(as.fatalErroredTxs, filter, txIDs...)...) | ||
default: | ||
panic("findTxs: unknown transaction state") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be also be optimized if we use map[State]map[ID][]*Tx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great point! I think that could be useful for the next iteration of this work. This code is still pretty EVM specific. your suggestion is a bit more generalized and might be a good next step for this. With all that being said I think we should hold off on that work for a future refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but should be optimized later.
NOTES:
Parent: