fix compile issues

This commit is contained in:
Ben Carman 2020-03-09 11:10:00 -05:00
parent c8dde77421
commit 3ba658b750

View file

@ -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