@ -953,6 +953,8 @@ class PayjoinServer(Resource):
# intended (note the outputs will be shuffled next!):
# intended (note the outputs will be shuffled next!):
outs [ 1 ] [ " value " ] - = our_fee_bump
outs [ 1 ] [ " value " ] - = our_fee_bump
# TODO this only works for 2 input transactions, otherwise
# pure-shuffle will not be valid as per BIP78 ordering requirement.
unsigned_payjoin_tx = btc . make_shuffled_tx ( payjoin_tx_inputs , outs ,
unsigned_payjoin_tx = btc . make_shuffled_tx ( payjoin_tx_inputs , outs ,
version = payment_psbt . unsigned_tx . nVersion ,
version = payment_psbt . unsigned_tx . nVersion ,
locktime = payment_psbt . unsigned_tx . nLockTime )
locktime = payment_psbt . unsigned_tx . nLockTime )
@ -970,6 +972,7 @@ class PayjoinServer(Resource):
inp . nSequence = inp2 . nSequence
inp . nSequence = inp2 . nSequence
spent_outs . append ( payment_psbt . inputs [ j ] . utxo )
spent_outs . append ( payment_psbt . inputs [ j ] . utxo )
input_found = True
input_found = True
sender_index = i
break
break
if input_found :
if input_found :
continue
continue
@ -1007,6 +1010,11 @@ class PayjoinServer(Resource):
assert signresult . num_inputs_final == len ( receiver_utxos )
assert signresult . num_inputs_final == len ( receiver_utxos )
assert not signresult . is_final
assert not signresult . is_final
# with signing succcessful, remove the utxo field from the
# counterparty's input (this is required by BIP78). Note we don't
# do this on PSBT creation as the psbt signing code throws ValueError
# unless utxos are present.
receiver_signed_psbt . inputs [ sender_index ] = btc . PSBT_Input ( index = sender_index )
log . debug ( " Receiver signing successful. Payjoin PSBT is now: \n {} " . format (
log . debug ( " Receiver signing successful. Payjoin PSBT is now: \n {} " . format (
self . wallet_service . human_readable_psbt ( receiver_signed_psbt ) ) )
self . wallet_service . human_readable_psbt ( receiver_signed_psbt ) ) )
# construct txoutset for the wallet service callback; we cannot use
# construct txoutset for the wallet service callback; we cannot use