Skip to content

Commit 2eef46f

Browse files
committed
ref: use BIP-352 activation height
* this allows the indexer to skip blocks, that do not support silent payments, resulting in faster indexing and less redundant work. * https://www.bitaps.com/842579 * bitcoin/bips#1458
1 parent 67f4c57 commit 2eef46f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/block-data-providers/bitcoin-core/provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Injectable, Logger, OnApplicationBootstrap } from '@nestjs/common';
44
import { BitcoinNetwork } from '@/common/enum';
55
import {
66
BITCOIN_CORE_FULL_VERBOSITY_VERSION,
7-
TAPROOT_ACTIVATION_HEIGHT,
7+
BIP352_ACTIVATION_HEIGHT,
88
} from '@/common/constants';
99
import { Cron, CronExpression } from '@nestjs/schedule';
1010
import {
@@ -82,7 +82,7 @@ export class BitcoinCoreProvider
8282
const blockHeight =
8383
this.configService.get<BitcoinNetwork>('app.network') ===
8484
BitcoinNetwork.MAINNET
85-
? TAPROOT_ACTIVATION_HEIGHT - 1
85+
? BIP352_ACTIVATION_HEIGHT - 1
8686
: 0;
8787
const blockHash = await this.getBlockHash(blockHeight);
8888

src/block-data-providers/esplora/provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
EsploraOperationState,
1111
EsploraTransaction,
1212
} from '@/block-data-providers/esplora/interface';
13-
import { TAPROOT_ACTIVATION_HEIGHT } from '@/common/constants';
13+
import { BIP352_ACTIVATION_HEIGHT } from '@/common/constants';
1414
import { BlockStateService } from '@/block-state/block-state.service';
1515
import { Cron, CronExpression } from '@nestjs/schedule';
1616
import { DbTransactionService } from '@/db-transaction/db-transaction.service';
@@ -80,7 +80,7 @@ export class EsploraProvider
8080
const blockHeight =
8181
this.configService.get<BitcoinNetwork>('app.network') ===
8282
BitcoinNetwork.MAINNET
83-
? TAPROOT_ACTIVATION_HEIGHT - 1
83+
? BIP352_ACTIVATION_HEIGHT - 1
8484
: 0;
8585
const blockHash = await this.getBlockHash(blockHeight);
8686

src/common/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const NUMS_H = Buffer.from(
33
'hex',
44
);
55

6-
export const TAPROOT_ACTIVATION_HEIGHT = 709632;
6+
export const BIP352_ACTIVATION_HEIGHT = 842579; // 8 May, 2024 - when BIP-352 was merged
77

88
export const SATS_PER_BTC = 100_000_000;
99

0 commit comments

Comments
 (0)