mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-22 14:22:39 +01:00
Electrum: fix signature bug (#524)
Regression caused signature to use wrong utxo amount which means it would not be valid, and the funding tx could not be published.
This commit is contained in:
parent
b2178ade30
commit
717eaa799f
1 changed files with 1 additions and 1 deletions
|
@ -736,7 +736,7 @@ object ElectrumWallet {
|
|||
tx.copy(txIn = tx.txIn.zipWithIndex.map { case (txIn, i) =>
|
||||
val utxo = utxos.find(_.outPoint == txIn.outPoint).getOrElse(throw new RuntimeException(s"cannot sign input that spends from ${txIn.outPoint}"))
|
||||
val key = utxo.key
|
||||
val sig = Transaction.signInput(tx, i, Script.pay2pkh(key.publicKey), SIGHASH_ALL, Satoshi(utxos(i).item.value), SigVersion.SIGVERSION_WITNESS_V0, key.privateKey)
|
||||
val sig = Transaction.signInput(tx, i, Script.pay2pkh(key.publicKey), SIGHASH_ALL, Satoshi(utxo.item.value), SigVersion.SIGVERSION_WITNESS_V0, key.privateKey)
|
||||
val sigScript = Script.write(OP_PUSHDATA(Script.write(Script.pay2wpkh(key.publicKey))) :: Nil)
|
||||
val witness = ScriptWitness(sig :: key.publicKey.toBin :: Nil)
|
||||
txIn.copy(signatureScript = sigScript, witness = witness)
|
||||
|
|
Loading…
Add table
Reference in a new issue