Merge branch 'master' into nymkappa/search-autofocus
This commit is contained in:
commit
f62f2341f4
@ -80,7 +80,7 @@ class ChannelsApi {
|
|||||||
|
|
||||||
public async $searchChannelsById(search: string): Promise<any[]> {
|
public async $searchChannelsById(search: string): Promise<any[]> {
|
||||||
try {
|
try {
|
||||||
const searchStripped = search.replace('%', '') + '%';
|
const searchStripped = search.replace(/[^0-9x]/g, '') + '%';
|
||||||
const query = `SELECT id, short_id, capacity, status FROM channels WHERE id LIKE ? OR short_id LIKE ? LIMIT 10`;
|
const query = `SELECT id, short_id, capacity, status FROM channels WHERE id LIKE ? OR short_id LIKE ? LIMIT 10`;
|
||||||
const [rows]: any = await DB.query(query, [searchStripped, searchStripped]);
|
const [rows]: any = await DB.query(query, [searchStripped, searchStripped]);
|
||||||
return rows;
|
return rows;
|
||||||
|
@ -86,7 +86,7 @@ class Mempool {
|
|||||||
this.mempoolCache = mempoolData;
|
this.mempoolCache = mempoolData;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
for (const txid of Object.keys(this.mempoolCache)) {
|
for (const txid of Object.keys(this.mempoolCache)) {
|
||||||
if (this.mempoolCache[txid].sigops == null || this.mempoolCache[txid].effectiveFeePerVsize == null) {
|
if (!this.mempoolCache[txid].sigops || this.mempoolCache[txid].effectiveFeePerVsize == null) {
|
||||||
this.mempoolCache[txid] = transactionUtils.extendMempoolTransaction(this.mempoolCache[txid]);
|
this.mempoolCache[txid] = transactionUtils.extendMempoolTransaction(this.mempoolCache[txid]);
|
||||||
}
|
}
|
||||||
if (this.mempoolCache[txid].order == null) {
|
if (this.mempoolCache[txid].order == null) {
|
||||||
|
@ -74,7 +74,7 @@ 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 = Common.isLiquid() ? this.countSigops(transaction) : 0;
|
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 = (transaction.fee || 0) / fractionalVsize;
|
const feePerVbytes = (transaction.fee || 0) / fractionalVsize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user