Refactor cpfp & single-block gbt code into mini-miner module

This commit is contained in:
Mononaut
2024-04-04 04:28:57 +00:00
parent 0a116804e8
commit 27374bd131
8 changed files with 650 additions and 798 deletions

View File

@@ -33,7 +33,7 @@ interface AddressTransactions {
removed: MempoolTransactionExtended[],
}
import bitcoinSecondClient from './bitcoin/bitcoin-second-client';
import { calculateCpfp } from './cpfp';
import { calculateMempoolTxCpfp } from './cpfp';
// valid 'want' subscriptions
const wantable = [
@@ -827,7 +827,7 @@ class WebsocketHandler {
accelerationPositions: memPool.getAccelerationPositions(mempoolTx.txid),
};
if (!mempoolTx.cpfpChecked && !mempoolTx.acceleration) {
calculateCpfp(mempoolTx, newMempool);
calculateMempoolTxCpfp(mempoolTx, newMempool);
}
if (mempoolTx.cpfpDirty) {
positionData['cpfp'] = {
@@ -866,7 +866,7 @@ class WebsocketHandler {
acceleratedAt: mempoolTx.acceleratedAt || undefined,
};
if (!mempoolTx.cpfpChecked) {
calculateCpfp(mempoolTx, newMempool);
calculateMempoolTxCpfp(mempoolTx, newMempool);
}
if (mempoolTx.cpfpDirty) {
txInfo.cpfp = {