Open DanGould opened 1 year ago
My brain has maybe 20% capacity but I think since it's the sender input you could just restore the known information before calling LND RPC? I think the point of that check is that the sender already knows the previous input so the receiver shouldn't tell the sender which it is.
Yes, and maybe checking Original PSBT in == PayJoin PSBT should be a check in that case
According to BIP 78 spec
which we follow here https://github.com/Kixunil/payjoin/blob/a225bafa1bfb99e80ab19687038c860dfee112e9/bip78/src/sender/mod.rs#L249-L250
According to the psbt Input Finalizer spec "All other data except the UTXO and unknown fields in the input key-value map should be cleared from the PSBT. The UTXO should be kept to allow Transaction Extractors to verify the final network serialized transaction." In Bip78, the receiver clears this data after it finalizes its inputs, even if the utxo belongs to the sender which needs that data.
I ran into a problem where LND's FinalizePsbt gRPC fails when this utxo data is missing. I see no good reason to remove this utxo information from the PSBT. I think LND's RPC should also succeed regardless of this data being present because it can look it up with the unsigned_tx's input outpoint (that's what bitcoind does). Still I think LND's RPC is technically BIP-0174 spec-compliant while BIP-0078 seems not to be.
https://github.com/lightningnetwork/lnd/blob/cf9a9864cf253dbbcac5904d360bbbde763e1ebe/lnwallet/rpcwallet/rpcwallet.go#L270-L286
cc @nickfarrow