Skip to content

Commit

Permalink
Replace null values with EmptyTransaction and PSBT.empty
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Jan 28, 2020
1 parent 5f1716b commit 5692a7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/cli/src/main/scala/org/bitcoins/cli/Cli.scala
Expand Up @@ -8,7 +8,7 @@ import org.bitcoins.cli.CliReaders._
import org.bitcoins.core.config.NetworkParameters
import org.bitcoins.core.currency._
import org.bitcoins.core.protocol._
import org.bitcoins.core.protocol.transaction.Transaction
import org.bitcoins.core.protocol.transaction.{EmptyTransaction, Transaction}
import org.bitcoins.core.psbt.PSBT
import org.bitcoins.picklers._
import scopt.OParser
Expand Down Expand Up @@ -196,7 +196,7 @@ object Cli extends App {
),
cmd("finalizepsbt")
.hidden()
.action((_, conf) => conf.copy(command = FinalizePSBT(null)))
.action((_, conf) => conf.copy(command = FinalizePSBT(PSBT.empty)))
.text("Finalizes the given PSBT if it can")
.children(
opt[PSBT]("psbt")
Expand All @@ -210,7 +210,7 @@ object Cli extends App {
),
cmd("extractfrompsbt")
.hidden()
.action((_, conf) => conf.copy(command = ExtractFromPSBT(null)))
.action((_, conf) => conf.copy(command = ExtractFromPSBT(PSBT.empty)))
.text("Extracts a transaction from the given PSBT if it can")
.children(
opt[PSBT]("psbt")
Expand All @@ -224,7 +224,8 @@ object Cli extends App {
),
cmd("converttopsbt")
.hidden()
.action((_, conf) => conf.copy(command = ConvertToPSBT(null)))
.action((_, conf) =>
conf.copy(command = ConvertToPSBT(EmptyTransaction)))
.text("Creates an empty psbt from the given transaction")
.children(
opt[Transaction]("unsignedTx")
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/scala/org/bitcoins/core/psbt/PSBT.scala
Expand Up @@ -614,6 +614,8 @@ object PSBT extends Factory[PSBT] {
// The magic bytes and separator defined by https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#specification
final val magicBytes = hex"70736274ff"

final val empty = fromUnsignedTx(EmptyTransaction)

def fromString(str: String): PSBT = {
ByteVector.fromHex(str) match {
case Some(hex) =>
Expand Down

0 comments on commit 5692a7d

Please sign in to comment.