mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-26 21:42:48 +01:00
Add support for taproot keyspend PSBTs (#4462)
This commit is contained in:
parent
211339f344
commit
5df5bf6741
3 changed files with 12 additions and 12 deletions
|
@ -588,9 +588,8 @@ class PSBTUnitTest extends BitcoinSUnitTest {
|
|||
|
||||
val finalizedT = psbt.finalizePSBT
|
||||
assert(finalizedT.isSuccess)
|
||||
// todo can't verify taproot yet
|
||||
// val finalized = finalizedT.get
|
||||
// assert(finalized.extractTransactionAndValidate.isSuccess)
|
||||
val finalized = finalizedT.get
|
||||
assert(finalized.extractTransactionAndValidate.isSuccess)
|
||||
}
|
||||
|
||||
it must "PSBT with one P2TR key only output with internal key and its derivation path" in {
|
||||
|
|
|
@ -78,11 +78,8 @@ object TxSigComponent {
|
|||
case Some(scriptWitness) =>
|
||||
unsignedWtx.updateWitness(idx, scriptWitness)
|
||||
}
|
||||
case _: ScriptWitnessV0 =>
|
||||
unsignedWtx
|
||||
case t: TaprootWitness =>
|
||||
throw new UnsupportedOperationException(
|
||||
s"Taproot not supported, got=$t")
|
||||
case _: ScriptWitnessV0 => unsignedWtx
|
||||
case _: TaprootWitness => unsignedWtx
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,9 +164,13 @@ object InputInfo {
|
|||
getPreImagesAndCondPath(p2wsh.scriptSignature)
|
||||
case EmptyScriptWitness =>
|
||||
getPreImagesAndCondPath(txIn.scriptSignature)
|
||||
case taprootWitness: TaprootWitness =>
|
||||
case _: TaprootKeyPath =>
|
||||
// No hashes in taproot key path
|
||||
(Vector.empty, Vector.empty)
|
||||
case taprootWitness @ (_: TaprootScriptPath |
|
||||
_: TaprootUnknownPath) =>
|
||||
throw new UnsupportedOperationException(
|
||||
s"Taproot not supported, got=$taprootWitness")
|
||||
s"Taproot script path not yet supported, got=$taprootWitness")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +291,7 @@ object InputInfo {
|
|||
"Script Witness must be defined for (nested) Segwit input")
|
||||
case Some(_: ScriptWitness) =>
|
||||
throw new UnsupportedOperationException(
|
||||
"Only v0 Segwit is currently supported")
|
||||
"Only v0 Segwit is supported for wrapped segwit")
|
||||
}
|
||||
P2SHNestedSegwitV0InputInfo(outPoint,
|
||||
output.value,
|
||||
|
@ -304,7 +308,7 @@ object InputInfo {
|
|||
throw new IllegalArgumentException("Cannot have nested P2SH")
|
||||
case _: TaprootScriptPubKey =>
|
||||
throw new UnsupportedOperationException(
|
||||
s"Unsupported Taproot ScriptPubKey ${output.scriptPubKey}")
|
||||
s"Taproot cannot be used as a nested P2SH")
|
||||
case _: UnassignedWitnessScriptPubKey =>
|
||||
throw new UnsupportedOperationException(
|
||||
s"Unsupported ScriptPubKey ${output.scriptPubKey}")
|
||||
|
|
Loading…
Add table
Reference in a new issue