@@ -1058,73 +1058,42 @@ func testSignVerifyMessageWithAddr(ht *lntest.HarnessTest) {
10581058 alice := ht .NewNode ("Alice," , nil )
10591059 bob := ht .NewNode ("Bob," , nil )
10601060
1061- // Test an lnd wallet created P2WKH address.
1062- respAddr := alice .RPC .NewAddress (& lnrpc.NewAddressRequest {
1063- Type : lnrpc .AddressType_WITNESS_PUBKEY_HASH ,
1064- })
1065-
10661061 aliceMsg := []byte ("alice msg" )
1062+ addrTypes := []lnrpc.AddressType {
1063+ lnrpc .AddressType_WITNESS_PUBKEY_HASH ,
1064+ lnrpc .AddressType_NESTED_PUBKEY_HASH ,
1065+ lnrpc .AddressType_TAPROOT_PUBKEY ,
1066+ }
10671067
1068- respSig := alice .RPC .SignMessageWithAddr (
1069- & walletrpc.SignMessageWithAddrRequest {
1070- Msg : aliceMsg ,
1071- Addr : respAddr .Address ,
1072- },
1073- )
1074-
1075- respValid := bob .RPC .VerifyMessageWithAddr (
1076- & walletrpc.VerifyMessageWithAddrRequest {
1077- Msg : aliceMsg ,
1078- Signature : respSig .Signature ,
1079- Addr : respAddr .Address ,
1080- },
1081- )
1082-
1083- require .True (ht , respValid .Valid , "alice's signature didn't validate" )
1084-
1085- // Test an lnd wallet created NP2WKH address.
1086- respAddr = alice .RPC .NewAddress (& lnrpc.NewAddressRequest {
1087- Type : lnrpc .AddressType_NESTED_PUBKEY_HASH ,
1088- })
1089-
1090- respSig = alice .RPC .SignMessageWithAddr (
1091- & walletrpc.SignMessageWithAddrRequest {
1092- Msg : aliceMsg ,
1093- Addr : respAddr .Address ,
1094- },
1095- )
1096-
1097- respValid = bob .RPC .VerifyMessageWithAddr (
1098- & walletrpc.VerifyMessageWithAddrRequest {
1099- Msg : aliceMsg ,
1100- Signature : respSig .Signature ,
1101- Addr : respAddr .Address ,
1102- },
1103- )
1104-
1105- require .True (ht , respValid .Valid , "alice's signature didn't validate" )
1106-
1107- // Test an lnd wallet created P2TR address.
1108- respAddr = alice .RPC .NewAddress (& lnrpc.NewAddressRequest {
1109- Type : lnrpc .AddressType_TAPROOT_PUBKEY ,
1110- })
1111-
1112- respSig = alice .RPC .SignMessageWithAddr (
1113- & walletrpc.SignMessageWithAddrRequest {
1114- Msg : aliceMsg ,
1115- Addr : respAddr .Address ,
1116- },
1117- )
1118-
1119- respValid = bob .RPC .VerifyMessageWithAddr (
1120- & walletrpc.VerifyMessageWithAddrRequest {
1121- Msg : aliceMsg ,
1122- Signature : respSig .Signature ,
1123- Addr : respAddr .Address ,
1124- },
1125- )
1126-
1127- require .True (ht , respValid .Valid , "alice's signature didn't validate" )
1068+ for _ , bip322 := range []bool {true , false } {
1069+ for _ , addrType := range addrTypes {
1070+ respAddr := alice .RPC .NewAddress (
1071+ & lnrpc.NewAddressRequest {
1072+ Type : addrType ,
1073+ },
1074+ )
1075+
1076+ respSig := alice .RPC .SignMessageWithAddr (
1077+ & walletrpc.SignMessageWithAddrRequest {
1078+ Msg : aliceMsg ,
1079+ Addr : respAddr .Address ,
1080+ Bip322 : bip322 ,
1081+ },
1082+ )
1083+ respValid := bob .RPC .VerifyMessageWithAddr (
1084+ & walletrpc.VerifyMessageWithAddrRequest {
1085+ Msg : aliceMsg ,
1086+ Signature : respSig .Signature ,
1087+ Addr : respAddr .Address ,
1088+ },
1089+ )
1090+ require .True (
1091+ ht , respValid .Valid , "alice's signature did " +
1092+ "not validate, bip322=%v, addrType=%v" ,
1093+ bip322 , addrType ,
1094+ )
1095+ }
1096+ }
11281097
11291098 // Test verifying a signature with an external P2PKH address.
11301099 // P2PKH address type is not supported by the lnd wallet therefore
@@ -1137,7 +1106,7 @@ func testSignVerifyMessageWithAddr(ht *lntest.HarnessTest) {
11371106 externalSig := "H5DqqM7Cc8xZnYBr7j3gD4XD+AuQsim9Un/IxBrrhBA7I9//" +
11381107 "3exuQRg+u7HpwG65yobPsew6RMUteyuxyNkLF5E="
11391108
1140- respValid = alice .RPC .VerifyMessageWithAddr (
1109+ respValid : = alice .RPC .VerifyMessageWithAddr (
11411110 & walletrpc.VerifyMessageWithAddrRequest {
11421111 Msg : externalMsg ,
11431112 Signature : externalSig ,
0 commit comments