fix: use unix nano in mempool for unordered nonces (#24579)

This commit is contained in:
Tyler
2025-04-25 20:35:24 +00:00
committed by GitHub
parent 64abdf239e
commit f5600147e5
3 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -226,7 +226,7 @@ func (mp *PriorityNonceMempool[C]) Insert(ctx context.Context, tx sdk.Tx) error
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
timestamp := unordered.GetTimeoutTimeStamp().UnixNano()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
@@ -471,7 +471,7 @@ func (mp *PriorityNonceMempool[C]) Remove(tx sdk.Tx) error {
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
timestamp := unordered.GetTimeoutTimeStamp().UnixNano()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
+2 -2
View File
@@ -143,7 +143,7 @@ func (snm *SenderNonceMempool) Insert(_ context.Context, tx sdk.Tx) error {
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
timestamp := unordered.GetTimeoutTimeStamp().UnixNano()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
@@ -240,7 +240,7 @@ func (snm *SenderNonceMempool) Remove(tx sdk.Tx) error {
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
timestamp := unordered.GetTimeoutTimeStamp().UnixNano()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
+2
View File
@@ -77,6 +77,8 @@ type (
TxWithTimeoutTimeStamp interface {
Tx
// GetTimeoutTimeStamp gets the timeout timestamp for the tx.
// IMPORTANT: when the uint value is needed here, you MUST use UnixNano.
GetTimeoutTimeStamp() time.Time
}