multi: add p2tr keyspend wallet support
This commit is contained in:
24 files changed
+416
-163
No files matched your search
@@ -175,6 +175,11 @@ const (
|
||||
// and CLTV locktime as part of the script enforced lease commitment
|
||||
// type.
|
||||
LeaseHtlcAcceptedSuccessSecondLevel StandardWitnessType = 20
|
||||
|
||||
// TaprootPubKeySpend is a witness type that allows us to spend a
|
||||
// regular p2tr output that's sent to an output which is under complete
|
||||
// control of the backing wallet.
|
||||
TaprootPubKeySpend StandardWitnessType = 21
|
||||
)
|
||||
|
||||
// String returns a human readable version of the target WitnessType.
|
||||
@@ -245,6 +250,9 @@ func (wt StandardWitnessType) String() string {
|
||||
case LeaseHtlcAcceptedSuccessSecondLevel:
|
||||
return "LeaseHtlcAcceptedSuccessSecondLevel"
|
||||
|
||||
case TaprootPubKeySpend:
|
||||
return "TaprootPubKeySpend"
|
||||
|
||||
default:
|
||||
return fmt.Sprintf("Unknown WitnessType: %v", uint32(wt))
|
||||
}
|
||||
@@ -388,6 +396,8 @@ func (wt StandardWitnessType) WitnessGenerator(signer Signer,
|
||||
|
||||
case WitnessKeyHash:
|
||||
fallthrough
|
||||
case TaprootPubKeySpend:
|
||||
fallthrough
|
||||
case NestedWitnessKeyHash:
|
||||
return signer.ComputeInputScript(tx, desc)
|
||||
|
||||
@@ -494,6 +504,9 @@ func (wt StandardWitnessType) SizeUpperBound() (int, bool, error) {
|
||||
// The revocation output of a second level output of an HTLC.
|
||||
case HtlcSecondLevelRevoke:
|
||||
return ToLocalPenaltyWitnessSize, false, nil
|
||||
|
||||
case TaprootPubKeySpend:
|
||||
return TaprootKeyPathCustomSighashWitnessSize, false, nil
|
||||
}
|
||||
|
||||
return 0, false, fmt.Errorf("unexpected witness type: %v", wt)
|
||||
|
||||
Reference in new issue
Block a user