chore: comment from an already merged pr #4912 applied
This commit is contained in:
parent
141cfadb93
commit
14cf4b734f
|
@ -523,7 +523,7 @@ func (tm *PendingTxTracker) GetPendingEntry(chainID common.ChainID, hash eth.Has
|
||||||
return trs[0], nil
|
return trs[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tm *PendingTxTracker) GetPendingTxForSuggestedNonce(chainID common.ChainID, address eth.Address, nonce uint64) (pendingTx uint64, err error) {
|
func (tm *PendingTxTracker) CountPendingTxsFromNonce(chainID common.ChainID, address eth.Address, nonce uint64) (pendingTx uint64, err error) {
|
||||||
err = tm.db.QueryRow(`
|
err = tm.db.QueryRow(`
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(nonce)
|
COUNT(nonce)
|
||||||
|
@ -603,7 +603,8 @@ func (tm *PendingTxTracker) addPending(transaction *PendingTransaction) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: maybe we should think of making (network_id, from_address, nonce) as primary key instead (network_id, hash) ????
|
// TODO: maybe we should think of making (network_id, from_address, nonce) as primary key instead (network_id, hash) ????
|
||||||
insert, err := tx.Prepare(`INSERT OR REPLACE INTO pending_transactions
|
var insert *sql.Stmt
|
||||||
|
insert, err = tx.Prepare(`INSERT OR REPLACE INTO pending_transactions
|
||||||
(network_id, hash, timestamp, value, from_address, to_address,
|
(network_id, hash, timestamp, value, from_address, to_address,
|
||||||
data, symbol, gas_price, gas_limit, type, additional_data, multi_transaction_id, status,
|
data, symbol, gas_price, gas_limit, type, additional_data, multi_transaction_id, status,
|
||||||
auto_delete, nonce)
|
auto_delete, nonce)
|
||||||
|
|
|
@ -97,7 +97,7 @@ func (t *Transactor) NextNonce(rpcClient *rpc.Client, chainID uint64, from types
|
||||||
chainID == wallet_common.OptimismSepolia ||
|
chainID == wallet_common.OptimismSepolia ||
|
||||||
chainID == wallet_common.OptimismGoerli {
|
chainID == wallet_common.OptimismGoerli {
|
||||||
if t.pendingTracker != nil {
|
if t.pendingTracker != nil {
|
||||||
countOfPendingTXs, err := t.pendingTracker.GetPendingTxForSuggestedNonce(wallet_common.ChainID(chainID), common.Address(from), nonce)
|
countOfPendingTXs, err := t.pendingTracker.CountPendingTxsFromNonce(wallet_common.ChainID(chainID), common.Address(from), nonce)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ func (t *Transactor) SendRawTransaction(chainID uint64, rawTx string) error {
|
||||||
return rpcWrapper.SendRawTransaction(ctx, rawTx)
|
return rpcWrapper.SendRawTransaction(ctx, rawTx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPendingTransactions(from common.Address, symbol string, chainID uint64, multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) (pTx *PendingTransaction) {
|
func createPendingTransaction(from common.Address, symbol string, chainID uint64, multiTransactionID wallet_common.MultiTransactionIDType, tx *gethtypes.Transaction) (pTx *PendingTransaction) {
|
||||||
|
|
||||||
pTx = &PendingTransaction{
|
pTx = &PendingTransaction{
|
||||||
Hash: tx.Hash(),
|
Hash: tx.Hash(),
|
||||||
|
@ -200,7 +200,7 @@ func (t *Transactor) sendTransaction(rpcWrapper *rpcWrapper, from common.Address
|
||||||
|
|
||||||
if t.pendingTracker != nil {
|
if t.pendingTracker != nil {
|
||||||
|
|
||||||
tx := createPendingTransactions(from, symbol, rpcWrapper.chainID, multiTransactionID, tx)
|
tx := createPendingTransaction(from, symbol, rpcWrapper.chainID, multiTransactionID, tx)
|
||||||
|
|
||||||
err := t.pendingTracker.StoreAndTrackPendingTx(tx)
|
err := t.pendingTracker.StoreAndTrackPendingTx(tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue