Skip to content

Commit

Permalink
fix : bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaysehwal committed Apr 24, 2024
1 parent 3bd6aa6 commit 4df42f3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
17 changes: 8 additions & 9 deletions dist/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.BitcoinScript = void 0;
const p2pkh_1 = require("./p2pkh");
const p2wpkh_1 = require("./p2wpkh");
class BitcoinScript {
constructor(transaction) {
this.transaction = transaction;
Expand All @@ -20,14 +19,14 @@ class BitcoinScript {
const p2pkh = new p2pkh_1.P2PKH(this.transaction);
isValidInput = p2pkh.execute(scriptPubKey, scriptSig, i);
break;
case "v0_p2wpkh":
scriptPubKey = input.prevout.scriptpubkey_asm;
publicKeyHash = scriptPubKey.split(" ")[2];
scriptPubKey = `OP_DUP OP_HASH160 ${publicKeyHash} OP_EQUALVERIFY OP_CHECKSIG`;
witness = input.witness;
const p2wpkh = new p2wpkh_1.P2WPKH(this.transaction);
isValidInput = p2wpkh.execute(scriptPubKey, witness, i);
break;
// case "v0_p2wpkh":
// scriptPubKey = input.prevout.scriptpubkey_asm;
// publicKeyHash = scriptPubKey.split(" ")[2];
// scriptPubKey = `OP_DUP OP_HASH160 ${publicKeyHash} OP_EQUALVERIFY OP_CHECKSIG`;
// witness = input.witness;
// const p2wpkh = new P2WPKH(this.transaction);
// isValidInput = p2wpkh.execute(scriptPubKey, witness, i);
// break;
default:
break;
}
Expand Down
6 changes: 3 additions & 3 deletions dist/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class Validator {
}
}
console.log(`Find ${this.ValidTXCount} are valid and ${this.InValidTXCount} invalid`);
for (let i = 0; i < 3450; i++) {
validTransactions.pop();
}
// for (let i = 0; i < 3450; i++) {
// validTransactions.pop();
// }
return validTransactions;
}
start(transaction) {
Expand Down
16 changes: 8 additions & 8 deletions src/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export class BitcoinScript {
const p2pkh = new P2PKH(this.transaction);
isValidInput = p2pkh.execute(scriptPubKey, scriptSig, i);
break;
case "v0_p2wpkh":
scriptPubKey = input.prevout.scriptpubkey_asm;
publicKeyHash = scriptPubKey.split(" ")[2];
scriptPubKey = `OP_DUP OP_HASH160 ${publicKeyHash} OP_EQUALVERIFY OP_CHECKSIG`;
witness = input.witness;
const p2wpkh = new P2WPKH(this.transaction);
isValidInput = p2wpkh.execute(scriptPubKey, witness, i);
break;
// case "v0_p2wpkh":
// scriptPubKey = input.prevout.scriptpubkey_asm;
// publicKeyHash = scriptPubKey.split(" ")[2];
// scriptPubKey = `OP_DUP OP_HASH160 ${publicKeyHash} OP_EQUALVERIFY OP_CHECKSIG`;
// witness = input.witness;
// const p2wpkh = new P2WPKH(this.transaction);
// isValidInput = p2wpkh.execute(scriptPubKey, witness, i);
// break;
default:
break;
}
Expand Down
6 changes: 3 additions & 3 deletions src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export class Validator {
console.log(
`Find ${this.ValidTXCount} are valid and ${this.InValidTXCount} invalid`
);
for (let i = 0; i < 3450; i++) {
validTransactions.pop();
}
// for (let i = 0; i < 3450; i++) {
// validTransactions.pop();
// }
return validTransactions;
}

Expand Down

0 comments on commit 4df42f3

Please sign in to comment.