Skip to content

Commit

Permalink
fix: merkle root calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nesopie committed Mar 27, 2024
1 parent 424725a commit 30e1234
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/features/block/merkleRoot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Transaction } from "../../types";
import { reversify, sha256 } from "../../utils";
import { txSerializer } from "../encoding/serializer";
import { sha256 } from "../../utils";

export const merkleRoot = (txs: string[]) => {
let curr = txs;
Expand Down
2 changes: 1 addition & 1 deletion src/features/block/mine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const mine = (
const prevBlockHash = DIFFICULTY; //make it the same as the difficulty

const merkleRootHash = merkleRoot(
[coinbaseTransaction, ...txs].map((tx) => tx.txid)
[coinbaseTransaction, ...txs].map((tx) => reversify(tx.txid))
);

const time = Buffer.alloc(4);
Expand Down

0 comments on commit 30e1234

Please sign in to comment.