Skip to content

Commit bb3c7a6

Browse files
committed
sorting ouptuts by index
1 parent 25babcd commit bb3c7a6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/entity/utxo-entity-definitions.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class DBUtxoIndexerBlock {
6060
timestamp: this.timestamp,
6161
transactions: this.transactions,
6262
confirmed: this.confirmed,
63-
numberOfConfirmations: 0
63+
numberOfConfirmations: 0,
6464
};
6565
}
6666
}
@@ -106,8 +106,11 @@ export class DBUtxoTransaction {
106106

107107
// Transaction methods
108108
private get response(): IUtxoGetTransactionRes {
109-
const vout_arr: IUtxoVoutTransaction[] = this.transactionoutput_set.map(
110-
(transaction_output) => {
109+
const vout_arr: IUtxoVoutTransaction[] = this.transactionoutput_set
110+
.sort((a, b) => {
111+
return a.n - b.n;
112+
})
113+
.map((transaction_output) => {
111114
return {
112115
value: transaction_output.value,
113116
n: transaction_output.n,
@@ -117,8 +120,7 @@ export class DBUtxoTransaction {
117120
hex: transaction_output.script_key_hex,
118121
},
119122
};
120-
},
121-
);
123+
});
122124

123125
const vin_arr: IUtxoVinTransactionPrevout[] = this.transactioninput_set
124126
.sort((a, b) => {
@@ -352,7 +354,6 @@ export class DBPruneSyncState {
352354

353355
export type IDBPruneSyncState = new () => DBPruneSyncState;
354356

355-
356357
@Entity('utxo_indexer_version')
357358
export class DBIndexerVersion {
358359
@PrimaryColumn({ type: 'bigint' })
@@ -384,8 +385,8 @@ export class DBIndexerVersion {
384385
buildDate: this.build_date,
385386
numConfirmations: this.num_confirmations,
386387
historySeconds: this.history_seconds,
387-
}
388+
};
388389
}
389390
}
390391

391-
export type IDBIndexerVersion = new () => DBIndexerVersion;
392+
export type IDBIndexerVersion = new () => DBIndexerVersion;

0 commit comments

Comments
 (0)