]> zoso.dev Git - libnemo.git/commitdiff
Break up sweep statements for legibility.
authorChris Duncan <chris@zoso.dev>
Fri, 8 Nov 2024 18:43:39 +0000 (10:43 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 8 Nov 2024 18:43:39 +0000 (10:43 -0800)
src/lib/tools.ts

index 20065ad219e009cc9bd9d6b5c0a9433c9022ca23..c9ba7883cf3ec30e2d10ec6bf2b8dcaecc783bae 100644 (file)
@@ -152,7 +152,7 @@ export async function sweep (rpc: Rpc | string | URL, wallet: Blake2bWallet | Bi
                                account.representative.address,
                                account.frontier
                        )
-                       blockQueue.push(new Promise(async resolve => {
+                       const blockRequest = new Promise(async (resolve) => {
                                try {
                                        await block.pow(rpc)
                                        await block.sign(account.index)
@@ -163,7 +163,8 @@ export async function sweep (rpc: Rpc | string | URL, wallet: Blake2bWallet | Bi
                                } finally {
                                        resolve(null)
                                }
-                       }))
+                       })
+                       blockQueue.push(blockRequest)
                }
        }
        await Promise.allSettled(blockQueue)