Add check to avoid duplicate PSBT_GLOBAL_UNSIGNED_TX

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
natsoni 2026-07-08 11:34:29 +02:00 committed by GitHub
parent a9c296c44b
commit 4019c0b55b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1641,6 +1641,9 @@ export function encodePsbt(rawTx: Uint8Array, inputs: PsbtKeyValueMap[], outputs
// Add unsigned transaction (key type 0x00)
writeKeyValue(PSBT_GLOBAL.UNSIGNED_TX, new Uint8Array(), rawTx);
for (const [keyType, items] of globals) {
if (keyType === PSBT_GLOBAL.UNSIGNED_TX) {
throw new Error('PSBT global map must not include UNSIGNED_TX (0x00); provide it via rawTx');
}
for (const record of items) {
writeKeyValue(keyType, record.keyData, record.value);
}