Skip to content

Commit

Permalink
Merge pull request #2171 from JacksonDMiller/JacksonDMiller-addStripW…
Browse files Browse the repository at this point in the history
…itnessesToTransaction

Update v6 branch: Add stripWitness to Transaction Issue 2169 #2170
  • Loading branch information
junderw authored Oct 1, 2024
2 parents 57078a2 + c463f5f commit 0c38a66
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 224 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@ jobs:
#####################
# Jobs without matrix
#####################
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2
- uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3
with:
node-version: 'lts/*'
registry-url: https://registry.npmjs.org/
cache: 'npm'
- run: npm ci
- run: npm run audit
coverage:
runs-on: ubuntu-latest
steps:
Expand Down
211 changes: 0 additions & 211 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"bitcoinjs"
],
"scripts": {
"audit": "better-npm-audit audit -l high",
"build": "npm run clean && tsc -p ./tsconfig.json && npm run formatjs",
"build:tests": "npm run clean:jstests && tsc -p ./test/tsconfig.json",
"clean": "rimraf src",
Expand Down Expand Up @@ -66,7 +65,6 @@
"@types/randombytes": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"better-npm-audit": "^3.7.3",
"bip32": "^4.0.0",
"bip39": "^3.1.0",
"bip65": "^1.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/transaction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export declare class Transaction {
addInput(hash: Buffer, index: number, sequence?: number, scriptSig?: Buffer): number;
addOutput(scriptPubKey: Buffer, value: number): number;
hasWitnesses(): boolean;
stripWitnesses(): void;
weight(): number;
virtualSize(): number;
byteLength(_ALLOW_WITNESS?: boolean): number;
Expand Down
5 changes: 5 additions & 0 deletions src/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ class Transaction {
return x.witness.length !== 0;
});
}
stripWitnesses() {
this.ins.forEach(input => {
input.witness = EMPTY_WITNESS; // Set witness data to an empty array
});
}
weight() {
const base = this.byteLength(false);
const total = this.byteLength(true);
Expand Down
Loading

0 comments on commit 0c38a66

Please sign in to comment.