Use msgpackr
This commit is contained in:
@@ -224,23 +224,13 @@ export class BlockchainElectrum extends BaseBlockchain {
|
||||
const cacheKey = `transactions.${txHash}`;
|
||||
|
||||
// Attempt to get the transaction hex from the cache or fetch it if not available.
|
||||
const transactionHex = await this.store.getOrSet(cacheKey, async () => {
|
||||
return await fetchTransaction(this.electrumClient, txHash);
|
||||
const transactionRaw = await this.store.getOrSet(cacheKey, async () => {
|
||||
const txHex = await fetchTransaction(this.electrumClient, txHash);
|
||||
return Transaction.fromHex(txHex).toRaw();
|
||||
});
|
||||
|
||||
// Decode the hex into our transaction primitive.
|
||||
const transaction = Transaction.fromHex(transactionHex);
|
||||
|
||||
// Attempt to get the transaction hex from the cache or fetch it if not available.
|
||||
// NOTE: We store JSON as opposed to hex because it is MUCH faster to decode.
|
||||
/*
|
||||
const transaction = new Transaction(
|
||||
await this.store.getOrSet(cacheKey, async () => {
|
||||
const tx = await fetchTransaction(this.electrumClient, txHash);
|
||||
return Transaction.fromHex(tx).transaction;
|
||||
}),
|
||||
);
|
||||
*/
|
||||
const transaction = Transaction.fromRaw(transactionRaw);
|
||||
|
||||
// Return the transaction hex.
|
||||
return transaction;
|
||||
|
||||
Reference in New Issue
Block a user