mirror of
https://github.com/mempool/mempool.git
synced 2025-01-18 13:24:01 +01:00
Merge pull request #5666 from mempool/mononaut/fix-undefined-mempooltxs
fix undefined mempool tx errors
This commit is contained in:
commit
c089920e4b
@ -382,7 +382,7 @@ class MempoolBlocks {
|
|||||||
|
|
||||||
const ancestors: Ancestor[] = [];
|
const ancestors: Ancestor[] = [];
|
||||||
const descendants: Ancestor[] = [];
|
const descendants: Ancestor[] = [];
|
||||||
let ancestor: MempoolTransactionExtended
|
let ancestor: MempoolTransactionExtended;
|
||||||
for (const cluster of clusters) {
|
for (const cluster of clusters) {
|
||||||
for (const memberTxid of cluster) {
|
for (const memberTxid of cluster) {
|
||||||
const mempoolTx = mempool[memberTxid];
|
const mempoolTx = mempool[memberTxid];
|
||||||
@ -462,7 +462,7 @@ class MempoolBlocks {
|
|||||||
|
|
||||||
for (let i = 0; i < block.length; i++) {
|
for (let i = 0; i < block.length; i++) {
|
||||||
const txid = block[i];
|
const txid = block[i];
|
||||||
if (txid) {
|
if (txid in mempool) {
|
||||||
mempoolTx = mempool[txid];
|
mempoolTx = mempool[txid];
|
||||||
// save position in projected blocks
|
// save position in projected blocks
|
||||||
mempoolTx.position = {
|
mempoolTx.position = {
|
||||||
@ -481,6 +481,9 @@ class MempoolBlocks {
|
|||||||
mempoolTx.acceleratedAt = acceleration?.added;
|
mempoolTx.acceleratedAt = acceleration?.added;
|
||||||
mempoolTx.feeDelta = acceleration?.feeDelta;
|
mempoolTx.feeDelta = acceleration?.feeDelta;
|
||||||
for (const ancestor of mempoolTx.ancestors || []) {
|
for (const ancestor of mempoolTx.ancestors || []) {
|
||||||
|
if (!(ancestor.txid in mempool)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!mempool[ancestor.txid].acceleration) {
|
if (!mempool[ancestor.txid].acceleration) {
|
||||||
mempool[ancestor.txid].cpfpDirty = true;
|
mempool[ancestor.txid].cpfpDirty = true;
|
||||||
}
|
}
|
||||||
@ -688,7 +691,7 @@ class MempoolBlocks {
|
|||||||
[pool: string]: { name: string, block: number, vsize: number, accelerations: string[], complete: boolean };
|
[pool: string]: { name: string, block: number, vsize: number, accelerations: string[], complete: boolean };
|
||||||
} = {};
|
} = {};
|
||||||
// prepare a list of accelerations in ascending order (we'll pop items off the end of the list)
|
// prepare a list of accelerations in ascending order (we'll pop items off the end of the list)
|
||||||
const accQueue: { acceleration: Acceleration, rate: number, vsize: number }[] = Object.values(accelerations).map(acc => {
|
const accQueue: { acceleration: Acceleration, rate: number, vsize: number }[] = Object.values(accelerations).filter(acc => acc.txid in mempoolCache).map(acc => {
|
||||||
let vsize = mempoolCache[acc.txid].vsize;
|
let vsize = mempoolCache[acc.txid].vsize;
|
||||||
for (const ancestor of mempoolCache[acc.txid].ancestors || []) {
|
for (const ancestor of mempoolCache[acc.txid].ancestors || []) {
|
||||||
vsize += (ancestor.weight / 4);
|
vsize += (ancestor.weight / 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user