Skip to content

Commit e642c7b

Browse files
Merge pull request #5249 from BitGo/BTC-1450.fix-decodetransaction-bug
fix(abstract-utxo): fix decodeTransaction for base64 input
2 parents 4b1a825 + c00ade0 commit e642c7b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,11 @@ export abstract class AbstractUtxoCoin extends BaseCoin {
567567
if (typeof input === 'string') {
568568
for (const format of ['hex', 'base64'] as const) {
569569
const buffer = Buffer.from(input, format);
570-
if (buffer.toString(format) === input.toLowerCase()) {
570+
const bufferToString = buffer.toString(format);
571+
if (
572+
(format === 'base64' && bufferToString === input) ||
573+
(format === 'hex' && bufferToString === input.toLowerCase())
574+
) {
571575
return this.decodeTransaction(buffer);
572576
}
573577
}

0 commit comments

Comments
 (0)