From 3ba658b750c7876e45118eacd5208f48b722c7fc Mon Sep 17 00:00:00 2001 From: Ben Carman Date: Mon, 9 Mar 2020 11:10:00 -0500 Subject: [PATCH] fix compile issues --- docs/core/psbts.md | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/core/psbts.md b/docs/core/psbts.md index b6f869a639..99105473d3 100644 --- a/docs/core/psbts.md +++ b/docs/core/psbts.md @@ -23,7 +23,13 @@ import org.bitcoins.core.protocol.script.ScriptPubKey import org.bitcoins.core.protocol.transaction.{BaseTransaction, Transaction} import org.bitcoins.core.psbt.PSBT import org.bitcoins.core.script.crypto.HashType +import org.bitcoins.core.wallet.signer.BitcoinSignerSingle +import org.bitcoins.core.wallet.utxo.{ + BitcoinUTXOSpendingInfoSingle, + ConditionalPath +} import scodec.bits._ + import scala.concurrent.{ExecutionContext, ExecutionContextExecutor} ``` @@ -38,7 +44,7 @@ val unsignedTransaction = BaseTransaction( "020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f00000000") // To create the initial PSBT all we need to do is - val emptyPSBT = PSBT.fromUnsignedTx(unsignedTransaction) +val emptyPSBT = PSBT.fromUnsignedTx(unsignedTransaction) // Now that we have an empty PSBT we can start updating it with data we know @@ -114,19 +120,20 @@ val outPoint = unsignedTransaction.inputs.head.previousOutput val output = utxo0.outputs(outPoint.vout.toInt) val spendingInfoSingle = BitcoinUTXOSpendingInfoSingle( - outPoint = outPoint, - output = output, - signer = privKey0, - redeemScriptOpt = Some(redeemScript0), - scriptWitnessOpt = None, - hashType = HashType.sigHashAll, - conditionalPath = ConditionalPath.NoConditionsLeft - ) + outPoint = outPoint, + output = output, + signer = privKey0, + redeemScriptOpt = Some(redeemScript0), + scriptWitnessOpt = None, + hashType = HashType.sigHashAll, + conditionalPath = ConditionalPath.NoConditionsLeft + ) // Then we can sign the transaction -val signatureF = BitcoinSignerSingle.signSingle(spendingInfo = spendingInfoSingle, - unsignedTx = unsignedTransaction, - isDummySignature = false) +val signatureF = BitcoinSignerSingle.signSingle( + spendingInfo = spendingInfoSingle, + unsignedTx = unsignedTransaction, + isDummySignature = false) // We can then add the signature to the PSBT // Note: this signature could be produced by us or another party