Skip to content

Commit e885ac5

Browse files
committed
Add wrapper for encodeWitnessEcdsaSig()
1 parent 9a70b83 commit e885ac5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/scala/fr/acinq/bitcoin/scalacompat/Transaction.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,13 @@ object Transaction extends BtcSerializer[Transaction] {
303303
def signInput(tx: Transaction, inputIndex: Int, previousOutputScript: Seq[ScriptElt], sighashType: Int, amount: Satoshi, signatureVersion: Int, privateKey: PrivateKey): ByteVector =
304304
signInput(tx, inputIndex, Script.write(previousOutputScript), sighashType, amount, signatureVersion, privateKey)
305305

306+
/**
307+
* @param sig ECDSA signature in compact format
308+
* @param sighashType signature hash type, which will be appended to the signature
309+
* @return an ECDSA signature in the format used in transaction witnesses: DER encoded followed by a sighash byte
310+
*/
311+
def encodeWitnessEcdsaSig(sig: ByteVector64, sighashType: Int): ByteVector = ByteVector.view(fr.acinq.bitcoin.Transaction.encodeWitnessEcdsaSig(sig, sighashType))
312+
306313
/**
307314
* Sign a taproot tx input, using the internal key path.
308315
*

0 commit comments

Comments
 (0)