chore: don't validate Nonce in query (#1341)
By asking MongoDB to simply find the account by the ID and then validating the nonce ourselves, we save roughly 1ms. Reviewed-on: OpenWF/SpaceNinjaServer#1341
This commit is contained in:
parent
d9b944175a
commit
a622393933
@ -74,11 +74,8 @@ export const getAccountForRequest = async (req: Request): Promise<TAccountDocume
|
||||
throw new Error("Request is missing nonce parameter");
|
||||
}
|
||||
|
||||
const account = await Account.findOne({
|
||||
_id: req.query.accountId,
|
||||
Nonce: nonce
|
||||
});
|
||||
if (!account) {
|
||||
const account = await Account.findById(req.query.accountId);
|
||||
if (!account || account.Nonce != nonce) {
|
||||
throw new Error("Invalid accountId-nonce pair");
|
||||
}
|
||||
if (account.Dropped && req.query.ct) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user