From 2d7316942f2809ebd452d20e3c339605372f1160 Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Fri, 27 Sep 2024 17:26:27 +0200
Subject: [PATCH 1/8] export bitcoinsatoshis pipe module, allow custom class
for first part
---
frontend/src/app/shared/pipes/bitcoinsatoshis.pipe.ts | 4 ++--
frontend/src/app/shared/shared.module.ts | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/frontend/src/app/shared/pipes/bitcoinsatoshis.pipe.ts b/frontend/src/app/shared/pipes/bitcoinsatoshis.pipe.ts
index 7065b5138..7e785e9c8 100644
--- a/frontend/src/app/shared/pipes/bitcoinsatoshis.pipe.ts
+++ b/frontend/src/app/shared/pipes/bitcoinsatoshis.pipe.ts
@@ -8,7 +8,7 @@ export class BitcoinsatoshisPipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) { }
- transform(value: string): SafeHtml {
+ transform(value: string, firstPartClass?: string): SafeHtml {
const newValue = this.insertSpaces(parseFloat(value || '0').toFixed(8));
const position = (newValue || '0').search(/[1-9]/);
@@ -16,7 +16,7 @@ export class BitcoinsatoshisPipe implements PipeTransform {
const secondPart = newValue.slice(position);
return this.sanitizer.bypassSecurityTrustHtml(
- `${firstPart}${secondPart}`
+ `${firstPart}${secondPart}`
);
}
diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts
index 0e37bc9d5..92b461548 100644
--- a/frontend/src/app/shared/shared.module.ts
+++ b/frontend/src/app/shared/shared.module.ts
@@ -365,6 +365,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
TwitterWidgetComponent,
TwitterLogin,
BitcoinInvoiceComponent,
+ BitcoinsatoshisPipe,
MempoolBlockOverviewComponent,
ClockchainComponent,
From b26d26b14ca304a5a25629042d8a991d06be0c97 Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Fri, 27 Sep 2024 15:55:29 +0000
Subject: [PATCH 2/8] expose custom x-total-count header
---
production/nginx/location-api-v1-services.conf | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/production/nginx/location-api-v1-services.conf b/production/nginx/location-api-v1-services.conf
index 88f510e79..a9df64bc6 100644
--- a/production/nginx/location-api-v1-services.conf
+++ b/production/nginx/location-api-v1-services.conf
@@ -92,6 +92,7 @@ location @mempool-api-v1-services-cache-disabled-addcors {
set $cors_methods 'GET, POST, PUT, DELETE, OPTIONS';
set $cors_origin 'https://mempool.space';
set $cors_headers 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With';
+ set $cors_expose_headers 'X-Total-Count';
set $cors_credentials 'true';
# set CORS for approved hostnames
@@ -100,6 +101,7 @@ location @mempool-api-v1-services-cache-disabled-addcors {
set $cors_methods 'GET, POST, PUT, DELETE, OPTIONS';
set $cors_origin "$http_origin";
set $cors_headers 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With';
+ set $cors_expose_headers 'X-Total-Count';
set $cors_credentials 'true';
}
@@ -108,6 +110,7 @@ location @mempool-api-v1-services-cache-disabled-addcors {
add_header Access-Control-Allow-Origin "$cors_origin" always;
add_header Access-Control-Allow-Headers "$cors_headers" always;
add_header Access-Control-Allow-Credentials "$cors_credentials" always;
+ add_header Access-Control-Expose-Headers "$cors_expose_headers" always;
proxy_redirect off;
proxy_buffering off;
@@ -172,6 +175,7 @@ location @mempool-api-v1-services-cache-short-addcors {
set $cors_methods 'GET, POST, PUT, DELETE, OPTIONS';
set $cors_origin 'https://mempool.space';
set $cors_headers 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With';
+ set $cors_expose_headers 'X-Total-Count';
set $cors_credentials 'true';
# set CORS for approved hostnames
@@ -180,6 +184,7 @@ location @mempool-api-v1-services-cache-short-addcors {
set $cors_methods 'GET, POST, PUT, DELETE, OPTIONS';
set $cors_origin "$http_origin";
set $cors_headers 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With';
+ set $cors_expose_headers 'X-Total-Count';
set $cors_credentials 'true';
}
@@ -188,6 +193,7 @@ location @mempool-api-v1-services-cache-short-addcors {
add_header Access-Control-Allow-Origin "$cors_origin" always;
add_header Access-Control-Allow-Headers "$cors_headers" always;
add_header Access-Control-Allow-Credentials "$cors_credentials" always;
+ add_header Access-Control-Expose-Headers "$cors_expose_headers" always;
# add our own cache headers
add_header 'Pragma' 'public';
From ea08c0c950831ea652283d930359dd56541eee2e Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Fri, 27 Sep 2024 16:09:12 +0000
Subject: [PATCH 3/8] fix acceleration history paging w/ undefined total
---
frontend/src/app/services/services-api.service.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/app/services/services-api.service.ts b/frontend/src/app/services/services-api.service.ts
index 5213e131c..c87044781 100644
--- a/frontend/src/app/services/services-api.service.ts
+++ b/frontend/src/app/services/services-api.service.ts
@@ -165,7 +165,7 @@ export class ServicesApiServices {
return this.getAccelerationHistoryObserveResponse$({...params, page}).pipe(
map((response) => ({
page,
- total: parseInt(response.headers.get('X-Total-Count'), 10),
+ total: parseInt(response.headers.get('X-Total-Count'), 10) || 0,
accelerations: accelerations.concat(response.body || []),
})),
switchMap(({page, total, accelerations}) => {
From da2341dd00c57bbf5e304a18010399b9cbdc56a0 Mon Sep 17 00:00:00 2001
From: softsimon
Date: Sat, 28 Sep 2024 08:56:29 +0400
Subject: [PATCH 4/8] remove rocket beta
---
.../src/app/components/master-page/master-page.component.html | 1 -
1 file changed, 1 deletion(-)
diff --git a/frontend/src/app/components/master-page/master-page.component.html b/frontend/src/app/components/master-page/master-page.component.html
index 9fc2d4e58..1aa13e309 100644
--- a/frontend/src/app/components/master-page/master-page.component.html
+++ b/frontend/src/app/components/master-page/master-page.component.html
@@ -85,7 +85,6 @@
- beta
From 517a37728c3d420530afb91adb7f0a4a7090ac2f Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Sat, 28 Sep 2024 16:34:13 +0000
Subject: [PATCH 5/8] Don't clobber effective fee rates
---
backend/src/api/transaction-utils.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/backend/src/api/transaction-utils.ts b/backend/src/api/transaction-utils.ts
index 15d3e7110..28fa72bba 100644
--- a/backend/src/api/transaction-utils.ts
+++ b/backend/src/api/transaction-utils.ts
@@ -121,6 +121,7 @@ class TransactionUtils {
const adjustedVsize = Math.max(fractionalVsize, sigops * 5); // adjusted vsize = Max(weight, sigops * bytes_per_sigop) / witness_scale_factor
const feePerVbytes = (transaction.fee || 0) / fractionalVsize;
const adjustedFeePerVsize = (transaction.fee || 0) / adjustedVsize;
+ const effectiveFeePerVsize = transaction['effectiveFeePerVsize'] || adjustedFeePerVsize || feePerVbytes;
const transactionExtended: MempoolTransactionExtended = Object.assign(transaction, {
order: this.txidToOrdering(transaction.txid),
vsize,
@@ -128,7 +129,7 @@ class TransactionUtils {
sigops,
feePerVsize: feePerVbytes,
adjustedFeePerVsize: adjustedFeePerVsize,
- effectiveFeePerVsize: adjustedFeePerVsize,
+ effectiveFeePerVsize: effectiveFeePerVsize,
});
if (!transactionExtended?.status?.confirmed && !transactionExtended.firstSeen) {
transactionExtended.firstSeen = Math.round((Date.now() / 1000));
From 60adad8db37eb398c8a2b7cf6e621b536001bce8 Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Sun, 29 Sep 2024 09:30:09 +0000
Subject: [PATCH 6/8] handle /utxos error on address page
---
frontend/src/app/components/address/address.component.ts | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/frontend/src/app/components/address/address.component.ts b/frontend/src/app/components/address/address.component.ts
index aaf480d8e..be6d531c0 100644
--- a/frontend/src/app/components/address/address.component.ts
+++ b/frontend/src/app/components/address/address.component.ts
@@ -219,9 +219,13 @@ export class AddressComponent implements OnInit, OnDestroy {
address.is_pubkey
? this.electrsApiService.getScriptHashTransactions$((address.address.length === 66 ? '21' : '41') + address.address + 'ac')
: this.electrsApiService.getAddressTransactions$(address.address),
- utxoCount >= 2 && utxoCount <= 500 ? (address.is_pubkey
+ (utxoCount >= 2 && utxoCount <= 500 ? (address.is_pubkey
? this.electrsApiService.getScriptHashUtxos$((address.address.length === 66 ? '21' : '41') + address.address + 'ac')
- : this.electrsApiService.getAddressUtxos$(address.address)) : of([])
+ : this.electrsApiService.getAddressUtxos$(address.address)) : of([])).pipe(
+ catchError(() => {
+ return of([]);
+ })
+ )
]);
}),
switchMap(([transactions, utxos]) => {
From 43a42d356d2e70dd7830fe25c3466468f32dfa18 Mon Sep 17 00:00:00 2001
From: wiz
Date: Wed, 2 Oct 2024 04:00:33 +0900
Subject: [PATCH 7/8] Enable RUST_GBT in backend by default
---
backend/mempool-config.sample.json | 2 +-
backend/src/config.ts | 2 +-
docker/backend/start.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/backend/mempool-config.sample.json b/backend/mempool-config.sample.json
index 4650c1e64..ce403e943 100644
--- a/backend/mempool-config.sample.json
+++ b/backend/mempool-config.sample.json
@@ -28,7 +28,7 @@
"POOLS_JSON_URL": "https://raw.githubusercontent.com/mempool/mining-pools/master/pools-v2.json",
"POOLS_JSON_TREE_URL": "https://api.github.com/repos/mempool/mining-pools/git/trees/master",
"AUDIT": false,
- "RUST_GBT": false,
+ "RUST_GBT": true,
"LIMIT_GBT": false,
"CPFP_INDEXING": false,
"DISK_CACHE_BLOCK_INTERVAL": 6,
diff --git a/backend/src/config.ts b/backend/src/config.ts
index b0afe7f23..a3e0a40af 100644
--- a/backend/src/config.ts
+++ b/backend/src/config.ts
@@ -193,7 +193,7 @@ const defaults: IConfig = {
'POOLS_JSON_URL': 'https://raw.githubusercontent.com/mempool/mining-pools/master/pools-v2.json',
'POOLS_JSON_TREE_URL': 'https://api.github.com/repos/mempool/mining-pools/git/trees/master',
'AUDIT': false,
- 'RUST_GBT': false,
+ 'RUST_GBT': true,
'LIMIT_GBT': false,
'CPFP_INDEXING': false,
'MAX_BLOCKS_BULK_QUERY': 0,
diff --git a/docker/backend/start.sh b/docker/backend/start.sh
index 8033531ef..39ca95a2a 100755
--- a/docker/backend/start.sh
+++ b/docker/backend/start.sh
@@ -30,7 +30,7 @@ __MEMPOOL_AUTOMATIC_POOLS_UPDATE__=${MEMPOOL_AUTOMATIC_POOLS_UPDATE:=false}
__MEMPOOL_POOLS_JSON_URL__=${MEMPOOL_POOLS_JSON_URL:=https://raw.githubusercontent.com/mempool/mining-pools/master/pools-v2.json}
__MEMPOOL_POOLS_JSON_TREE_URL__=${MEMPOOL_POOLS_JSON_TREE_URL:=https://api.github.com/repos/mempool/mining-pools/git/trees/master}
__MEMPOOL_AUDIT__=${MEMPOOL_AUDIT:=false}
-__MEMPOOL_RUST_GBT__=${MEMPOOL_RUST_GBT:=false}
+__MEMPOOL_RUST_GBT__=${MEMPOOL_RUST_GBT:=true}
__MEMPOOL_LIMIT_GBT__=${MEMPOOL_LIMIT_GBT:=false}
__MEMPOOL_CPFP_INDEXING__=${MEMPOOL_CPFP_INDEXING:=false}
__MEMPOOL_MAX_BLOCKS_BULK_QUERY__=${MEMPOOL_MAX_BLOCKS_BULK_QUERY:=0}
From 0f2340600c812041880c7fb41b40fa25e80b60d7 Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Thu, 3 Oct 2024 15:48:27 +0900
Subject: [PATCH 8/8] fix tests
---
backend/src/__tests__/config.test.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/src/__tests__/config.test.ts b/backend/src/__tests__/config.test.ts
index 050213143..53ab546a8 100644
--- a/backend/src/__tests__/config.test.ts
+++ b/backend/src/__tests__/config.test.ts
@@ -42,7 +42,7 @@ describe('Mempool Backend Config', () => {
POOLS_JSON_TREE_URL: 'https://api.github.com/repos/mempool/mining-pools/git/trees/master',
POOLS_JSON_URL: 'https://raw.githubusercontent.com/mempool/mining-pools/master/pools-v2.json',
AUDIT: false,
- RUST_GBT: false,
+ RUST_GBT: true,
LIMIT_GBT: false,
CPFP_INDEXING: false,
MAX_BLOCKS_BULK_QUERY: 0,