Skip to content

Commit

Permalink
chore: remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nesopie committed Aug 29, 2024
1 parent 1bff3ef commit 1199d38
Show file tree
Hide file tree
Showing 18 changed files with 0 additions and 23 deletions.
2 changes: 0 additions & 2 deletions src/cjs/lib/combiner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ exports.combine = combine;
function keyPusher(selfSet, selfKeyVals, otherKeyVals) {
return key => {
if (selfSet.has(key)) return;
// const newKv = otherKeyVals.filter(kv => kv.key.toString('hex') === key)[0];
const newKv = otherKeyVals.filter(kv => tools.toHex(kv.key) === key)[0];
selfKeyVals.push(newKv);
selfSet.add(key);
Expand All @@ -87,7 +86,6 @@ function getTx(psbt) {
function getKeySet(keyVals) {
const set = new Set();
keyVals.forEach(keyVal => {
// const hex = keyVal.key.toString('hex');
const hex = tools.toHex(keyVal.key);
if (set.has(hex))
throw new Error('Combine: KeyValue Map keys should be unique');
Expand Down
1 change: 0 additions & 1 deletion src/cjs/lib/converter/input/tapScriptSig.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function decode(keyVal) {
if (keyVal.key[0] !== typeFields_js_1.InputTypes.TAP_SCRIPT_SIG) {
throw new Error(
'Decode Error: could not decode tapScriptSig with key 0x' +
// keyVal.key.toString('hex'),
tools.toHex(keyVal.key),
);
}
Expand Down
1 change: 0 additions & 1 deletion src/cjs/lib/converter/output/tapTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var __importStar =
};
Object.defineProperty(exports, '__esModule', { value: true });
const typeFields_js_1 = require('../../typeFields.js');
// import * as varuint from '../varint.js';
const varuint = __importStar(require('varuint-bitcoin'));
const tools = __importStar(require('uint8array-tools'));
function decode(keyVal) {
Expand Down
1 change: 0 additions & 1 deletion src/cjs/lib/parser/fromBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var __importStar =
Object.defineProperty(exports, '__esModule', { value: true });
const convert = __importStar(require('../converter/index.js'));
const tools_js_1 = require('../converter/tools.js');
// import * as varuint from '../converter/varint.js';
const varuint = __importStar(require('varuint-bitcoin'));
const tools = __importStar(require('uint8array-tools'));
const typeFields_js_1 = require('../typeFields.js');
Expand Down
2 changes: 0 additions & 2 deletions src/esm/lib/combiner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export function combine(psbts) {
function keyPusher(selfSet, selfKeyVals, otherKeyVals) {
return key => {
if (selfSet.has(key)) return;
// const newKv = otherKeyVals.filter(kv => kv.key.toString('hex') === key)[0];
const newKv = otherKeyVals.filter(kv => tools.toHex(kv.key) === key)[0];
selfKeyVals.push(newKv);
selfSet.add(key);
Expand All @@ -73,7 +72,6 @@ function getTx(psbt) {
function getKeySet(keyVals) {
const set = new Set();
keyVals.forEach(keyVal => {
// const hex = keyVal.key.toString('hex');
const hex = tools.toHex(keyVal.key);
if (set.has(hex))
throw new Error('Combine: KeyValue Map keys should be unique');
Expand Down
1 change: 0 additions & 1 deletion src/esm/lib/converter/input/tapScriptSig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export function decode(keyVal) {
if (keyVal.key[0] !== InputTypes.TAP_SCRIPT_SIG) {
throw new Error(
'Decode Error: could not decode tapScriptSig with key 0x' +
// keyVal.key.toString('hex'),
tools.toHex(keyVal.key),
);
}
Expand Down
1 change: 0 additions & 1 deletion src/esm/lib/converter/output/tapTree.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { OutputTypes } from '../../typeFields.js';
// import * as varuint from '../varint.js';
import * as varuint from 'varuint-bitcoin';
import * as tools from 'uint8array-tools';
export function decode(keyVal) {
Expand Down
1 change: 0 additions & 1 deletion src/esm/lib/parser/fromBuffer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as convert from '../converter/index.js';
import { range } from '../converter/tools.js';
// import * as varuint from '../converter/varint.js';
import * as varuint from 'varuint-bitcoin';
import * as tools from 'uint8array-tools';
import { GlobalTypes, InputTypes, OutputTypes } from '../typeFields.js';
Expand Down
2 changes: 0 additions & 2 deletions src/esm/tests/fixtures/keyValsToPsbt.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// import * as tools from 'uint8array-tools';
const b = hex => Buffer.from(hex, 'hex');
// const b = (hex: string): Uint8Array => tools.fromHex(hex);
export const fixtures = [
{
data: {
Expand Down
1 change: 0 additions & 1 deletion src/esm/tests/keyValsToPsbt.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ for (const f of fixtures) {
const psbt = new Psbt(tx);
Object.assign(psbt, data);
t.strictEqual(psbt.toBase64(), f.expected);
// else console.log(psbt.toBase64());
t.end();
});
}
Expand Down
1 change: 0 additions & 1 deletion src/esm/tests/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ tape('should not pass isPartialSig with invalid DER signature', t => {
}, new RegExp('Decode Error: partialSig has invalid pubkey in key 0x02ff'));
keyVal.key = Buffer.concat([b('02'), data.pubkey, data.pubkey.slice(1)]);
const result = convertInputs.partialSig.decode(keyVal);
// t.assert(result.pubkey.equals(keyVal.key.slice(1)));
t.assert(tools.compare(result.pubkey, keyVal.key.slice(1)) === 0);
const psbt1 = {
globalMap: {
Expand Down
2 changes: 0 additions & 2 deletions ts_src/lib/combiner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function keyPusher(
): (key: string) => void {
return (key: string): void => {
if (selfSet.has(key)) return;
// const newKv = otherKeyVals.filter(kv => kv.key.toString('hex') === key)[0];
const newKv = otherKeyVals.filter(kv => tools.toHex(kv.key) === key)[0];
selfKeyVals.push(newKv);
selfSet.add(key);
Expand All @@ -91,7 +90,6 @@ function getTx(psbt: PsbtAttributes): Transaction | undefined {
function getKeySet(keyVals: KeyValue[]): Set<string> {
const set: Set<string> = new Set();
keyVals.forEach(keyVal => {
// const hex = keyVal.key.toString('hex');
const hex = tools.toHex(keyVal.key);
if (set.has(hex))
throw new Error('Combine: KeyValue Map keys should be unique');
Expand Down
1 change: 0 additions & 1 deletion ts_src/lib/converter/input/tapScriptSig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export function decode(keyVal: KeyValue): TapScriptSig {
if (keyVal.key[0] !== InputTypes.TAP_SCRIPT_SIG) {
throw new Error(
'Decode Error: could not decode tapScriptSig with key 0x' +
// keyVal.key.toString('hex'),
tools.toHex(keyVal.key),
);
}
Expand Down
1 change: 0 additions & 1 deletion ts_src/lib/converter/output/tapTree.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { KeyValue, TapLeaf, TapTree } from '../../interfaces';
import { OutputTypes } from '../../typeFields.js';
// import * as varuint from '../varint.js';
import * as varuint from 'varuint-bitcoin';
import * as tools from 'uint8array-tools';

Expand Down
1 change: 0 additions & 1 deletion ts_src/lib/parser/fromBuffer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as convert from '../converter/index.js';
import { range } from '../converter/tools.js';
// import * as varuint from '../converter/varint.js';
import * as varuint from 'varuint-bitcoin';
import * as tools from 'uint8array-tools';
import {
Expand Down
2 changes: 0 additions & 2 deletions ts_src/tests/fixtures/keyValsToPsbt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// import * as tools from 'uint8array-tools';
const b = (hex: string): Buffer => Buffer.from(hex, 'hex');
// const b = (hex: string): Uint8Array => tools.fromHex(hex);

export const fixtures = [
{
Expand Down
1 change: 0 additions & 1 deletion ts_src/tests/keyValsToPsbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ for (const f of fixtures) {
const psbt = new Psbt(tx);
Object.assign(psbt, data);
t.strictEqual(psbt.toBase64(), f.expected);
// else console.log(psbt.toBase64());
t.end();
});
}
Expand Down
1 change: 0 additions & 1 deletion ts_src/tests/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ tape('should not pass isPartialSig with invalid DER signature', t => {
}, new RegExp('Decode Error: partialSig has invalid pubkey in key 0x02ff'));
keyVal.key = Buffer.concat([b('02'), data.pubkey, data.pubkey.slice(1)]);
const result = convertInputs.partialSig.decode(keyVal);
// t.assert(result.pubkey.equals(keyVal.key.slice(1)));
t.assert(tools.compare(result.pubkey, keyVal.key.slice(1)) === 0);

const psbt1: any = {
Expand Down

0 comments on commit 1199d38

Please sign in to comment.