mirror of
				https://github.com/bitcoin/bips.git
				synced 2025-10-27 14:09:10 +00:00 
			
		
		
		
	[BIP78] Fix client implementation when there is output substitution
This commit is contained in:
		
							parent
							
								
									a76f5e4335
								
							
						
					
					
						commit
						d8db3d7608
					
				| @ -541,10 +541,16 @@ public async Task<PSBT> RequestPayjoin( | ||||
|         // Verify that no keypaths is in the PSBT output | ||||
|         if (proposedPSBTOutput.HDKeyPaths.Count != 0) | ||||
|             throw new PayjoinSenderException("The receiver added keypaths to an output"); | ||||
|         bool isOriginalOutput = originalOutputs.Count > 0 && originalOutputs.Peek().OriginalTxOut.ScriptPubKey == proposedPSBTOutput.ScriptPubKey; | ||||
|         if (isOriginalOutput) | ||||
|         if (originalOutputs.Count == 0) | ||||
|                 continue; | ||||
|         var originalOutput = originalOutputs.Peek(); | ||||
|         bool isOriginalOutput = originalOutput.OriginalTxOut.ScriptPubKey == proposedPSBTOutput.ScriptPubKey; | ||||
|         bool substitutedOutput = !isOriginalOutput && | ||||
|                                 allowOutputSubstitution && | ||||
|                                 originalOutput.OriginalTxOut.ScriptPubKey == paymentScriptPubKey; | ||||
|         if (isOriginalOutput || substitutedOutput) | ||||
|         { | ||||
|             var originalOutput = originalOutputs.Dequeue(); | ||||
|             originalOutputs.Dequeue(); | ||||
|             if (output.OriginalTxOut == feeOutput) | ||||
|             { | ||||
|                 var actualContribution = feeOutput.Value - proposedPSBTOutput.Value; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user