@@ -286,12 +286,16 @@ struct PSBTInput
286
286
case PSBT_IN_NON_WITNESS_UTXO:
287
287
if (non_witness_utxo) {
288
288
throw std::ios_base::failure (" Duplicate Key, input non-witness utxo already provided" );
289
+ } else if (key.size () != 1 ) {
290
+ throw std::ios_base::failure (" Non-witness utxo key is more than one byte type" );
289
291
}
290
292
UnserializeFromVector (s, non_witness_utxo);
291
293
break ;
292
294
case PSBT_IN_WITNESS_UTXO:
293
295
if (!witness_utxo.IsNull ()) {
294
296
throw std::ios_base::failure (" Duplicate Key, input witness utxo already provided" );
297
+ } else if (key.size () != 1 ) {
298
+ throw std::ios_base::failure (" Witness utxo key is more than one byte type" );
295
299
}
296
300
UnserializeFromVector (s, witness_utxo);
297
301
break ;
@@ -321,13 +325,17 @@ struct PSBTInput
321
325
case PSBT_IN_SIGHASH:
322
326
if (sighash_type > 0 ) {
323
327
throw std::ios_base::failure (" Duplicate Key, input sighash type already provided" );
328
+ } else if (key.size () != 1 ) {
329
+ throw std::ios_base::failure (" Sighash type key is more than one byte type" );
324
330
}
325
331
UnserializeFromVector (s, sighash_type);
326
332
break ;
327
333
case PSBT_IN_REDEEMSCRIPT:
328
334
{
329
335
if (!redeem_script.empty ()) {
330
336
throw std::ios_base::failure (" Duplicate Key, input redeemScript already provided" );
337
+ } else if (key.size () != 1 ) {
338
+ throw std::ios_base::failure (" Input redeemScript key is more than one byte type" );
331
339
}
332
340
s >> redeem_script;
333
341
break ;
@@ -336,6 +344,8 @@ struct PSBTInput
336
344
{
337
345
if (!witness_script.empty ()) {
338
346
throw std::ios_base::failure (" Duplicate Key, input witnessScript already provided" );
347
+ } else if (key.size () != 1 ) {
348
+ throw std::ios_base::failure (" Input witnessScript key is more than one byte type" );
339
349
}
340
350
s >> witness_script;
341
351
break ;
@@ -349,6 +359,8 @@ struct PSBTInput
349
359
{
350
360
if (!final_script_sig.empty ()) {
351
361
throw std::ios_base::failure (" Duplicate Key, input final scriptSig already provided" );
362
+ } else if (key.size () != 1 ) {
363
+ throw std::ios_base::failure (" Final scriptSig key is more than one byte type" );
352
364
}
353
365
s >> final_script_sig;
354
366
break ;
@@ -357,6 +369,8 @@ struct PSBTInput
357
369
{
358
370
if (!final_script_witness.IsNull ()) {
359
371
throw std::ios_base::failure (" Duplicate Key, input final scriptWitness already provided" );
372
+ } else if (key.size () != 1 ) {
373
+ throw std::ios_base::failure (" Final scriptWitness key is more than one byte type" );
360
374
}
361
375
UnserializeFromVector (s, final_script_witness.stack );
362
376
break ;
@@ -444,6 +458,8 @@ struct PSBTOutput
444
458
{
445
459
if (!redeem_script.empty ()) {
446
460
throw std::ios_base::failure (" Duplicate Key, output redeemScript already provided" );
461
+ } else if (key.size () != 1 ) {
462
+ throw std::ios_base::failure (" Output redeemScript key is more than one byte type" );
447
463
}
448
464
s >> redeem_script;
449
465
break ;
@@ -452,6 +468,8 @@ struct PSBTOutput
452
468
{
453
469
if (!witness_script.empty ()) {
454
470
throw std::ios_base::failure (" Duplicate Key, output witnessScript already provided" );
471
+ } else if (key.size () != 1 ) {
472
+ throw std::ios_base::failure (" Output witnessScript key is more than one byte type" );
455
473
}
456
474
s >> witness_script;
457
475
break ;
@@ -566,6 +584,8 @@ struct PartiallySignedTransaction
566
584
{
567
585
if (tx) {
568
586
throw std::ios_base::failure (" Duplicate Key, unsigned tx already provided" );
587
+ } else if (key.size () != 1 ) {
588
+ throw std::ios_base::failure (" Global unsigned tx key is more than one byte type" );
569
589
}
570
590
CMutableTransaction mtx;
571
591
UnserializeFromVector (s, mtx);
0 commit comments