Faster txid to u32 parsing
This commit is contained in:
parent
390c4a7706
commit
22d357c53c
@ -58,11 +58,11 @@ function mempoolFromArrayBuffer(buf: ArrayBuffer): { mempool: ThreadTransaction[
|
|||||||
}
|
}
|
||||||
|
|
||||||
function txidToOrdering(txid: string): number {
|
function txidToOrdering(txid: string): number {
|
||||||
return (
|
return parseInt(
|
||||||
((parseInt(txid.substring(62, 64), 16) << 24) |
|
txid.substr(62, 2) +
|
||||||
(parseInt(txid.substring(60, 62), 16) << 16) |
|
txid.substr(60, 2) +
|
||||||
(parseInt(txid.substring(58, 60), 16) << 8) |
|
txid.substr(58, 2) +
|
||||||
parseInt(txid.substring(56, 58), 16)) >>>
|
txid.substr(56, 2),
|
||||||
0
|
16
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -158,12 +158,12 @@ class TransactionUtils {
|
|||||||
|
|
||||||
// returns the most significant 4 bytes of the txid as an integer
|
// returns the most significant 4 bytes of the txid as an integer
|
||||||
public txidToOrdering(txid: string): number {
|
public txidToOrdering(txid: string): number {
|
||||||
return (
|
return parseInt(
|
||||||
((parseInt(txid.substring(62, 64), 16) << 24) |
|
txid.substr(62, 2) +
|
||||||
(parseInt(txid.substring(60, 62), 16) << 16) |
|
txid.substr(60, 2) +
|
||||||
(parseInt(txid.substring(58, 60), 16) << 8) |
|
txid.substr(58, 2) +
|
||||||
parseInt(txid.substring(56, 58), 16)) >>>
|
txid.substr(56, 2),
|
||||||
0
|
16
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user