From 1902ad724e64ba44d73e8bf4f1c1f557e96b24c4 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 5 Jan 2022 11:04:15 +0100 Subject: [PATCH] signrpc: remove incomplete sentence and TODO We use SignOutputRaw which expects a witness script being set, even for P2WKH. There is a special case in SignOutputRaw for the case where the script is a p2wkh script, then the input script is reconstructed correctly for the sighash. --- lnrpc/signrpc/signer_server.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lnrpc/signrpc/signer_server.go b/lnrpc/signrpc/signer_server.go index 147e146f2..c1b8e96d3 100644 --- a/lnrpc/signrpc/signer_server.go +++ b/lnrpc/signrpc/signer_server.go @@ -310,9 +310,12 @@ func (s *Server) SignOutputRaw(ctx context.Context, in *SignReq) (*SignResp, // If a witness script isn't passed, then we can't proceed, as // in the p2wsh case, we can't properly generate the sighash. + // A P2WKH doesn't need a witness script. But SignOutputRaw + // still needs to know the PK script that was used for the + // output. We'll send it in the WitnessScript field, the + // SignOutputRaw RPC will know what to do with it when creating + // the sighash. if len(signDesc.WitnessScript) == 0 { - // TODO(roasbeef): if regualr p2wkh, then at times - // internally we allow script to go by return nil, fmt.Errorf("witness script MUST be " + "specified") }