fix: use unix nano in mempool for unordered nonces (#24579)
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user