Skip to content

Commit 79289c1

Browse files
committed
fix: rollback TapBip32Derivation check
1 parent 5000cf8 commit 79289c1

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/lib/converter/shared/tapBip32Derivation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ function makeConverter(TYPE_BYTE) {
3434
'leafHashes: Buffer[]; ' +
3535
'}';
3636
function check(data) {
37-
let leafHashesStatus = true;
38-
if (data.leafHashes && data.leafHashes.length) {
39-
leafHashesStatus = data.leafHashes.every(
37+
return (
38+
Array.isArray(data.leafHashes) &&
39+
data.leafHashes.every(
4040
leafHash => Buffer.isBuffer(leafHash) && leafHash.length === 32,
41-
);
42-
}
43-
return leafHashesStatus && parent.check(data);
41+
) &&
42+
parent.check(data)
43+
);
4444
}
4545
return {
4646
decode,

ts_src/lib/converter/shared/tapBip32Derivation.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,13 @@ export function makeConverter(
4949
'leafHashes: Buffer[]; ' +
5050
'}';
5151
function check(data: any): data is TapBip32Derivation {
52-
let leafHashesStatus = true;
53-
if (data.leafHashes && data.leafHashes.length){
54-
leafHashesStatus = data.leafHashes.every(
52+
return (
53+
Array.isArray(data.leafHashes) &&
54+
data.leafHashes.every(
5555
(leafHash: any) => Buffer.isBuffer(leafHash) && leafHash.length === 32,
56-
)
57-
}
58-
59-
return leafHashesStatus && parent.check(data)
56+
) &&
57+
parent.check(data)
58+
);
6059
}
6160

6261
return {

0 commit comments

Comments
 (0)