Merge branch 'master' into mononaut/blockchain-scroll
This commit is contained in:
commit
a0bd4e0f63
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -99,3 +99,6 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
|
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
@ -171,7 +171,9 @@ class Blocks {
|
|||||||
|
|
||||||
private convertLiquidFees(block: IBitcoinApi.VerboseBlock): IBitcoinApi.VerboseBlock {
|
private convertLiquidFees(block: IBitcoinApi.VerboseBlock): IBitcoinApi.VerboseBlock {
|
||||||
block.tx.forEach(tx => {
|
block.tx.forEach(tx => {
|
||||||
|
if (!isFinite(Number(tx.fee))) {
|
||||||
tx.fee = Object.values(tx.fee || {}).reduce((total, output) => total + output, 0);
|
tx.fee = Object.values(tx.fee || {}).reduce((total, output) => total + output, 0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
@ -877,7 +879,7 @@ class Blocks {
|
|||||||
|
|
||||||
let height = blockHeight;
|
let height = blockHeight;
|
||||||
let summary: BlockSummary;
|
let summary: BlockSummary;
|
||||||
if (cpfpSummary) {
|
if (cpfpSummary && !Common.isLiquid()) {
|
||||||
summary = {
|
summary = {
|
||||||
id: hash,
|
id: hash,
|
||||||
transactions: cpfpSummary.transactions.map(tx => {
|
transactions: cpfpSummary.transactions.map(tx => {
|
||||||
|
@ -35,6 +35,13 @@ class TransactionUtils {
|
|||||||
} else {
|
} else {
|
||||||
transaction = await bitcoinApi.$getRawTransaction(txId, false, addPrevouts, lazyPrevouts);
|
transaction = await bitcoinApi.$getRawTransaction(txId, false, addPrevouts, lazyPrevouts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Common.isLiquid()) {
|
||||||
|
if (!isFinite(Number(transaction.fee))) {
|
||||||
|
transaction.fee = Object.values(transaction.fee || {}).reduce((total, output) => total + output, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (addMempoolData || !transaction?.status?.confirmed) {
|
if (addMempoolData || !transaction?.status?.confirmed) {
|
||||||
return this.extendMempoolTransaction(transaction);
|
return this.extendMempoolTransaction(transaction);
|
||||||
} else {
|
} else {
|
||||||
@ -52,8 +59,7 @@ class TransactionUtils {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return transaction;
|
return transaction;
|
||||||
}
|
}
|
||||||
const feePerVbytes = Math.max(Common.isLiquid() ? 0.1 : 1,
|
const feePerVbytes = (transaction.fee || 0) / (transaction.weight / 4);
|
||||||
(transaction.fee || 0) / (transaction.weight / 4));
|
|
||||||
const transactionExtended: TransactionExtended = Object.assign({
|
const transactionExtended: TransactionExtended = Object.assign({
|
||||||
vsize: Math.round(transaction.weight / 4),
|
vsize: Math.round(transaction.weight / 4),
|
||||||
feePerVsize: feePerVbytes,
|
feePerVsize: feePerVbytes,
|
||||||
@ -68,13 +74,11 @@ class TransactionUtils {
|
|||||||
public extendMempoolTransaction(transaction: IEsploraApi.Transaction): MempoolTransactionExtended {
|
public extendMempoolTransaction(transaction: IEsploraApi.Transaction): MempoolTransactionExtended {
|
||||||
const vsize = Math.ceil(transaction.weight / 4);
|
const vsize = Math.ceil(transaction.weight / 4);
|
||||||
const fractionalVsize = (transaction.weight / 4);
|
const fractionalVsize = (transaction.weight / 4);
|
||||||
const sigops = this.countSigops(transaction);
|
const sigops = Common.isLiquid() ? this.countSigops(transaction) : 0;
|
||||||
// https://github.com/bitcoin/bitcoin/blob/e9262ea32a6e1d364fb7974844fadc36f931f8c6/src/policy/policy.cpp#L295-L298
|
// https://github.com/bitcoin/bitcoin/blob/e9262ea32a6e1d364fb7974844fadc36f931f8c6/src/policy/policy.cpp#L295-L298
|
||||||
const adjustedVsize = Math.max(fractionalVsize, sigops * 5); // adjusted vsize = Max(weight, sigops * bytes_per_sigop) / witness_scale_factor
|
const adjustedVsize = Math.max(fractionalVsize, sigops * 5); // adjusted vsize = Max(weight, sigops * bytes_per_sigop) / witness_scale_factor
|
||||||
const feePerVbytes = Math.max(Common.isLiquid() ? 0.1 : 1,
|
const feePerVbytes = (transaction.fee || 0) / fractionalVsize;
|
||||||
(transaction.fee || 0) / fractionalVsize);
|
const adjustedFeePerVsize = (transaction.fee || 0) / adjustedVsize;
|
||||||
const adjustedFeePerVsize = Math.max(Common.isLiquid() ? 0.1 : 1,
|
|
||||||
(transaction.fee || 0) / adjustedVsize);
|
|
||||||
const transactionExtended: MempoolTransactionExtended = Object.assign(transaction, {
|
const transactionExtended: MempoolTransactionExtended = Object.assign(transaction, {
|
||||||
order: this.txidToOrdering(transaction.txid),
|
order: this.txidToOrdering(transaction.txid),
|
||||||
vsize: Math.round(transaction.weight / 4),
|
vsize: Math.round(transaction.weight / 4),
|
||||||
|
3
contributors/pedromvpg.txt
Normal file
3
contributors/pedromvpg.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
I hereby accept the terms of the Contributor License Agreement in the CONTRIBUTING.md file of the mempool/mempool git repository as of July 20, 2023.
|
||||||
|
|
||||||
|
Signed: pedromvpg
|
@ -144,11 +144,13 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
for (const block of blocks) {
|
for (const block of blocks) {
|
||||||
if (block.id === this.blockHash) {
|
if (block.id === this.blockHash) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
if (block.extras) {
|
||||||
block.extras.minFee = this.getMinBlockFee(block);
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
block.extras.maxFee = this.getMaxBlockFee(block);
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
if (block?.extras?.reward != undefined) {
|
if (block?.extras?.reward != undefined) {
|
||||||
this.fees = block.extras.reward / 100000000 - this.blockSubsidy;
|
this.fees = block.extras.reward / 100000000 - this.blockSubsidy;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (block.height === this.block?.height) {
|
} else if (block.height === this.block?.height) {
|
||||||
this.block.stale = true;
|
this.block.stale = true;
|
||||||
this.block.canonical = block.id;
|
this.block.canonical = block.id;
|
||||||
@ -246,8 +248,10 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
this.updateAuditAvailableFromBlockHeight(block.height);
|
this.updateAuditAvailableFromBlockHeight(block.height);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
if (block.extras) {
|
||||||
block.extras.minFee = this.getMinBlockFee(block);
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
block.extras.maxFee = this.getMaxBlockFee(block);
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
|
}
|
||||||
this.blockHeight = block.height;
|
this.blockHeight = block.height;
|
||||||
this.lastBlockHeight = this.blockHeight;
|
this.lastBlockHeight = this.blockHeight;
|
||||||
this.nextBlockHeight = block.height + 1;
|
this.nextBlockHeight = block.height + 1;
|
||||||
|
@ -113,9 +113,11 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
const animate = this.chainTip != null && latestHeight > this.chainTip;
|
const animate = this.chainTip != null && latestHeight > this.chainTip;
|
||||||
|
|
||||||
for (const block of blocks) {
|
for (const block of blocks) {
|
||||||
|
if (block?.extras) {
|
||||||
block.extras.minFee = this.getMinBlockFee(block);
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
block.extras.maxFee = this.getMaxBlockFee(block);
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.blocks = blocks;
|
this.blocks = blocks;
|
||||||
|
|
||||||
@ -251,7 +253,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
if (height >= 0) {
|
if (height >= 0) {
|
||||||
this.cacheService.loadBlock(height);
|
this.cacheService.loadBlock(height);
|
||||||
block = this.cacheService.getCachedBlock(height) || null;
|
block = this.cacheService.getCachedBlock(height) || null;
|
||||||
if (block) {
|
if (block?.extras) {
|
||||||
block.extras.minFee = this.getMinBlockFee(block);
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
block.extras.maxFee = this.getMaxBlockFee(block);
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
}
|
}
|
||||||
@ -293,8 +295,10 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
onBlockLoaded(block: BlockExtended) {
|
onBlockLoaded(block: BlockExtended) {
|
||||||
const blockIndex = this.height - block.height;
|
const blockIndex = this.height - block.height;
|
||||||
if (blockIndex >= 0 && blockIndex < this.blocks.length) {
|
if (blockIndex >= 0 && blockIndex < this.blocks.length) {
|
||||||
|
if (block?.extras) {
|
||||||
block.extras.minFee = this.getMinBlockFee(block);
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
block.extras.maxFee = this.getMaxBlockFee(block);
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
|
}
|
||||||
this.blocks[blockIndex] = block;
|
this.blocks[blockIndex] = block;
|
||||||
this.blockStyles[blockIndex] = this.getStyleForBlock(block, blockIndex);
|
this.blockStyles[blockIndex] = this.getStyleForBlock(block, blockIndex);
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,10 @@ export class BlocksList implements OnInit {
|
|||||||
.pipe(
|
.pipe(
|
||||||
switchMap((blocks) => {
|
switchMap((blocks) => {
|
||||||
if (blocks[0].height <= this.lastBlockHeight) {
|
if (blocks[0].height <= this.lastBlockHeight) {
|
||||||
return [null]; // Return an empty stream so the last pipe is not executed
|
return of([]); // Return an empty stream so the last pipe is not executed
|
||||||
}
|
}
|
||||||
this.lastBlockHeight = blocks[0].height;
|
this.lastBlockHeight = blocks[0].height;
|
||||||
return blocks;
|
return of(blocks);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -26,6 +26,8 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const githubSecret = process.env.GITHUB_TOKEN;
|
||||||
|
|
||||||
function download(filename, url) {
|
function download(filename, url) {
|
||||||
https.get(url, (response) => {
|
https.get(url, (response) => {
|
||||||
if (response.statusCode < 200 || response.statusCode > 299) {
|
if (response.statusCode < 200 || response.statusCode > 299) {
|
||||||
@ -55,6 +57,12 @@ function downloadMiningPoolLogos$() {
|
|||||||
headers: {'user-agent': 'node.js'}
|
headers: {'user-agent': 'node.js'}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (githubSecret) {
|
||||||
|
console.log('Downloading the mining pool logos with authentication');
|
||||||
|
options.headers['authorization'] = `Bearer ${githubSecret}`;
|
||||||
|
options.headers['X-GitHub-Api-Version'] = '2022-11-28';
|
||||||
|
}
|
||||||
|
|
||||||
https.get(options, (response) => {
|
https.get(options, (response) => {
|
||||||
const chunks_of_data = [];
|
const chunks_of_data = [];
|
||||||
|
|
||||||
@ -109,6 +117,13 @@ function downloadPromoVideoSubtiles$() {
|
|||||||
headers: {'user-agent': 'node.js'}
|
headers: {'user-agent': 'node.js'}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (githubSecret) {
|
||||||
|
console.log('Downloading the promo video subtitles with authentication');
|
||||||
|
options.headers['authorization'] = `Bearer ${githubSecret}`;
|
||||||
|
options.headers['X-GitHub-Api-Version'] = '2022-11-28';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
https.get(options, (response) => {
|
https.get(options, (response) => {
|
||||||
const chunks_of_data = [];
|
const chunks_of_data = [];
|
||||||
|
|
||||||
@ -163,6 +178,12 @@ function downloadPromoVideo$() {
|
|||||||
headers: {'user-agent': 'node.js'}
|
headers: {'user-agent': 'node.js'}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (githubSecret) {
|
||||||
|
console.log('Downloading the promo videos with authentication');
|
||||||
|
options.headers['authorization'] = `Bearer ${githubSecret}`;
|
||||||
|
options.headers['X-GitHub-Api-Version'] = '2022-11-28';
|
||||||
|
}
|
||||||
|
|
||||||
https.get(options, (response) => {
|
https.get(options, (response) => {
|
||||||
const chunks_of_data = [];
|
const chunks_of_data = [];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user