Skip to content

Commit a4a4fac

Browse files
wallet address index covering
1 parent fb4d066 commit a4a4fac

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/bitcore-node/src/models/transaction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ export class TransactionModel extends BaseModel<ITransaction> {
343343
mintOpsAddresses = Object.keys(mintOpsAddresses);
344344
let wallets = await WalletAddressStorage.collection
345345
.find({ address: { $in: mintOpsAddresses }, chain, network }, { batchSize: 100 })
346+
.project({ wallet: 1, address: 1 })
346347
.toArray();
347348
if (wallets.length) {
348349
mintOps = mintOps.map(mintOp => {

packages/bitcore-node/src/models/walletAddress.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export class WalletAddressModel extends BaseModel<IWalletAddress> {
2222
allowedPaging = [];
2323

2424
onConnect() {
25-
this.collection.createIndex({ address: 1, wallet: 1 }, { background: true });
26-
this.collection.createIndex({ wallet: 1 }, { background: true });
25+
this.collection.createIndex({ chain: 1, network: 1, address: 1, wallet: 1 }, { background: true, unique: true });
26+
this.collection.createIndex({ chain: 1, network: 1, wallet: 1, address: 1 }, { background: true, unique: true });
2727
}
2828

2929
_apiTransform(walletAddress: { address: string }, options: TransformOptions) {

0 commit comments

Comments
 (0)