mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-19 13:35:17 +01:00
Allow NonWitness and Witness UTXOs in same InputPSBTMap (#1761)
This commit is contained in:
parent
d9024b1752
commit
e4e81d8546
2 changed files with 5 additions and 7 deletions
|
@ -119,14 +119,16 @@ class PSBTUnitTest extends BitcoinSAsyncTest {
|
|||
assert(psbtWithSigHash.bytes == nextExpected.bytes)
|
||||
}
|
||||
|
||||
it must "fail to create a InputPSBTMap with both a NonWitness and Witness UTXO" in {
|
||||
it must "create a InputPSBTMap with both a NonWitness and Witness UTXO" in {
|
||||
val nonWitnessOrUnknownUTXO = NonWitnessOrUnknownUTXO(Transaction(
|
||||
"02000000019dfc6628c26c5899fe1bd3dc338665bfd55d7ada10f6220973df2d386dec12760100000000ffffffff01f03dcd1d000000001600147b3a00bfdc14d27795c2b74901d09da6ef13357900000000"))
|
||||
val witnessUTXO =
|
||||
WitnessUTXO(TransactionOutput(Satoshis.one, EmptyScriptPubKey))
|
||||
|
||||
assertThrows[IllegalArgumentException](
|
||||
InputPSBTMap(Vector(nonWitnessOrUnknownUTXO, witnessUTXO)))
|
||||
val inputMap = InputPSBTMap(Vector(nonWitnessOrUnknownUTXO, witnessUTXO))
|
||||
|
||||
assert(
|
||||
inputMap.bytes == hex"01005202000000019dfc6628c26c5899fe1bd3dc338665bfd55d7ada10f6220973df2d386dec12760100000000ffffffff01f03dcd1d000000001600147b3a00bfdc14d27795c2b74901d09da6ef1335790000000001010901000000000000000000")
|
||||
}
|
||||
|
||||
it must "correctly filter a GlobalPSBTMap" in {
|
||||
|
|
|
@ -149,10 +149,6 @@ object GlobalPSBTMap extends PSBTMapFactory[GlobalPSBTRecord, GlobalPSBTMap] {
|
|||
case class InputPSBTMap(elements: Vector[InputPSBTRecord])
|
||||
extends SeqWrapper[InputPSBTRecord]
|
||||
with PSBTMap[InputPSBTRecord] {
|
||||
require(
|
||||
this.witnessUTXOOpt.isEmpty || this.nonWitnessOrUnknownUTXOOpt.isEmpty,
|
||||
"InputPSBTMap cannot have both a NonWitnessOrUnknownUTXO and a WitnessUTXO"
|
||||
)
|
||||
override protected val wrapped: Vector[InputPSBTRecord] = elements
|
||||
|
||||
import org.bitcoins.core.psbt.InputPSBTRecord._
|
||||
|
|
Loading…
Add table
Reference in a new issue