Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
whitehawk0910 authored Apr 30, 2024
1 parent 920d569 commit 4191d31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const ec = new EC('secp256k1');

function getUnspentTransactions() {
// Implementation might fetch real data from a JSON file or database
return JSON.parse(fs.readFileSync('./unspent.json', 'utf8'));
return JSON.parse(fs.readFileSync('./mempool', 'utf8'));
}

function serializeTransaction(transaction) {
Expand Down Expand Up @@ -35,6 +35,7 @@ function validateTransaction(transaction, unspent) {
function readTransactions(mempoolDirectory) {
return fs.readdirSync(mempoolDirectory).map(filename => {
return JSON.parse(fs.readFileSync(`${mempoolDirectory}/${filename}`, 'utf8'));

}).filter(tx => validateTransaction(tx, getUnspentTransactions()));
}

Expand Down

0 comments on commit 4191d31

Please sign in to comment.