diff --git a/go.mod b/go.mod index 0e35ef036..d121721ba 100644 --- a/go.mod +++ b/go.mod @@ -9,11 +9,11 @@ require ( github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/btcsuite/btcutil v1.0.2 github.com/btcsuite/btcutil/psbt v1.0.2 - github.com/btcsuite/btcwallet v0.11.1-0.20200515224913-e0e62245ecbe + github.com/btcsuite/btcwallet v0.11.1-0.20200604005347-6390f167e5f8 github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0 github.com/btcsuite/btcwallet/wallet/txrules v1.0.0 github.com/btcsuite/btcwallet/walletdb v1.3.1 - github.com/btcsuite/btcwallet/wtxmgr v1.1.1-0.20200515224913-e0e62245ecbe + github.com/btcsuite/btcwallet/wtxmgr v1.1.1-0.20200604005347-6390f167e5f8 github.com/coreos/etcd v3.3.22+incompatible github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect @@ -49,7 +49,7 @@ require ( github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d github.com/lightningnetwork/lightning-onion v1.0.2-0.20200501022730-3c8c8d0b89ea github.com/lightningnetwork/lnd/cert v1.0.2 - github.com/lightningnetwork/lnd/clock v1.0.0 + github.com/lightningnetwork/lnd/clock v1.0.1 github.com/lightningnetwork/lnd/queue v1.0.4 github.com/lightningnetwork/lnd/ticker v1.0.0 github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 @@ -59,7 +59,7 @@ require ( github.com/prometheus/client_golang v0.9.3 github.com/rogpeppe/fastuuid v1.2.0 // indirect github.com/soheilhy/cmux v0.1.4 // indirect - github.com/stretchr/testify v1.4.0 + github.com/stretchr/testify v1.5.1 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect github.com/tv42/zbase32 v0.0.0-20160707012821-501572607d02 github.com/urfave/cli v1.18.0 diff --git a/go.sum b/go.sum index f22e2071e..3d2883991 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2ut github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= github.com/btcsuite/btcutil/psbt v1.0.2 h1:gCVY3KxdoEVU7Q6TjusPO+GANIwVgr9yTLqM+a6CZr8= github.com/btcsuite/btcutil/psbt v1.0.2/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ= -github.com/btcsuite/btcwallet v0.11.1-0.20200515224913-e0e62245ecbe h1:0m9uXDcnUc3Fv72635O/MfLbhbW+0hfSVgRiWezpkHU= -github.com/btcsuite/btcwallet v0.11.1-0.20200515224913-e0e62245ecbe/go.mod h1:9+AH3V5mcTtNXTKe+fe63fDLKGOwQbZqmvOVUef+JFE= +github.com/btcsuite/btcwallet v0.11.1-0.20200604005347-6390f167e5f8 h1:wyooGuOeqcpJDK9+KgO5/yfb3nmEhakbdKHERhEylNE= +github.com/btcsuite/btcwallet v0.11.1-0.20200604005347-6390f167e5f8/go.mod h1:9+AH3V5mcTtNXTKe+fe63fDLKGOwQbZqmvOVUef+JFE= github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0 h1:KGHMW5sd7yDdDMkCZ/JpP0KltolFsQcB973brBnfj4c= github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0/go.mod h1:VufDts7bd/zs3GV13f/lXc/0lXrPnvxD/NvmpG/FEKU= github.com/btcsuite/btcwallet/wallet/txrules v1.0.0 h1:2VsfS0sBedcM5KmDzRMT3+b6xobqWveZGvjb+jFez5w= @@ -48,10 +48,9 @@ github.com/btcsuite/btcwallet/walletdb v1.0.0/go.mod h1:bZTy9RyYZh9fLnSua+/CD48T github.com/btcsuite/btcwallet/walletdb v1.2.0/go.mod h1:9cwc1Yyg4uvd4ZdfdoMnALji+V9gfWSMfxEdLdR5Vwc= github.com/btcsuite/btcwallet/walletdb v1.3.1 h1:lW1Ac3F1jJY4K11P+YQtRNcP5jFk27ASfrV7C6mvRU0= github.com/btcsuite/btcwallet/walletdb v1.3.1/go.mod h1:9cwc1Yyg4uvd4ZdfdoMnALji+V9gfWSMfxEdLdR5Vwc= -github.com/btcsuite/btcwallet/wtxmgr v1.0.0 h1:aIHgViEmZmZfe0tQQqF1xyd2qBqFWxX5vZXkkbjtbeA= github.com/btcsuite/btcwallet/wtxmgr v1.0.0/go.mod h1:vc4gBprll6BP0UJ+AIGDaySoc7MdAmZf8kelfNb8CFY= -github.com/btcsuite/btcwallet/wtxmgr v1.1.1-0.20200515224913-e0e62245ecbe h1:yQbJVYfsKbdqDQNLxd4hhiLSiMkIygefW5mSHMsdKpc= -github.com/btcsuite/btcwallet/wtxmgr v1.1.1-0.20200515224913-e0e62245ecbe/go.mod h1:OwC0W0HhUszbWdvJvH6xvgabKSJ0lXl11YbmmqF9YXQ= +github.com/btcsuite/btcwallet/wtxmgr v1.1.1-0.20200604005347-6390f167e5f8 h1:tfeGHvGrm5nYE92eaO8PChBvMinpcq566dG1xPO08GI= +github.com/btcsuite/btcwallet/wtxmgr v1.1.1-0.20200604005347-6390f167e5f8/go.mod h1:cJGqxXtqQbmXuL7RlXjIM18x0bGHy1407/85mQCLca4= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8 h1:nOsAWScwueMVk/VLm/dvQQD7DuanyvAUb6B3P3eT274= @@ -246,6 +245,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= diff --git a/lnrpc/marshall_utils.go b/lnrpc/marshall_utils.go index 937dee067..d0e501160 100644 --- a/lnrpc/marshall_utils.go +++ b/lnrpc/marshall_utils.go @@ -1,9 +1,14 @@ package lnrpc import ( + "encoding/hex" "errors" + fmt "fmt" + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcutil" + "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" ) @@ -54,3 +59,88 @@ func UnmarshallAmt(amtSat, amtMsat int64) (lnwire.MilliSatoshi, error) { return lnwire.MilliSatoshi(amtMsat), nil } + +// ParseConfs validates the minimum and maximum confirmation arguments of a +// ListUnspent request. +func ParseConfs(min, max int32) (int32, int32, error) { + switch { + // Ensure that the user didn't attempt to specify a negative number of + // confirmations, as that isn't possible. + case min < 0: + return 0, 0, fmt.Errorf("min confirmations must be >= 0") + + // We'll also ensure that the min number of confs is strictly less than + // or equal to the max number of confs for sanity. + case min > max: + return 0, 0, fmt.Errorf("max confirmations must be >= min " + + "confirmations") + + default: + return min, max, nil + } +} + +// MarshalUtxos translates a []*lnwallet.Utxo into a []*lnrpc.Utxo. +func MarshalUtxos(utxos []*lnwallet.Utxo, activeNetParams *chaincfg.Params) ( + []*Utxo, error) { + + res := make([]*Utxo, 0, len(utxos)) + for _, utxo := range utxos { + // Translate lnwallet address type to the proper gRPC proto + // address type. + var addrType AddressType + switch utxo.AddressType { + + case lnwallet.WitnessPubKey: + addrType = AddressType_WITNESS_PUBKEY_HASH + + case lnwallet.NestedWitnessPubKey: + addrType = AddressType_NESTED_PUBKEY_HASH + + case lnwallet.UnknownAddressType: + continue + + default: + return nil, fmt.Errorf("invalid utxo address type") + } + + // Now that we know we have a proper mapping to an address, + // we'll convert the regular outpoint to an lnrpc variant. + outpoint := &OutPoint{ + TxidBytes: utxo.OutPoint.Hash[:], + TxidStr: utxo.OutPoint.Hash.String(), + OutputIndex: utxo.OutPoint.Index, + } + + utxoResp := Utxo{ + AddressType: addrType, + AmountSat: int64(utxo.Value), + PkScript: hex.EncodeToString(utxo.PkScript), + Outpoint: outpoint, + Confirmations: utxo.Confirmations, + } + + // Finally, we'll attempt to extract the raw address from the + // script so we can display a human friendly address to the end + // user. + _, outAddresses, _, err := txscript.ExtractPkScriptAddrs( + utxo.PkScript, activeNetParams, + ) + if err != nil { + return nil, err + } + + // If we can't properly locate a single address, then this was + // an error in our mapping, and we'll return an error back to + // the user. + if len(outAddresses) != 1 { + return nil, fmt.Errorf("an output was unexpectedly " + + "multisig") + } + utxoResp.Address = outAddresses[0].String() + + res = append(res, &utxoResp) + } + + return res, nil +} diff --git a/lnrpc/rpc.pb.go b/lnrpc/rpc.pb.go index e4fc8fbeb..ee532aefd 100644 --- a/lnrpc/rpc.pb.go +++ b/lnrpc/rpc.pb.go @@ -12407,6 +12407,8 @@ type LightningClient interface { //target. SendCoins(ctx context.Context, in *SendCoinsRequest, opts ...grpc.CallOption) (*SendCoinsResponse, error) // lncli: `listunspent` + //Deprecated, use walletrpc.ListUnspent instead. + // //ListUnspent returns a list of all utxos spendable by the wallet with a //number of confirmations between the specified minimum and maximum. ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) @@ -13486,6 +13488,8 @@ type LightningServer interface { //target. SendCoins(context.Context, *SendCoinsRequest) (*SendCoinsResponse, error) // lncli: `listunspent` + //Deprecated, use walletrpc.ListUnspent instead. + // //ListUnspent returns a list of all utxos spendable by the wallet with a //number of confirmations between the specified minimum and maximum. ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) diff --git a/lnrpc/rpc.proto b/lnrpc/rpc.proto index ec17c2399..38203147f 100644 --- a/lnrpc/rpc.proto +++ b/lnrpc/rpc.proto @@ -83,8 +83,10 @@ service Lightning { } /* lncli: `listunspent` + Deprecated, use walletrpc.ListUnspent instead. + ListUnspent returns a list of all utxos spendable by the wallet with a - number of confirmations between the specified minimum and maximum. + number of confirmations between the specified minimum and maximum. */ rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse) { option (google.api.http) = { diff --git a/lnrpc/rpc.swagger.json b/lnrpc/rpc.swagger.json index b9e421e89..41651f041 100644 --- a/lnrpc/rpc.swagger.json +++ b/lnrpc/rpc.swagger.json @@ -1363,7 +1363,8 @@ }, "/v1/utxos": { "get": { - "summary": "lncli: `listunspent`\nListUnspent returns a list of all utxos spendable by the wallet with a\nnumber of confirmations between the specified minimum and maximum.", + "summary": "lncli: `listunspent`\nDeprecated, use walletrpc.ListUnspent instead.", + "description": "ListUnspent returns a list of all utxos spendable by the wallet with a\nnumber of confirmations between the specified minimum and maximum.", "operationId": "ListUnspent", "responses": { "200": { diff --git a/lnrpc/walletrpc/config_active.go b/lnrpc/walletrpc/config_active.go index aada57dcd..103e533b7 100644 --- a/lnrpc/walletrpc/config_active.go +++ b/lnrpc/walletrpc/config_active.go @@ -3,6 +3,7 @@ package walletrpc import ( + "github.com/btcsuite/btcd/chaincfg" "github.com/lightningnetwork/lnd/keychain" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chainfee" @@ -48,4 +49,7 @@ type Config struct { // Chain is an interface that the WalletKit will use to determine state // about the backing chain of the wallet. Chain lnwallet.BlockChainIO + + // ChainParams are the parameters of the wallet's backing chain. + ChainParams *chaincfg.Params } diff --git a/lnrpc/walletrpc/walletkit.pb.go b/lnrpc/walletrpc/walletkit.pb.go index 721a6a56f..f775681f5 100644 --- a/lnrpc/walletrpc/walletkit.pb.go +++ b/lnrpc/walletrpc/walletkit.pb.go @@ -132,6 +132,267 @@ func (WitnessType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_6cc6942ac78249e5, []int{0} } +type ListUnspentRequest struct { + // The minimum number of confirmations to be included. + MinConfs int32 `protobuf:"varint,1,opt,name=min_confs,json=minConfs,proto3" json:"min_confs,omitempty"` + // The maximum number of confirmations to be included. + MaxConfs int32 `protobuf:"varint,2,opt,name=max_confs,json=maxConfs,proto3" json:"max_confs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListUnspentRequest) Reset() { *m = ListUnspentRequest{} } +func (m *ListUnspentRequest) String() string { return proto.CompactTextString(m) } +func (*ListUnspentRequest) ProtoMessage() {} +func (*ListUnspentRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6cc6942ac78249e5, []int{0} +} + +func (m *ListUnspentRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListUnspentRequest.Unmarshal(m, b) +} +func (m *ListUnspentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListUnspentRequest.Marshal(b, m, deterministic) +} +func (m *ListUnspentRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListUnspentRequest.Merge(m, src) +} +func (m *ListUnspentRequest) XXX_Size() int { + return xxx_messageInfo_ListUnspentRequest.Size(m) +} +func (m *ListUnspentRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListUnspentRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListUnspentRequest proto.InternalMessageInfo + +func (m *ListUnspentRequest) GetMinConfs() int32 { + if m != nil { + return m.MinConfs + } + return 0 +} + +func (m *ListUnspentRequest) GetMaxConfs() int32 { + if m != nil { + return m.MaxConfs + } + return 0 +} + +type ListUnspentResponse struct { + // A list of utxos satisfying the specified number of confirmations. + Utxos []*lnrpc.Utxo `protobuf:"bytes,1,rep,name=utxos,proto3" json:"utxos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListUnspentResponse) Reset() { *m = ListUnspentResponse{} } +func (m *ListUnspentResponse) String() string { return proto.CompactTextString(m) } +func (*ListUnspentResponse) ProtoMessage() {} +func (*ListUnspentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6cc6942ac78249e5, []int{1} +} + +func (m *ListUnspentResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListUnspentResponse.Unmarshal(m, b) +} +func (m *ListUnspentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListUnspentResponse.Marshal(b, m, deterministic) +} +func (m *ListUnspentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListUnspentResponse.Merge(m, src) +} +func (m *ListUnspentResponse) XXX_Size() int { + return xxx_messageInfo_ListUnspentResponse.Size(m) +} +func (m *ListUnspentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListUnspentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListUnspentResponse proto.InternalMessageInfo + +func (m *ListUnspentResponse) GetUtxos() []*lnrpc.Utxo { + if m != nil { + return m.Utxos + } + return nil +} + +type LeaseOutputRequest struct { + // + //An ID of 32 random bytes that must be unique for each distinct application + //using this RPC which will be used to bound the output lease to. + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The identifying outpoint of the output being leased. + Outpoint *lnrpc.OutPoint `protobuf:"bytes,2,opt,name=outpoint,proto3" json:"outpoint,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseOutputRequest) Reset() { *m = LeaseOutputRequest{} } +func (m *LeaseOutputRequest) String() string { return proto.CompactTextString(m) } +func (*LeaseOutputRequest) ProtoMessage() {} +func (*LeaseOutputRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6cc6942ac78249e5, []int{2} +} + +func (m *LeaseOutputRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LeaseOutputRequest.Unmarshal(m, b) +} +func (m *LeaseOutputRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LeaseOutputRequest.Marshal(b, m, deterministic) +} +func (m *LeaseOutputRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseOutputRequest.Merge(m, src) +} +func (m *LeaseOutputRequest) XXX_Size() int { + return xxx_messageInfo_LeaseOutputRequest.Size(m) +} +func (m *LeaseOutputRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseOutputRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LeaseOutputRequest proto.InternalMessageInfo + +func (m *LeaseOutputRequest) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +func (m *LeaseOutputRequest) GetOutpoint() *lnrpc.OutPoint { + if m != nil { + return m.Outpoint + } + return nil +} + +type LeaseOutputResponse struct { + // + //The absolute expiration of the output lease represented as a unix timestamp. + Expiration uint64 `protobuf:"varint,1,opt,name=expiration,proto3" json:"expiration,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseOutputResponse) Reset() { *m = LeaseOutputResponse{} } +func (m *LeaseOutputResponse) String() string { return proto.CompactTextString(m) } +func (*LeaseOutputResponse) ProtoMessage() {} +func (*LeaseOutputResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6cc6942ac78249e5, []int{3} +} + +func (m *LeaseOutputResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LeaseOutputResponse.Unmarshal(m, b) +} +func (m *LeaseOutputResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LeaseOutputResponse.Marshal(b, m, deterministic) +} +func (m *LeaseOutputResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseOutputResponse.Merge(m, src) +} +func (m *LeaseOutputResponse) XXX_Size() int { + return xxx_messageInfo_LeaseOutputResponse.Size(m) +} +func (m *LeaseOutputResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseOutputResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_LeaseOutputResponse proto.InternalMessageInfo + +func (m *LeaseOutputResponse) GetExpiration() uint64 { + if m != nil { + return m.Expiration + } + return 0 +} + +type ReleaseOutputRequest struct { + // The unique ID that was used to lock the output. + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The identifying outpoint of the output being released. + Outpoint *lnrpc.OutPoint `protobuf:"bytes,2,opt,name=outpoint,proto3" json:"outpoint,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReleaseOutputRequest) Reset() { *m = ReleaseOutputRequest{} } +func (m *ReleaseOutputRequest) String() string { return proto.CompactTextString(m) } +func (*ReleaseOutputRequest) ProtoMessage() {} +func (*ReleaseOutputRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6cc6942ac78249e5, []int{4} +} + +func (m *ReleaseOutputRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReleaseOutputRequest.Unmarshal(m, b) +} +func (m *ReleaseOutputRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReleaseOutputRequest.Marshal(b, m, deterministic) +} +func (m *ReleaseOutputRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReleaseOutputRequest.Merge(m, src) +} +func (m *ReleaseOutputRequest) XXX_Size() int { + return xxx_messageInfo_ReleaseOutputRequest.Size(m) +} +func (m *ReleaseOutputRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ReleaseOutputRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ReleaseOutputRequest proto.InternalMessageInfo + +func (m *ReleaseOutputRequest) GetId() []byte { + if m != nil { + return m.Id + } + return nil +} + +func (m *ReleaseOutputRequest) GetOutpoint() *lnrpc.OutPoint { + if m != nil { + return m.Outpoint + } + return nil +} + +type ReleaseOutputResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReleaseOutputResponse) Reset() { *m = ReleaseOutputResponse{} } +func (m *ReleaseOutputResponse) String() string { return proto.CompactTextString(m) } +func (*ReleaseOutputResponse) ProtoMessage() {} +func (*ReleaseOutputResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6cc6942ac78249e5, []int{5} +} + +func (m *ReleaseOutputResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReleaseOutputResponse.Unmarshal(m, b) +} +func (m *ReleaseOutputResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReleaseOutputResponse.Marshal(b, m, deterministic) +} +func (m *ReleaseOutputResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReleaseOutputResponse.Merge(m, src) +} +func (m *ReleaseOutputResponse) XXX_Size() int { + return xxx_messageInfo_ReleaseOutputResponse.Size(m) +} +func (m *ReleaseOutputResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ReleaseOutputResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ReleaseOutputResponse proto.InternalMessageInfo + type KeyReq struct { // //Is the key finger print of the root pubkey that this request is targeting. @@ -151,7 +412,7 @@ func (m *KeyReq) Reset() { *m = KeyReq{} } func (m *KeyReq) String() string { return proto.CompactTextString(m) } func (*KeyReq) ProtoMessage() {} func (*KeyReq) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{0} + return fileDescriptor_6cc6942ac78249e5, []int{6} } func (m *KeyReq) XXX_Unmarshal(b []byte) error { @@ -196,7 +457,7 @@ func (m *AddrRequest) Reset() { *m = AddrRequest{} } func (m *AddrRequest) String() string { return proto.CompactTextString(m) } func (*AddrRequest) ProtoMessage() {} func (*AddrRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{1} + return fileDescriptor_6cc6942ac78249e5, []int{7} } func (m *AddrRequest) XXX_Unmarshal(b []byte) error { @@ -230,7 +491,7 @@ func (m *AddrResponse) Reset() { *m = AddrResponse{} } func (m *AddrResponse) String() string { return proto.CompactTextString(m) } func (*AddrResponse) ProtoMessage() {} func (*AddrResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{2} + return fileDescriptor_6cc6942ac78249e5, []int{8} } func (m *AddrResponse) XXX_Unmarshal(b []byte) error { @@ -274,7 +535,7 @@ func (m *Transaction) Reset() { *m = Transaction{} } func (m *Transaction) String() string { return proto.CompactTextString(m) } func (*Transaction) ProtoMessage() {} func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{3} + return fileDescriptor_6cc6942ac78249e5, []int{9} } func (m *Transaction) XXX_Unmarshal(b []byte) error { @@ -326,7 +587,7 @@ func (m *PublishResponse) Reset() { *m = PublishResponse{} } func (m *PublishResponse) String() string { return proto.CompactTextString(m) } func (*PublishResponse) ProtoMessage() {} func (*PublishResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{4} + return fileDescriptor_6cc6942ac78249e5, []int{10} } func (m *PublishResponse) XXX_Unmarshal(b []byte) error { @@ -373,7 +634,7 @@ func (m *SendOutputsRequest) Reset() { *m = SendOutputsRequest{} } func (m *SendOutputsRequest) String() string { return proto.CompactTextString(m) } func (*SendOutputsRequest) ProtoMessage() {} func (*SendOutputsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{5} + return fileDescriptor_6cc6942ac78249e5, []int{11} } func (m *SendOutputsRequest) XXX_Unmarshal(b []byte) error { @@ -428,7 +689,7 @@ func (m *SendOutputsResponse) Reset() { *m = SendOutputsResponse{} } func (m *SendOutputsResponse) String() string { return proto.CompactTextString(m) } func (*SendOutputsResponse) ProtoMessage() {} func (*SendOutputsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{6} + return fileDescriptor_6cc6942ac78249e5, []int{12} } func (m *SendOutputsResponse) XXX_Unmarshal(b []byte) error { @@ -469,7 +730,7 @@ func (m *EstimateFeeRequest) Reset() { *m = EstimateFeeRequest{} } func (m *EstimateFeeRequest) String() string { return proto.CompactTextString(m) } func (*EstimateFeeRequest) ProtoMessage() {} func (*EstimateFeeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{7} + return fileDescriptor_6cc6942ac78249e5, []int{13} } func (m *EstimateFeeRequest) XXX_Unmarshal(b []byte) error { @@ -511,7 +772,7 @@ func (m *EstimateFeeResponse) Reset() { *m = EstimateFeeResponse{} } func (m *EstimateFeeResponse) String() string { return proto.CompactTextString(m) } func (*EstimateFeeResponse) ProtoMessage() {} func (*EstimateFeeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{8} + return fileDescriptor_6cc6942ac78249e5, []int{14} } func (m *EstimateFeeResponse) XXX_Unmarshal(b []byte) error { @@ -574,7 +835,7 @@ func (m *PendingSweep) Reset() { *m = PendingSweep{} } func (m *PendingSweep) String() string { return proto.CompactTextString(m) } func (*PendingSweep) ProtoMessage() {} func (*PendingSweep) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{9} + return fileDescriptor_6cc6942ac78249e5, []int{15} } func (m *PendingSweep) XXX_Unmarshal(b []byte) error { @@ -668,7 +929,7 @@ func (m *PendingSweepsRequest) Reset() { *m = PendingSweepsRequest{} } func (m *PendingSweepsRequest) String() string { return proto.CompactTextString(m) } func (*PendingSweepsRequest) ProtoMessage() {} func (*PendingSweepsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{10} + return fileDescriptor_6cc6942ac78249e5, []int{16} } func (m *PendingSweepsRequest) XXX_Unmarshal(b []byte) error { @@ -702,7 +963,7 @@ func (m *PendingSweepsResponse) Reset() { *m = PendingSweepsResponse{} } func (m *PendingSweepsResponse) String() string { return proto.CompactTextString(m) } func (*PendingSweepsResponse) ProtoMessage() {} func (*PendingSweepsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{11} + return fileDescriptor_6cc6942ac78249e5, []int{17} } func (m *PendingSweepsResponse) XXX_Unmarshal(b []byte) error { @@ -752,7 +1013,7 @@ func (m *BumpFeeRequest) Reset() { *m = BumpFeeRequest{} } func (m *BumpFeeRequest) String() string { return proto.CompactTextString(m) } func (*BumpFeeRequest) ProtoMessage() {} func (*BumpFeeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{12} + return fileDescriptor_6cc6942ac78249e5, []int{18} } func (m *BumpFeeRequest) XXX_Unmarshal(b []byte) error { @@ -811,7 +1072,7 @@ func (m *BumpFeeResponse) Reset() { *m = BumpFeeResponse{} } func (m *BumpFeeResponse) String() string { return proto.CompactTextString(m) } func (*BumpFeeResponse) ProtoMessage() {} func (*BumpFeeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{13} + return fileDescriptor_6cc6942ac78249e5, []int{19} } func (m *BumpFeeResponse) XXX_Unmarshal(b []byte) error { @@ -846,7 +1107,7 @@ func (m *ListSweepsRequest) Reset() { *m = ListSweepsRequest{} } func (m *ListSweepsRequest) String() string { return proto.CompactTextString(m) } func (*ListSweepsRequest) ProtoMessage() {} func (*ListSweepsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{14} + return fileDescriptor_6cc6942ac78249e5, []int{20} } func (m *ListSweepsRequest) XXX_Unmarshal(b []byte) error { @@ -888,7 +1149,7 @@ func (m *ListSweepsResponse) Reset() { *m = ListSweepsResponse{} } func (m *ListSweepsResponse) String() string { return proto.CompactTextString(m) } func (*ListSweepsResponse) ProtoMessage() {} func (*ListSweepsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{15} + return fileDescriptor_6cc6942ac78249e5, []int{21} } func (m *ListSweepsResponse) XXX_Unmarshal(b []byte) error { @@ -969,7 +1230,7 @@ func (m *ListSweepsResponse_TransactionIDs) Reset() { *m = ListSweepsRes func (m *ListSweepsResponse_TransactionIDs) String() string { return proto.CompactTextString(m) } func (*ListSweepsResponse_TransactionIDs) ProtoMessage() {} func (*ListSweepsResponse_TransactionIDs) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{15, 0} + return fileDescriptor_6cc6942ac78249e5, []int{21, 0} } func (m *ListSweepsResponse_TransactionIDs) XXX_Unmarshal(b []byte) error { @@ -1013,7 +1274,7 @@ func (m *LabelTransactionRequest) Reset() { *m = LabelTransactionRequest func (m *LabelTransactionRequest) String() string { return proto.CompactTextString(m) } func (*LabelTransactionRequest) ProtoMessage() {} func (*LabelTransactionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{16} + return fileDescriptor_6cc6942ac78249e5, []int{22} } func (m *LabelTransactionRequest) XXX_Unmarshal(b []byte) error { @@ -1065,7 +1326,7 @@ func (m *LabelTransactionResponse) Reset() { *m = LabelTransactionRespon func (m *LabelTransactionResponse) String() string { return proto.CompactTextString(m) } func (*LabelTransactionResponse) ProtoMessage() {} func (*LabelTransactionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6cc6942ac78249e5, []int{17} + return fileDescriptor_6cc6942ac78249e5, []int{23} } func (m *LabelTransactionResponse) XXX_Unmarshal(b []byte) error { @@ -1088,6 +1349,12 @@ var xxx_messageInfo_LabelTransactionResponse proto.InternalMessageInfo func init() { proto.RegisterEnum("walletrpc.WitnessType", WitnessType_name, WitnessType_value) + proto.RegisterType((*ListUnspentRequest)(nil), "walletrpc.ListUnspentRequest") + proto.RegisterType((*ListUnspentResponse)(nil), "walletrpc.ListUnspentResponse") + proto.RegisterType((*LeaseOutputRequest)(nil), "walletrpc.LeaseOutputRequest") + proto.RegisterType((*LeaseOutputResponse)(nil), "walletrpc.LeaseOutputResponse") + proto.RegisterType((*ReleaseOutputRequest)(nil), "walletrpc.ReleaseOutputRequest") + proto.RegisterType((*ReleaseOutputResponse)(nil), "walletrpc.ReleaseOutputResponse") proto.RegisterType((*KeyReq)(nil), "walletrpc.KeyReq") proto.RegisterType((*AddrRequest)(nil), "walletrpc.AddrRequest") proto.RegisterType((*AddrResponse)(nil), "walletrpc.AddrResponse") @@ -1112,86 +1379,97 @@ func init() { func init() { proto.RegisterFile("walletrpc/walletkit.proto", fileDescriptor_6cc6942ac78249e5) } var fileDescriptor_6cc6942ac78249e5 = []byte{ - // 1255 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x6d, 0x6f, 0xda, 0x56, - 0x14, 0x6e, 0x42, 0x20, 0x70, 0x78, 0x09, 0x39, 0xe4, 0x85, 0xd2, 0x74, 0xc9, 0x5c, 0x6d, 0x8b, - 0xb6, 0x96, 0x68, 0xa9, 0x36, 0xad, 0x9d, 0x34, 0x2d, 0x01, 0x47, 0x44, 0x10, 0x9c, 0xd9, 0x6e, - 0xa3, 0x6e, 0x1f, 0x2c, 0x83, 0x6f, 0x89, 0x15, 0x62, 0xbb, 0xd7, 0x97, 0x02, 0xdf, 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d5, 0x8a, 0x8f, 0x05, 0x70, 0xfa, 0x1a, 0x48, 0x55, 0x6c, 0x69, 0x13, 0xe3, - 0x25, 0xc0, 0x62, 0xa7, 0xe1, 0xc1, 0x03, 0xab, 0x2e, 0xe4, 0x79, 0xfa, 0xc5, 0x45, 0x88, 0x7f, - 0x41, 0x75, 0x79, 0x7f, 0xa0, 0x24, 0x9a, 0x7c, 0x7e, 0x7f, 0x35, 0x9e, 0x7d, 0x11, 0x13, 0x92, - 0x9f, 0xff, 0xf8, 0xe7, 0xc9, 0xc8, 0x66, 0xb7, 0x93, 0x41, 0x73, 0xe8, 0xde, 0x9f, 0x8c, 0x83, - 0x1b, 0xde, 0xb1, 0x9d, 0x91, 0x43, 0xd8, 0xd4, 0xa5, 0x77, 0x27, 0x63, 0xc7, 0x3a, 0xe1, 0xfb, - 0xfe, 0x24, 0xe1, 0x1a, 0xe4, 0xf8, 0x63, 0xf9, 0xe5, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb5, - 0xeb, 0x99, 0xb8, 0x75, 0x0b, 0x00, 0x00, + // 1428 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xff, 0x6f, 0xda, 0xc8, + 0x12, 0x6f, 0xbe, 0x40, 0x60, 0x0c, 0x84, 0x2c, 0x24, 0xa1, 0x34, 0x6d, 0x52, 0x57, 0xef, 0xbd, + 0xe8, 0xbd, 0x96, 0xe8, 0xa5, 0xea, 0xa9, 0xed, 0x49, 0xa7, 0x4b, 0xc0, 0x11, 0x11, 0x04, 0x52, + 0x43, 0x1a, 0xf5, 0xee, 0x07, 0xcb, 0xe0, 0x2d, 0xb1, 0x02, 0xb6, 0xbb, 0x5e, 0x8a, 0xf9, 0xed, + 0xfe, 0x8a, 0x93, 0xfa, 0x6f, 0xdd, 0x5f, 0x74, 0xda, 0x5d, 0x63, 0xd6, 0x40, 0x7a, 0x3a, 0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ee, 0x27, 0xdc, 0x6e, 0x43, + 0x4f, 0xf9, 0x26, 0xbd, 0xc6, 0xa4, 0x31, 0x41, 0xc7, 0xb0, 0xe5, 0x0a, 0xfd, 0xd2, 0x3a, 0x6f, + 0xa5, 0x5c, 0x25, 0xec, 0xeb, 0x4a, 0x37, 0x68, 0x8f, 0xa9, 0x3e, 0x83, 0xe7, 0xb1, 0x6e, 0xc8, + 0xb1, 0xbe, 0x84, 0x42, 0xcc, 0x67, 0x18, 0xef, 0x2e, 0x24, 0x89, 0x39, 0x31, 0x68, 0x74, 0x5f, + 0x62, 0x4e, 0xba, 0x81, 0xfa, 0x06, 0x90, 0xe6, 0x53, 0x7b, 0x64, 0x52, 0x7c, 0x81, 0xf1, 0x2c, + 0xc2, 0x43, 0x50, 0x58, 0xf3, 0x1b, 0xd4, 0x24, 0x03, 0x3c, 0x2b, 0x11, 0x30, 0x51, 0x97, 0x4b, + 0xd4, 0xd7, 0x50, 0x88, 0x99, 0x85, 0x4e, 0xbe, 0x7b, 0x33, 0xf5, 0xdb, 0x06, 0x64, 0xae, 0xb1, + 0x63, 0xd9, 0xce, 0xa0, 0x33, 0xc1, 0xd8, 0x8b, 0xb5, 0xd7, 0xda, 0x5f, 0xb4, 0x17, 0x7a, 0x07, + 0x99, 0x89, 0x4d, 0x1d, 0xec, 0xfb, 0x06, 0x9d, 0x7a, 0x98, 0x17, 0x28, 0x77, 0xba, 0x57, 0x89, + 0x46, 0x41, 0xe5, 0x56, 0xc0, 0xdd, 0xa9, 0x87, 0x75, 0x65, 0x32, 0x3f, 0xb0, 0x66, 0x32, 0x47, + 0xee, 0xd8, 0xa1, 0x86, 0x6f, 0x52, 0x9e, 0xad, 0xac, 0x9e, 0x16, 0x92, 0x8e, 0x49, 0xd1, 0x11, + 0x64, 0x66, 0x51, 0xf7, 0xa6, 0x14, 0x97, 0x36, 0xb9, 0x02, 0x88, 0xb8, 0xcf, 0xa7, 0x14, 0xa3, + 0x57, 0x80, 0x7a, 0xc4,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0xdd, 0xc1, 0x8f, 0x7e, 0x85, 0xfc, 0xe2, + 0xbc, 0x44, 0xaa, 0x6c, 0xb2, 0x7a, 0x5e, 0x97, 0x5f, 0x7c, 0x57, 0x47, 0x90, 0x9f, 0xff, 0xff, + 0x97, 0x93, 0x81, 0x4d, 0xef, 0xc6, 0xbd, 0x4a, 0xdf, 0x1d, 0x9d, 0x0c, 0xd9, 0x46, 0xe3, 0xd8, + 0xce, 0xc0, 0xc1, 0x74, 0xe2, 0x92, 0xfb, 0x93, 0xa1, 0x63, 0x9d, 0xf0, 0xf7, 0xed, 0x24, 0xe2, + 0xea, 0x25, 0xf9, 0xcf, 0xb3, 0xd7, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x01, 0xb2, 0xa4, 0x25, + 0xe7, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1206,6 +1484,22 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type WalletKitClient interface { + // + //ListUnspent returns a list of all utxos spendable by the wallet with a + //number of confirmations between the specified minimum and maximum. + ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) + // + //LeaseOutput locks an output to the given ID, preventing it from being + //available for any future coin selection attempts. The absolute time of the + //lock's expiration is returned. The expiration of the lock can be extended by + //successive invocations of this RPC. Outputs can be unlocked before their + //expiration through `ReleaseOutput`. + LeaseOutput(ctx context.Context, in *LeaseOutputRequest, opts ...grpc.CallOption) (*LeaseOutputResponse, error) + // + //ReleaseOutput unlocks an output, allowing it to be available for coin + //selection if it remains unspent. The ID should match the one used to + //originally lock the output. + ReleaseOutput(ctx context.Context, in *ReleaseOutputRequest, opts ...grpc.CallOption) (*ReleaseOutputResponse, error) // //DeriveNextKey attempts to derive the *next* key within the key family //(account in BIP43) specified. This method should return the next external @@ -1292,6 +1586,33 @@ func NewWalletKitClient(cc *grpc.ClientConn) WalletKitClient { return &walletKitClient{cc} } +func (c *walletKitClient) ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) { + out := new(ListUnspentResponse) + err := c.cc.Invoke(ctx, "/walletrpc.WalletKit/ListUnspent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletKitClient) LeaseOutput(ctx context.Context, in *LeaseOutputRequest, opts ...grpc.CallOption) (*LeaseOutputResponse, error) { + out := new(LeaseOutputResponse) + err := c.cc.Invoke(ctx, "/walletrpc.WalletKit/LeaseOutput", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletKitClient) ReleaseOutput(ctx context.Context, in *ReleaseOutputRequest, opts ...grpc.CallOption) (*ReleaseOutputResponse, error) { + out := new(ReleaseOutputResponse) + err := c.cc.Invoke(ctx, "/walletrpc.WalletKit/ReleaseOutput", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *walletKitClient) DeriveNextKey(ctx context.Context, in *KeyReq, opts ...grpc.CallOption) (*signrpc.KeyDescriptor, error) { out := new(signrpc.KeyDescriptor) err := c.cc.Invoke(ctx, "/walletrpc.WalletKit/DeriveNextKey", in, out, opts...) @@ -1384,6 +1705,22 @@ func (c *walletKitClient) LabelTransaction(ctx context.Context, in *LabelTransac // WalletKitServer is the server API for WalletKit service. type WalletKitServer interface { + // + //ListUnspent returns a list of all utxos spendable by the wallet with a + //number of confirmations between the specified minimum and maximum. + ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) + // + //LeaseOutput locks an output to the given ID, preventing it from being + //available for any future coin selection attempts. The absolute time of the + //lock's expiration is returned. The expiration of the lock can be extended by + //successive invocations of this RPC. Outputs can be unlocked before their + //expiration through `ReleaseOutput`. + LeaseOutput(context.Context, *LeaseOutputRequest) (*LeaseOutputResponse, error) + // + //ReleaseOutput unlocks an output, allowing it to be available for coin + //selection if it remains unspent. The ID should match the one used to + //originally lock the output. + ReleaseOutput(context.Context, *ReleaseOutputRequest) (*ReleaseOutputResponse, error) // //DeriveNextKey attempts to derive the *next* key within the key family //(account in BIP43) specified. This method should return the next external @@ -1466,6 +1803,60 @@ func RegisterWalletKitServer(s *grpc.Server, srv WalletKitServer) { s.RegisterService(&_WalletKit_serviceDesc, srv) } +func _WalletKit_ListUnspent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUnspentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletKitServer).ListUnspent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/walletrpc.WalletKit/ListUnspent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletKitServer).ListUnspent(ctx, req.(*ListUnspentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletKit_LeaseOutput_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseOutputRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletKitServer).LeaseOutput(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/walletrpc.WalletKit/LeaseOutput", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletKitServer).LeaseOutput(ctx, req.(*LeaseOutputRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletKit_ReleaseOutput_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReleaseOutputRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletKitServer).ReleaseOutput(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/walletrpc.WalletKit/ReleaseOutput", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletKitServer).ReleaseOutput(ctx, req.(*ReleaseOutputRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _WalletKit_DeriveNextKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(KeyReq) if err := dec(in); err != nil { @@ -1650,6 +2041,18 @@ var _WalletKit_serviceDesc = grpc.ServiceDesc{ ServiceName: "walletrpc.WalletKit", HandlerType: (*WalletKitServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "ListUnspent", + Handler: _WalletKit_ListUnspent_Handler, + }, + { + MethodName: "LeaseOutput", + Handler: _WalletKit_LeaseOutput_Handler, + }, + { + MethodName: "ReleaseOutput", + Handler: _WalletKit_ReleaseOutput_Handler, + }, { MethodName: "DeriveNextKey", Handler: _WalletKit_DeriveNextKey_Handler, diff --git a/lnrpc/walletrpc/walletkit.proto b/lnrpc/walletrpc/walletkit.proto index a8b9cf1f6..aec29c15a 100644 --- a/lnrpc/walletrpc/walletkit.proto +++ b/lnrpc/walletrpc/walletkit.proto @@ -10,6 +10,28 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc"; // WalletKit is a service that gives access to the core functionalities of the // daemon's wallet. service WalletKit { + /* + ListUnspent returns a list of all utxos spendable by the wallet with a + number of confirmations between the specified minimum and maximum. + */ + rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse); + + /* + LeaseOutput locks an output to the given ID, preventing it from being + available for any future coin selection attempts. The absolute time of the + lock's expiration is returned. The expiration of the lock can be extended by + successive invocations of this RPC. Outputs can be unlocked before their + expiration through `ReleaseOutput`. + */ + rpc LeaseOutput (LeaseOutputRequest) returns (LeaseOutputResponse); + + /* + ReleaseOutput unlocks an output, allowing it to be available for coin + selection if it remains unspent. The ID should match the one used to + originally lock the output. + */ + rpc ReleaseOutput (ReleaseOutputRequest) returns (ReleaseOutputResponse); + /* DeriveNextKey attempts to derive the *next* key within the key family (account in BIP43) specified. This method should return the next external @@ -108,6 +130,48 @@ service WalletKit { returns (LabelTransactionResponse); } +message ListUnspentRequest { + // The minimum number of confirmations to be included. + int32 min_confs = 1; + + // The maximum number of confirmations to be included. + int32 max_confs = 2; +} + +message ListUnspentResponse { + // A list of utxos satisfying the specified number of confirmations. + repeated lnrpc.Utxo utxos = 1; +} + +message LeaseOutputRequest { + /* + An ID of 32 random bytes that must be unique for each distinct application + using this RPC which will be used to bound the output lease to. + */ + bytes id = 1; + + // The identifying outpoint of the output being leased. + lnrpc.OutPoint outpoint = 2; +} + +message LeaseOutputResponse { + /* + The absolute expiration of the output lease represented as a unix timestamp. + */ + uint64 expiration = 1; +} + +message ReleaseOutputRequest { + // The unique ID that was used to lock the output. + bytes id = 1; + + // The identifying outpoint of the output being released. + lnrpc.OutPoint outpoint = 2; +} + +message ReleaseOutputResponse { +} + message KeyReq { /* Is the key finger print of the root pubkey that this request is targeting. diff --git a/lnrpc/walletrpc/walletkit.swagger.json b/lnrpc/walletrpc/walletkit.swagger.json index 26a2ede62..d901a3945 100644 --- a/lnrpc/walletrpc/walletkit.swagger.json +++ b/lnrpc/walletrpc/walletkit.swagger.json @@ -28,6 +28,18 @@ } } }, + "lnrpcAddressType": { + "type": "string", + "enum": [ + "WITNESS_PUBKEY_HASH", + "NESTED_PUBKEY_HASH", + "UNUSED_WITNESS_PUBKEY_HASH", + "UNUSED_NESTED_PUBKEY_HASH" + ], + "default": "WITNESS_PUBKEY_HASH", + "description": "- `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0)\n- `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1)", + "title": "`AddressType` has to be one of:" + }, "lnrpcOutPoint": { "type": "object", "properties": { @@ -112,6 +124,37 @@ } } }, + "lnrpcUtxo": { + "type": "object", + "properties": { + "address_type": { + "$ref": "#/definitions/lnrpcAddressType", + "title": "The type of address" + }, + "address": { + "type": "string", + "title": "The address" + }, + "amount_sat": { + "type": "string", + "format": "int64", + "title": "The value of the unspent coin in satoshis" + }, + "pk_script": { + "type": "string", + "title": "The pkscript in hex" + }, + "outpoint": { + "$ref": "#/definitions/lnrpcOutPoint", + "title": "The outpoint in format txid:n" + }, + "confirmations": { + "type": "string", + "format": "int64", + "title": "The number of confirmations for the Utxo" + } + } + }, "signrpcKeyDescriptor": { "type": "object", "properties": { @@ -181,6 +224,16 @@ "walletrpcLabelTransactionResponse": { "type": "object" }, + "walletrpcLeaseOutputResponse": { + "type": "object", + "properties": { + "expiration": { + "type": "string", + "format": "uint64", + "description": "The absolute expiration of the output lease represented as a unix timestamp." + } + } + }, "walletrpcListSweepsResponse": { "type": "object", "properties": { @@ -192,6 +245,18 @@ } } }, + "walletrpcListUnspentResponse": { + "type": "object", + "properties": { + "utxos": { + "type": "array", + "items": { + "$ref": "#/definitions/lnrpcUtxo" + }, + "description": "A list of utxos satisfying the specified number of confirmations." + } + } + }, "walletrpcPendingSweep": { "type": "object", "properties": { @@ -261,6 +326,9 @@ } } }, + "walletrpcReleaseOutputResponse": { + "type": "object" + }, "walletrpcSendOutputsResponse": { "type": "object", "properties": { diff --git a/lnrpc/walletrpc/walletkit_server.go b/lnrpc/walletrpc/walletkit_server.go index f192fcbe2..0cd8ead02 100644 --- a/lnrpc/walletrpc/walletkit_server.go +++ b/lnrpc/walletrpc/walletkit_server.go @@ -14,6 +14,7 @@ import ( "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" + "github.com/btcsuite/btcwallet/wtxmgr" "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/keychain" "github.com/lightningnetwork/lnd/labels" @@ -98,6 +99,18 @@ var ( Entity: "onchain", Action: "write", }}, + "/walletrpc.WalletKit/LeaseOutput": {{ + Entity: "onchain", + Action: "write", + }}, + "/walletrpc.WalletKit/ReleaseOutput": {{ + Entity: "onchain", + Action: "write", + }}, + "/walletrpc.WalletKit/ListUnspent": {{ + Entity: "onchain", + Action: "read", + }}, } // DefaultWalletKitMacFilename is the default name of the wallet kit @@ -204,6 +217,101 @@ func (w *WalletKit) RegisterWithRootServer(grpcServer *grpc.Server) error { return nil } +// ListUnspent returns useful information about each unspent output owned by the +// wallet, as reported by the underlying `ListUnspentWitness`; the information +// returned is: outpoint, amount in satoshis, address, address type, +// scriptPubKey in hex and number of confirmations. The result is filtered to +// contain outputs whose number of confirmations is between a +// minimum and maximum number of confirmations specified by the user, with 0 +// meaning unconfirmed. +func (w *WalletKit) ListUnspent(ctx context.Context, + req *ListUnspentRequest) (*ListUnspentResponse, error) { + + // Validate the confirmation arguments. + minConfs, maxConfs, err := lnrpc.ParseConfs(req.MinConfs, req.MaxConfs) + if err != nil { + return nil, err + } + + // With our arguments validated, we'll query the internal wallet for + // the set of UTXOs that match our query. + utxos, err := w.cfg.Wallet.ListUnspentWitness(minConfs, maxConfs) + if err != nil { + return nil, err + } + + rpcUtxos, err := lnrpc.MarshalUtxos(utxos, w.cfg.ChainParams) + if err != nil { + return nil, err + } + + return &ListUnspentResponse{ + Utxos: rpcUtxos, + }, nil +} + +// LeaseOutput locks an output to the given ID, preventing it from being +// available for any future coin selection attempts. The absolute time of the +// lock's expiration is returned. The expiration of the lock can be extended by +// successive invocations of this call. Outputs can be unlocked before their +// expiration through `ReleaseOutput`. +// +// If the output is not known, wtxmgr.ErrUnknownOutput is returned. If the +// output has already been locked to a different ID, then +// wtxmgr.ErrOutputAlreadyLocked is returned. +func (w *WalletKit) LeaseOutput(ctx context.Context, + req *LeaseOutputRequest) (*LeaseOutputResponse, error) { + + if len(req.Id) != 32 { + return nil, errors.New("id must be 32 random bytes") + } + var lockID wtxmgr.LockID + copy(lockID[:], req.Id) + + // Don't allow ID's of 32 bytes, but all zeros. + if lockID == (wtxmgr.LockID{}) { + return nil, errors.New("id must be 32 random bytes") + } + + op, err := unmarshallOutPoint(req.Outpoint) + if err != nil { + return nil, err + } + + expiration, err := w.cfg.Wallet.LeaseOutput(lockID, *op) + if err != nil { + return nil, err + } + + return &LeaseOutputResponse{ + Expiration: uint64(expiration.Unix()), + }, nil +} + +// ReleaseOutput unlocks an output, allowing it to be available for coin +// selection if it remains unspent. The ID should match the one used to +// originally lock the output. +func (w *WalletKit) ReleaseOutput(ctx context.Context, + req *ReleaseOutputRequest) (*ReleaseOutputResponse, error) { + + if len(req.Id) != 32 { + return nil, errors.New("id must be 32 random bytes") + } + var lockID wtxmgr.LockID + copy(lockID[:], req.Id) + + op, err := unmarshallOutPoint(req.Outpoint) + if err != nil { + return nil, err + } + + if err := w.cfg.Wallet.ReleaseOutput(lockID, *op); err != nil { + return nil, err + } + + return &ReleaseOutputResponse{}, nil +} + // DeriveNextKey attempts to derive the *next* key within the key family // (account in BIP43) specified. This method should return the next external // child within this branch. diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index a4569e526..e11769336 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -19,6 +19,7 @@ import ( "github.com/btcsuite/btcwallet/wallet/txauthor" "github.com/btcsuite/btcwallet/wallet/txrules" "github.com/btcsuite/btcwallet/walletdb" + "github.com/btcsuite/btcwallet/wtxmgr" "github.com/lightningnetwork/lnd/keychain" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chainfee" @@ -367,6 +368,27 @@ func (b *BtcWallet) UnlockOutpoint(o wire.OutPoint) { b.wallet.UnlockOutpoint(o) } +// LeaseOutput locks an output to the given ID, preventing it from being +// available for any future coin selection attempts. The absolute time of the +// lock's expiration is returned. The expiration of the lock can be extended by +// successive invocations of this call. Outputs can be unlocked before their +// expiration through `ReleaseOutput`. +// +// If the output is not known, wtxmgr.ErrUnknownOutput is returned. If the +// output has already been locked to a different ID, then +// wtxmgr.ErrOutputAlreadyLocked is returned. +func (b *BtcWallet) LeaseOutput(id wtxmgr.LockID, op wire.OutPoint) (time.Time, + error) { + return b.wallet.LeaseOutput(id, op) +} + +// ReleaseOutput unlocks an output, allowing it to be available for coin +// selection if it remains unspent. The ID should match the one used to +// originally lock the output. +func (b *BtcWallet) ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error { + return b.wallet.ReleaseOutput(id, op) +} + // ListUnspentWitness returns a slice of all the unspent outputs the wallet // controls which pay to witness programs either directly or indirectly. // diff --git a/lnwallet/interface.go b/lnwallet/interface.go index bff571e1c..951cf17a6 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -4,12 +4,14 @@ import ( "errors" "fmt" "sync" + "time" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcwallet/wallet/txauthor" + "github.com/btcsuite/btcwallet/wtxmgr" "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/lnwallet/chainfee" ) @@ -221,6 +223,22 @@ type WalletController interface { // eligible for coin selection. UnlockOutpoint(o wire.OutPoint) + // LeaseOutput locks an output to the given ID, preventing it from being + // available for any future coin selection attempts. The absolute time + // of the lock's expiration is returned. The expiration of the lock can + // be extended by successive invocations of this call. Outputs can be + // unlocked before their expiration through `ReleaseOutput`. + // + // If the output is not known, wtxmgr.ErrUnknownOutput is returned. If + // the output has already been locked to a different ID, then + // wtxmgr.ErrOutputAlreadyLocked is returned. + LeaseOutput(id wtxmgr.LockID, op wire.OutPoint) (time.Time, error) + + // ReleaseOutput unlocks an output, allowing it to be available for coin + // selection if it remains unspent. The ID should match the one used to + // originally lock the output. + ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error + // PublishTransaction performs cursory validation (dust checks, etc), // then finally broadcasts the passed transaction to the Bitcoin network. // If the transaction is rejected because it is conflicting with an diff --git a/mock.go b/mock.go index 6d40402b0..fc86d1b0a 100644 --- a/mock.go +++ b/mock.go @@ -5,6 +5,7 @@ import ( "fmt" "sync" "sync/atomic" + "time" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg" @@ -13,6 +14,7 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcwallet/wallet/txauthor" + "github.com/btcsuite/btcwallet/wtxmgr" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/input" @@ -322,6 +324,14 @@ func (*mockWalletController) ListTransactionDetails(_, _ int32) ([]*lnwallet.Tra } func (*mockWalletController) LockOutpoint(o wire.OutPoint) {} func (*mockWalletController) UnlockOutpoint(o wire.OutPoint) {} + +func (*mockWalletController) LeaseOutput(wtxmgr.LockID, wire.OutPoint) (time.Time, error) { + return time.Now(), nil +} +func (*mockWalletController) ReleaseOutput(wtxmgr.LockID, wire.OutPoint) error { + return nil +} + func (m *mockWalletController) PublishTransaction(tx *wire.MsgTx, _ string) error { m.publishedTransactions <- tx return nil diff --git a/rpcserver.go b/rpcserver.go index 7bd113101..81f6f0d0c 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -924,30 +924,20 @@ func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64, return &txHash, nil } -// ListUnspent returns useful information about each unspent output owned by -// the wallet, as reported by the underlying `ListUnspentWitness`; the -// information returned is: outpoint, amount in satoshis, address, address -// type, scriptPubKey in hex and number of confirmations. The result is -// filtered to contain outputs whose number of confirmations is between a -// minimum and maximum number of confirmations specified by the user, with 0 -// meaning unconfirmed. +// ListUnspent returns useful information about each unspent output owned by the +// wallet, as reported by the underlying `ListUnspentWitness`; the information +// returned is: outpoint, amount in satoshis, address, address type, +// scriptPubKey in hex and number of confirmations. The result is filtered to +// contain outputs whose number of confirmations is between a minimum and +// maximum number of confirmations specified by the user, with 0 meaning +// unconfirmed. func (r *rpcServer) ListUnspent(ctx context.Context, in *lnrpc.ListUnspentRequest) (*lnrpc.ListUnspentResponse, error) { - minConfs := in.MinConfs - maxConfs := in.MaxConfs - - switch { - // Ensure that the user didn't attempt to specify a negative number of - // confirmations, as that isn't possible. - case minConfs < 0: - return nil, fmt.Errorf("min confirmations must be >= 0") - - // We'll also ensure that the min number of confs is strictly less than - // or equal to the max number of confs for sanity. - case minConfs > maxConfs: - return nil, fmt.Errorf("max confirmations must be >= min " + - "confirmations") + // Validate the confirmation arguments. + minConfs, maxConfs, err := lnrpc.ParseConfs(in.MinConfs, in.MaxConfs) + if err != nil { + return nil, err } // With our arguments validated, we'll query the internal wallet for @@ -957,69 +947,9 @@ func (r *rpcServer) ListUnspent(ctx context.Context, return nil, err } - resp := &lnrpc.ListUnspentResponse{ - Utxos: make([]*lnrpc.Utxo, 0, len(utxos)), - } - - for _, utxo := range utxos { - // Translate lnwallet address type to the proper gRPC proto - // address type. - var addrType lnrpc.AddressType - switch utxo.AddressType { - - case lnwallet.WitnessPubKey: - addrType = lnrpc.AddressType_WITNESS_PUBKEY_HASH - - case lnwallet.NestedWitnessPubKey: - addrType = lnrpc.AddressType_NESTED_PUBKEY_HASH - - case lnwallet.UnknownAddressType: - rpcsLog.Warnf("[listunspent] utxo with address of "+ - "unknown type ignored: %v", - utxo.OutPoint.String()) - continue - - default: - return nil, fmt.Errorf("invalid utxo address type") - } - - // Now that we know we have a proper mapping to an address, - // we'll convert the regular outpoint to an lnrpc variant. - outpoint := &lnrpc.OutPoint{ - TxidBytes: utxo.OutPoint.Hash[:], - TxidStr: utxo.OutPoint.Hash.String(), - OutputIndex: utxo.OutPoint.Index, - } - - utxoResp := lnrpc.Utxo{ - AddressType: addrType, - AmountSat: int64(utxo.Value), - PkScript: hex.EncodeToString(utxo.PkScript), - Outpoint: outpoint, - Confirmations: utxo.Confirmations, - } - - // Finally, we'll attempt to extract the raw address from the - // script so we can display a human friendly address to the end - // user. - _, outAddresses, _, err := txscript.ExtractPkScriptAddrs( - utxo.PkScript, activeNetParams.Params, - ) - if err != nil { - return nil, err - } - - // If we can't properly locate a single address, then this was - // an error in our mapping, and we'll return an error back to - // the user. - if len(outAddresses) != 1 { - return nil, fmt.Errorf("an output was unexpectedly " + - "multisig") - } - - utxoResp.Address = outAddresses[0].String() - - resp.Utxos = append(resp.Utxos, &utxoResp) + rpcUtxos, err := lnrpc.MarshalUtxos(utxos, activeNetParams.Params) + if err != nil { + return nil, err } maxStr := "" @@ -1030,7 +960,9 @@ func (r *rpcServer) ListUnspent(ctx context.Context, rpcsLog.Debugf("[listunspent] min=%v%v, generated utxos: %v", minConfs, maxStr, utxos) - return resp, nil + return &lnrpc.ListUnspentResponse{ + Utxos: rpcUtxos, + }, nil } // EstimateFee handles a request for estimating the fee for sending a diff --git a/subrpcserver_config.go b/subrpcserver_config.go index 721608e59..dcbbd2e8a 100644 --- a/subrpcserver_config.go +++ b/subrpcserver_config.go @@ -162,6 +162,9 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config, cc *chainControl subCfgValue.FieldByName("Chain").Set( reflect.ValueOf(cc.chainIO), ) + subCfgValue.FieldByName("ChainParams").Set( + reflect.ValueOf(activeNetParams), + ) case *autopilotrpc.Config: subCfgValue := extractReflectValue(subCfg)