Shuffle mempool transactions before saving disk cache. (#398)
fixes #397
This commit is contained in:
@@ -71,6 +71,13 @@ export class Common {
|
||||
}, ms);
|
||||
});
|
||||
}
|
||||
|
||||
static shuffleArray(array: any[]) {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
}
|
||||
|
||||
static setRelativesAndGetCpfpInfo(tx: TransactionExtended, memPool: { [txid: string]: TransactionExtended }): CpfpInfo {
|
||||
const parents = this.findAllParents(tx, memPool);
|
||||
@@ -129,5 +136,4 @@ export class Common {
|
||||
});
|
||||
return parents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user