@@ -121,6 +121,13 @@ type swapServerClient interface {
121121 swapHash lntypes.Hash , paymentAddr [32 ]byte ,
122122 plugin RoutingPluginType , success bool , attempts int32 ,
123123 totalTime int64 ) error
124+
125+ // MuSig2SignSweep calls the server to cooperatively sign the MuSig2
126+ // htlc spend. Returns the server's nonce and partial signature.
127+ MuSig2SignSweep (ctx context.Context ,
128+ protocolVersion loopdb.ProtocolVersion , swapHash lntypes.Hash ,
129+ paymentAddr [32 ]byte , nonce []byte , sigHash []byte ) (
130+ []byte , []byte , error )
124131}
125132
126133type grpcSwapServerClient struct {
@@ -720,6 +727,32 @@ func (s *grpcSwapServerClient) ReportRoutingResult(ctx context.Context,
720727 return err
721728}
722729
730+ // MuSig2SignSweep calls the server to cooperatively sign the MuSig2 htlc
731+ // spend. Returns the server's nonce and partial signature.
732+ func (s * grpcSwapServerClient ) MuSig2SignSweep (ctx context.Context ,
733+ protocolVersion loopdb.ProtocolVersion , swapHash lntypes.Hash ,
734+ paymentAddr [32 ]byte , nonce []byte , sigHash []byte ) (
735+ []byte , []byte , error ) {
736+
737+ req := & looprpc.MuSig2SignSweepReq {
738+ ProtocolVersion : looprpc .ProtocolVersion (protocolVersion ),
739+ SwapHash : swapHash [:],
740+ PaymentAddress : paymentAddr [:],
741+ Nonce : nonce ,
742+ SigHash : sigHash ,
743+ }
744+
745+ rpcCtx , rpcCancel := context .WithTimeout (ctx , globalCallTimeout )
746+ defer rpcCancel ()
747+
748+ res , err := s .server .MuSig2SignSweep (rpcCtx , req )
749+ if err != nil {
750+ return nil , nil , err
751+ }
752+
753+ return res .Nonce , res .PartialSignature , nil
754+ }
755+
723756func rpcRouteCancel (details * outCancelDetails ) (
724757 * looprpc.CancelLoopOutSwapRequest_RouteCancel , error ) {
725758
0 commit comments