@@ -298,35 +298,18 @@ class JadeHWWallet constructor(
298298 // Get the inputs in the form Jade expects
299299 val txInputs = inputs.map { input ->
300300
301- val swInput = input.isSegwit()
302- val script = input.prevoutScript?.hexToByteArray()
301+ // Send the prevout transaction (so it can verify the tx input).
302+ val txhex = transactions[input.txHash]
303+ ? : throw Exception (" Required input transaction not found: ${input.txHash} " )
303304
304- if (swInput && inputs.size == 1 ) {
305- // Single SegWit input - can skip sending entire tx and just send the sats amount
306- TxInput (
307- isWitness = true ,
308- script = script,
309- satoshi = input.satoshi,
310- path = input.userPath,
311- aeHostCommitment = input.aeHostCommitment?.hexToByteArray(),
312- aeHostEntropy = input.aeHostEntropy?.hexToByteArray()
313- )
314- } else {
315- // Non-SegWit input or there are several inputs - in which case we always send
316- // the entire prior transaction up to Jade (so it can verify the spend amounts).
317- val txhex = transactions[input.txHash]
318- ? : throw Exception (" Required input transaction not found: ${input.txHash} " )
319- val inputTx = txhex.hexToByteArray()
320-
321- TxInput (
322- isWitness = swInput,
323- inputTx = inputTx,
324- script = script,
325- path = input.userPath,
326- aeHostCommitment = input.aeHostCommitment?.hexToByteArray(),
327- aeHostEntropy = input.aeHostEntropy?.hexToByteArray()
328- )
329- }
305+ TxInput (
306+ isWitness = input.isSegwit(),
307+ inputTx = txhex.hexToByteArray(),
308+ script = input.prevoutScript?.hexToByteArray(),
309+ path = input.userPath,
310+ aeHostCommitment = input.aeHostCommitment?.hexToByteArray(),
311+ aeHostEntropy = input.aeHostEntropy?.hexToByteArray()
312+ )
330313 }
331314
332315 // Get the change outputs and paths
@@ -605,4 +588,4 @@ class JadeHWWallet constructor(
605588 return result
606589 }
607590 }
608- }
591+ }
0 commit comments