Merge pull request #1987 from wpaulino/remove-newwitnessaddress-rpc

rpc: remove NewWitnessAddress RPC
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2018-09-28 15:43:56 -07:00
commit e44e588a36
6 files changed
+526 -585

No files matched your search

+2 -4
View File
@@ -37,10 +37,8 @@ description):
(many outputs).
* NewAddress
* Returns a new address, the following address types are supported:
pay-to-public-key-hash (p2pkh), pay-to-witness-key-hash (p2wkh), and
nested-pay-to-witness-key-hash (np2wkh).
* NewWitnessAddress
* Returns a new witness address (np2wkh) under control of the local wallet.
pay-to-witness-key-hash (p2wkh) and nested-pay-to-witness-key-hash
(np2wkh).
* SignMessage
* Signs a message with the node's identity key and returns a
zbase32 encoded signature.
+491 -540
View File
File diff suppressed because it is too large. Load diff
+16 -8
View File
@@ -124,11 +124,19 @@ func request_Lightning_SendCoins_0(ctx context.Context, marshaler runtime.Marsha
}
func request_Lightning_NewWitnessAddress_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq NewWitnessAddressRequest
var (
filter_Lightning_NewAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Lightning_NewAddress_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq NewAddressRequest
var metadata runtime.ServerMetadata
msg, err := client.NewWitnessAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Lightning_NewAddress_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.NewAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
@@ -976,7 +984,7 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn *
})
mux.Handle("GET", pattern_Lightning_NewWitnessAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", pattern_Lightning_NewAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
if cn, ok := w.(http.CloseNotifier); ok {
@@ -994,14 +1002,14 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn *
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Lightning_NewWitnessAddress_0(rctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_Lightning_NewAddress_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Lightning_NewWitnessAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_Lightning_NewAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -1800,7 +1808,7 @@ var (
pattern_Lightning_SendCoins_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "transactions"}, ""))
pattern_Lightning_NewWitnessAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "newaddress"}, ""))
pattern_Lightning_NewAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "newaddress"}, ""))
pattern_Lightning_ConnectPeer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "peers"}, ""))
@@ -1866,7 +1874,7 @@ var (
forward_Lightning_SendCoins_0 = runtime.ForwardResponseMessage
forward_Lightning_NewWitnessAddress_0 = runtime.ForwardResponseMessage
forward_Lightning_NewAddress_0 = runtime.ForwardResponseMessage
forward_Lightning_ConnectPeer_0 = runtime.ForwardResponseMessage
+1 -11
View File
@@ -249,12 +249,7 @@ service Lightning {
/** lncli: `newaddress`
NewAddress creates a new address under control of the local wallet.
*/
rpc NewAddress (NewAddressRequest) returns (NewAddressResponse);
/**
NewWitnessAddress creates a new witness address under control of the local wallet.
*/
rpc NewWitnessAddress (NewWitnessAddressRequest) returns (NewAddressResponse) {
rpc NewAddress (NewAddressRequest) returns (NewAddressResponse) {
option (google.api.http) = {
get: "/v1/newaddress"
};
@@ -807,7 +802,6 @@ message SendCoinsResponse {
- `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0)
- `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1)
- `p2pkh`: Pay to public key hash (`PUBKEY_HASH` = 2)
*/
message NewAddressRequest {
enum AddressType {
@@ -818,10 +812,6 @@ message NewAddressRequest {
/// The address type
AddressType type = 1;
}
message NewWitnessAddressRequest {
}
message NewAddressResponse {
/// The newly generated wallet address
string address = 1 [json_name = "address"];
+16 -2
View File
@@ -732,8 +732,8 @@
},
"/v1/newaddress": {
"get": {
"summary": "*\nNewWitnessAddress creates a new witness address under control of the local wallet.",
"operationId": "NewWitnessAddress",
"summary": "* lncli: `newaddress`\nNewAddress creates a new address under control of the local wallet.",
"operationId": "NewAddress",
"responses": {
"200": {
"description": "",
@@ -742,6 +742,20 @@
}
}
},
"parameters": [
{
"name": "type",
"description": "/ The address type.",
"in": "query",
"required": false,
"type": "string",
"enum": [
"WITNESS_PUBKEY_HASH",
"NESTED_PUBKEY_HASH"
],
"default": "WITNESS_PUBKEY_HASH"
}
],
"tags": [
"Lightning"
]
-20
View File
@@ -160,10 +160,6 @@ var (
Entity: "address",
Action: "write",
}},
"/lnrpc.Lightning/NewWitnessAddress": {{
Entity: "address",
Action: "write",
}},
"/lnrpc.Lightning/SignMessage": {{
Entity: "message",
Action: "write",
@@ -538,22 +534,6 @@ func (r *rpcServer) NewAddress(ctx context.Context,
return &lnrpc.NewAddressResponse{Address: addr.String()}, nil
}
// NewWitnessAddress returns a new native witness address under the control of
// the local wallet.
func (r *rpcServer) NewWitnessAddress(ctx context.Context,
in *lnrpc.NewWitnessAddressRequest) (*lnrpc.NewAddressResponse, error) {
addr, err := r.server.cc.wallet.NewAddress(
lnwallet.NestedWitnessPubKey, false,
)
if err != nil {
return nil, err
}
rpcsLog.Infof("[newaddress] addr=%v", addr.String())
return &lnrpc.NewAddressResponse{Address: addr.String()}, nil
}
var (
// signedMsgPrefix is a special prefix that we'll prepend to any
// messages we sign/verify. We do this to ensure that we don't