@@ -79,7 +79,7 @@ protected override void WriteCore(JsonTextWriter jsonWriter)
7979
8080 internal PSBT0 ( Maps maps , Network network ) : base ( maps , network , PSBTVersion . PSBTv0 )
8181 {
82- if ( ! maps . Global . TryRemove < byte [ ] > ( [ PSBTConstants . PSBT_GLOBAL_UNSIGNED_TX ] , out var txBytes ) )
82+ if ( ! maps . Global . TryRemove < byte [ ] > ( PSBTConstants . PSBT_GLOBAL_UNSIGNED_TX , out var txBytes ) )
8383 throw new FormatException ( "Invalid PSBT. No global TX" ) ;
8484 tx = Transaction . Load ( txBytes , Network ) ;
8585 tx . PrecomputeHash ( true , true ) ;
@@ -100,10 +100,9 @@ internal PSBT0(Maps maps, Network network) : base(maps, network, PSBTVersion.PSB
100100 {
101101 var index = ( int ) ( 1 + Inputs . Count + indexedOutput . N ) ;
102102 var map = maps [ index ] ;
103- if ( map . Keys . Any ( bytes => bytes . Length == 1 && PSBT2Constants . PSBT_V0_OUTPUT_EXCLUSIONSET . Contains ( bytes [ 0 ] ) ) )
104- throw new FormatException ( "Invalid PSBT v0. Contains v2 fields" ) ;
105103 Outputs . Add ( new PSBT0Output ( map , this , indexedOutput . N , indexedOutput . TxOut ) ) ;
106104 }
105+ maps . ThrowIfInvalidKeysLeft ( ) ;
107106 }
108107
109108 internal override void FillMap ( Map map )
@@ -129,6 +128,8 @@ public PSBT0Output(Map map, PSBT parent, uint index, TxOut txOut) : base(map, pa
129128 {
130129 if ( txOut is null )
131130 throw new ArgumentNullException ( nameof ( txOut ) ) ;
131+ if ( map . Keys . Any ( bytes => bytes . Length == 1 && PSBT2Constants . PSBT_V0_OUTPUT_EXCLUSIONSET . Contains ( bytes [ 0 ] ) ) )
132+ throw new FormatException ( "Invalid PSBT v0. Contains v2 fields" ) ;
132133 TxOut = txOut ;
133134 }
134135
@@ -168,10 +169,6 @@ internal PSBT0Input(Map map, PSBT0 parent, uint index) : base(map, parent, index
168169 if ( this . Unknown . Keys . Any ( bytes => bytes . Length == 1 && PSBT2Constants . PSBT_V0_INPUT_EXCLUSIONSET . Contains ( bytes [ 0 ] ) ) )
169170 throw new FormatException ( "Invalid PSBT v0. Contains v2 fields" ) ;
170171 txIn = parent . tx . Inputs [ index ] ;
171- if ( ! Script . IsNullOrEmpty ( txIn . ScriptSig ) )
172- this . FinalScriptSig = txIn . ScriptSig ;
173- if ( ! WitScript . IsNullOrEmpty ( txIn . WitScript ) )
174- this . WitnessScript = txIn . WitScript ;
175172 }
176173 TxIn txIn ;
177174 public override OutPoint PrevOut => txIn . PrevOut ;
0 commit comments