itest+lntest: add coordinator pattern test for combined nonce

Add integration test for MuSig2RegisterCombinedNonce and
MuSig2GetCombinedNonce RPCs to verify the coordinator pattern workflow.

The test:
- Creates three signing sessions without initial nonce exchange
- Manually aggregates nonces using the coordinator pattern (btcec musig2)
- Tests v0.4.0 returns unsupported errors (as expected)
- Tests v1.0.0rc2 successfully registers and retrieves combined nonces
- Verifies mutual exclusivity (error: already have all nonces)
- Completes a full signing flow to ensure signatures are valid

Also adds the required RPC harness wrapper methods to lntest/rpc/signer.go for
the new RPCs and adds MuSig2RegisterNoncesErr wrapper for error testing.
This commit is contained in:
Elle Mouton committed 2025-12-10 07:19:04 +02:00
1 parent 16b9192dad
commit fb48697ffa
2 files changed
+262

No files matched your search

+74
View File
@@ -130,6 +130,80 @@ func (h *HarnessRPC) MuSig2RegisterNonces(
return resp
}
// MuSig2RegisterNoncesErr makes a RPC call to the node's SignerClient and
// asserts an error is returned.
func (h *HarnessRPC) MuSig2RegisterNoncesErr(
req *signrpc.MuSig2RegisterNoncesRequest) error {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.Signer.MuSig2RegisterNonces(ctxt, req)
require.Error(h, err, "expected error from MuSig2RegisterNonces")
return err
}
// MuSig2RegisterCombinedNonce makes a RPC call to the node's SignerClient and
// asserts.
//
//nolint:ll
func (h *HarnessRPC) MuSig2RegisterCombinedNonce(
req *signrpc.MuSig2RegisterCombinedNonceRequest) *signrpc.MuSig2RegisterCombinedNonceResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
resp, err := h.Signer.MuSig2RegisterCombinedNonce(ctxt, req)
h.NoError(err, "MuSig2RegisterCombinedNonce")
return resp
}
// MuSig2RegisterCombinedNonceErr makes a RPC call to the node's SignerClient
// and asserts an error is returned.
func (h *HarnessRPC) MuSig2RegisterCombinedNonceErr(
req *signrpc.MuSig2RegisterCombinedNonceRequest) error {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.Signer.MuSig2RegisterCombinedNonce(ctxt, req)
require.Error(h, err, "expected error from MuSig2RegisterCombinedNonce")
return err
}
// MuSig2GetCombinedNonce makes a RPC call to the node's SignerClient and
// asserts.
//
//nolint:ll
func (h *HarnessRPC) MuSig2GetCombinedNonce(
req *signrpc.MuSig2GetCombinedNonceRequest) *signrpc.MuSig2GetCombinedNonceResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
resp, err := h.Signer.MuSig2GetCombinedNonce(ctxt, req)
h.NoError(err, "MuSig2GetCombinedNonce")
return resp
}
// MuSig2GetCombinedNonceErr makes a RPC call to the node's SignerClient and
// asserts an error is returned.
func (h *HarnessRPC) MuSig2GetCombinedNonceErr(
req *signrpc.MuSig2GetCombinedNonceRequest) error {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.Signer.MuSig2GetCombinedNonce(ctxt, req)
require.Error(h, err, "expected error from MuSig2GetCombinedNonce")
return err
}
// MuSig2Sign makes a RPC call to the node's SignerClient and asserts.
func (h *HarnessRPC) MuSig2Sign(
req *signrpc.MuSig2SignRequest) *signrpc.MuSig2SignResponse {