We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c2edee commit 834729aCopy full SHA for 834729a
packages/bitcore-node/src/utils/cleanup.ts
@@ -0,0 +1,23 @@
1
+import { BlockModel } from '../models/block';
2
+import { TransactionModel } from '../models/transaction';
3
+import { CoinModel } from '../models/coin';
4
+import { Storage } from '../services/storage';
5
+
6
+Storage.start({}).then(() => {
7
+ BlockModel.collection
8
+ .find({})
9
+ .sort({ height: -1 })
10
+ .stream({
11
+ transform: async block => {
12
+ const txs = await TransactionModel.collection.find({ blockHash: block.hash }).toArray();
13
+ for(let tx of txs) {
14
+ let mints = await CoinModel.collection.find({ mintTxid: tx.txid }).toArray();
15
+ for (let mint of mints) {
16
+ if (mint.mintHeight != block.height && block.height > mint.mintHeight) {
17
+ console.log(mint);
18
+ }
19
20
21
22
+ })
23
+});
0 commit comments