nonce_manager: remove current nonce load when initialized (#2013)

If nonce was just initialized, no need for store and load.
Just return the stored value without load.

Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>

Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
This commit is contained in:
Gyuho Lee 2023-01-05 17:47:05 +08:00 committed by GitHub
parent 4a8a6ad259
commit 3ed83d5dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -43,9 +43,11 @@ where
.map_err(FromErr::from)?; .map_err(FromErr::from)?;
self.nonce.store(nonce.as_u64(), Ordering::SeqCst); self.nonce.store(nonce.as_u64(), Ordering::SeqCst);
self.initialized.store(true, Ordering::SeqCst); self.initialized.store(true, Ordering::SeqCst);
Ok(nonce)
} else {
// return current nonce
Ok(self.nonce.load(Ordering::SeqCst).into())
} }
// return current nonce
Ok(self.nonce.load(Ordering::SeqCst).into())
} }
async fn get_transaction_count_with_manager( async fn get_transaction_count_with_manager(