Add transparent txns
This commit is contained in:
parent
7644852fc6
commit
d36126ba9d
|
@ -160,7 +160,7 @@ func main() {
|
|||
}
|
||||
|
||||
// Compact transaction service initialization
|
||||
service, err := frontend.NewSQLiteStreamer(opts.dbPath, rpcClient)
|
||||
service, err := frontend.NewSQLiteStreamer(opts.dbPath, rpcClient, log)
|
||||
if err != nil {
|
||||
log.WithFields(logrus.Fields{
|
||||
"db_path": opts.dbPath,
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
"github.com/adityapk00/btcd/rpcclient"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
// blank import for sqlite driver support
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
@ -29,9 +30,10 @@ var (
|
|||
type SqlStreamer struct {
|
||||
db *sql.DB
|
||||
client *rpcclient.Client
|
||||
log *logrus.Entry
|
||||
}
|
||||
|
||||
func NewSQLiteStreamer(dbPath string, client *rpcclient.Client) (walletrpc.CompactTxStreamerServer, error) {
|
||||
func NewSQLiteStreamer(dbPath string, client *rpcclient.Client, log *logrus.Entry) (walletrpc.CompactTxStreamerServer, error) {
|
||||
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?_busy_timeout=10000&cache=shared", dbPath))
|
||||
db.SetMaxOpenConns(1)
|
||||
if err != nil {
|
||||
|
@ -44,7 +46,7 @@ func NewSQLiteStreamer(dbPath string, client *rpcclient.Client) (walletrpc.Compa
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return &SqlStreamer{db, client}, nil
|
||||
return &SqlStreamer{db, client, log}, nil
|
||||
}
|
||||
|
||||
func (s *SqlStreamer) GracefulStop() error {
|
||||
|
@ -86,6 +88,61 @@ func (s *SqlStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*wal
|
|||
return cBlock, err
|
||||
}
|
||||
|
||||
func (s *SqlStreamer) GetAddressTxids(addressBlockFilter *walletrpc.TransparentAddressBlockFilter, resp walletrpc.CompactTxStreamer_GetAddressTxidsServer) error {
|
||||
params := make([]json.RawMessage, 1)
|
||||
st := "{\"addresses\": [\"" + addressBlockFilter.Address + "\"]," +
|
||||
"\"start\": " + strconv.FormatUint(addressBlockFilter.Range.Start.Height, 10) +
|
||||
", \"end\": " + strconv.FormatUint(addressBlockFilter.Range.End.Height, 10) + "}"
|
||||
|
||||
params[0] = json.RawMessage(st)
|
||||
|
||||
result, rpcErr := s.client.RawRequest("getaddresstxids", params)
|
||||
|
||||
var err error
|
||||
var errCode int64
|
||||
|
||||
// For some reason, the error responses are not JSON
|
||||
if rpcErr != nil {
|
||||
s.log.Errorf("Got error: %s", rpcErr.Error())
|
||||
errParts := strings.SplitN(rpcErr.Error(), ":", 2)
|
||||
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||
//Check to see if we are requesting a height the zcashd doesn't have yet
|
||||
if err == nil && errCode == -8 {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var txids []string
|
||||
err = json.Unmarshal(result, &txids)
|
||||
if err != nil {
|
||||
s.log.Errorf("Got error: %s", err.Error())
|
||||
return nil
|
||||
}
|
||||
|
||||
timeout, cancel := context.WithTimeout(resp.Context(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
for _, txidstr := range txids {
|
||||
txid, _ := hex.DecodeString(txidstr)
|
||||
// Txid is read as a string, which is in big-endian order. But when converting
|
||||
// to bytes, it should be little-endian
|
||||
for left, right := 0, len(txid)-1; left < right; left, right = left+1, right-1 {
|
||||
txid[left], txid[right] = txid[right], txid[left]
|
||||
}
|
||||
|
||||
tx, err := s.GetTransaction(timeout, &walletrpc.TxFilter{Hash: txid})
|
||||
if err != nil {
|
||||
s.log.Errorf("Got error: %s", err.Error())
|
||||
return nil
|
||||
}
|
||||
|
||||
resp.Send(tx)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SqlStreamer) GetUtxos(address *walletrpc.TransparentAddress, resp walletrpc.CompactTxStreamer_GetUtxosServer) error {
|
||||
utxos, _ := s.client.GetAddressUtxos(address.Address)
|
||||
|
||||
|
|
|
@ -424,6 +424,53 @@ func (m *TransparentAddress) GetAddress() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
type TransparentAddressBlockFilter struct {
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
Range *BlockRange `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TransparentAddressBlockFilter) Reset() { *m = TransparentAddressBlockFilter{} }
|
||||
func (m *TransparentAddressBlockFilter) String() string { return proto.CompactTextString(m) }
|
||||
func (*TransparentAddressBlockFilter) ProtoMessage() {}
|
||||
func (*TransparentAddressBlockFilter) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a0b84a42fa06f626, []int{9}
|
||||
}
|
||||
|
||||
func (m *TransparentAddressBlockFilter) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_TransparentAddressBlockFilter.Unmarshal(m, b)
|
||||
}
|
||||
func (m *TransparentAddressBlockFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_TransparentAddressBlockFilter.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *TransparentAddressBlockFilter) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TransparentAddressBlockFilter.Merge(m, src)
|
||||
}
|
||||
func (m *TransparentAddressBlockFilter) XXX_Size() int {
|
||||
return xxx_messageInfo_TransparentAddressBlockFilter.Size(m)
|
||||
}
|
||||
func (m *TransparentAddressBlockFilter) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TransparentAddressBlockFilter.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TransparentAddressBlockFilter proto.InternalMessageInfo
|
||||
|
||||
func (m *TransparentAddressBlockFilter) GetAddress() string {
|
||||
if m != nil {
|
||||
return m.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TransparentAddressBlockFilter) GetRange() *BlockRange {
|
||||
if m != nil {
|
||||
return m.Range
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Utxo struct {
|
||||
Address *TransparentAddress `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
Txid []byte `protobuf:"bytes,2,opt,name=txid,proto3" json:"txid,omitempty"`
|
||||
|
@ -440,7 +487,7 @@ func (m *Utxo) Reset() { *m = Utxo{} }
|
|||
func (m *Utxo) String() string { return proto.CompactTextString(m) }
|
||||
func (*Utxo) ProtoMessage() {}
|
||||
func (*Utxo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a0b84a42fa06f626, []int{9}
|
||||
return fileDescriptor_a0b84a42fa06f626, []int{10}
|
||||
}
|
||||
|
||||
func (m *Utxo) XXX_Unmarshal(b []byte) error {
|
||||
|
@ -513,51 +560,55 @@ func init() {
|
|||
proto.RegisterType((*Empty)(nil), "cash.z.wallet.sdk.rpc.Empty")
|
||||
proto.RegisterType((*LightdInfo)(nil), "cash.z.wallet.sdk.rpc.LightdInfo")
|
||||
proto.RegisterType((*TransparentAddress)(nil), "cash.z.wallet.sdk.rpc.TransparentAddress")
|
||||
proto.RegisterType((*TransparentAddressBlockFilter)(nil), "cash.z.wallet.sdk.rpc.TransparentAddressBlockFilter")
|
||||
proto.RegisterType((*Utxo)(nil), "cash.z.wallet.sdk.rpc.Utxo")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) }
|
||||
|
||||
var fileDescriptor_a0b84a42fa06f626 = []byte{
|
||||
// 607 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x41, 0x6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33, 0x45, 0xb4, 0x77, 0xe7,
|
||||
0x04, 0x28, 0xff, 0x06, 0x9b, 0xa3, 0xf9, 0xfb, 0x74, 0xec, 0xd1, 0x06, 0xcd, 0xf3, 0xf0, 0x6d,
|
||||
0x55, 0x4d, 0x02, 0xb3, 0xfb, 0xd0, 0x4c, 0x33, 0x85, 0x73, 0x52, 0x6d, 0x88, 0x3c, 0xb8, 0xa9,
|
||||
0x70, 0xad, 0x54, 0xe1, 0x33, 0xd8, 0x16, 0xf2, 0x7a, 0x64, 0x65, 0xe6, 0x64, 0xec, 0x53, 0x9d,
|
||||
0x05, 0x94, 0x92, 0x5e, 0x92, 0x60, 0x47, 0xd0, 0x99, 0x7f, 0x84, 0xce, 0x10, 0x33, 0x25, 0xd0,
|
||||
0x19, 0x9d, 0x39, 0x64, 0xbb, 0xd0, 0x42, 0x6b, 0xb5, 0x1d, 0x68, 0x85, 0x04, 0x6c, 0x8a, 0xdb,
|
||||
0x0b, 0xc6, 0xa1, 0x43, 0xc1, 0x07, 0x74, 0x4e, 0x5e, 0x22, 0x3d, 0xa2, 0x25, 0x96, 0xee, 0x78,
|
||||
0x1b, 0x5a, 0x83, 0x44, 0xa6, 0xd9, 0xd0, 0x60, 0xcc, 0x37, 0xa0, 0xf9, 0x6e, 0x62, 0xfc, 0x77,
|
||||
0x7e, 0x0e, 0x70, 0x12, 0xcc, 0x50, 0xc7, 0xd9, 0x85, 0x66, 0x5d, 0xd8, 0x98, 0xa1, 0x75, 0xa9,
|
||||
0xce, 0x48, 0xa3, 0x25, 0x16, 0x61, 0xf0, 0x70, 0x86, 0x99, 0xd2, 0xb6, 0xe0, 0x2e, 0xa2, 0xa0,
|
||||
0xec, 0xa5, 0x52, 0x76, 0x38, 0x35, 0x46, 0x5b, 0x4f, 0x95, 0x6e, 0x8a, 0xa5, 0x3b, 0x1e, 0x01,
|
||||
0xa3, 0x72, 0x8d, 0xb4, 0x98, 0xf9, 0x37, 0x4a, 0x59, 0x74, 0x2e, 0x68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7b, 0xca, 0xe4, 0xab, 0xe5, 0x56, 0x3e, 0xbf, 0xbc,
|
||||
0x8c, 0xbc, 0xc6, 0xbe, 0x50, 0xb3, 0xc3, 0x90, 0x3a, 0xb6, 0xfa, 0x50, 0xf6, 0x1e, 0x56, 0x40,
|
||||
0x03, 0x11, 0x35, 0x45, 0x50, 0xc7, 0x4b, 0x1b, 0xb9, 0x5b, 0x91, 0x41, 0xdb, 0xdb, 0xab, 0xf2,
|
||||
0xe3, 0x96, 0x80, 0xd7, 0x0e, 0xdb, 0xa7, 0xad, 0xfc, 0xb3, 0x35, 0xf1, 0xf9, 0x3a, 0xfd, 0x9d,
|
||||
0x5f, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x3d, 0x76, 0xac, 0xdc, 0x05, 0x00, 0x00,
|
||||
// 654 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xdf, 0x4f, 0x13, 0x41,
|
||||
0x10, 0x6e, 0xa5, 0x07, 0x74, 0x5a, 0x20, 0x6e, 0xc4, 0x34, 0x15, 0xb5, 0xae, 0x9a, 0xe0, 0xcb,
|
||||
0x85, 0x20, 0xc6, 0x67, 0xa9, 0x4a, 0x48, 0x30, 0xd1, 0x6d, 0xf5, 0x01, 0x1f, 0xc8, 0x72, 0x3b,
|
||||
0xd0, 0x93, 0xf6, 0xf6, 0xb2, 0xbb, 0x2d, 0xd5, 0x7f, 0xd0, 0xff, 0xc8, 0x67, 0xb3, 0x73, 0x57,
|
||||
0xb8, 0x06, 0xcf, 0xf6, 0x6d, 0x67, 0xef, 0x9b, 0x6f, 0x7e, 0x7d, 0xb3, 0x07, 0x1b, 0x16, 0xcd,
|
||||
0x24, 0x8e, 0x30, 0x4c, 0x8d, 0x76, 0x9a, 0x6d, 0x47, 0xd2, 0x0e, 0xc2, 0x5f, 0xe1, 0xb5, 0x1c,
|
||||
0x0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||||
0x18, 0x87, 0x26, 0x19, 0x9f, 0xd0, 0x5a, 0x79, 0x89, 0x94, 0x44, 0x5d, 0xcc, 0xdd, 0xf1, 0x06,
|
||||
0xd4, 0xbb, 0x03, 0x19, 0x27, 0xbd, 0x14, 0x23, 0xbe, 0x06, 0xc1, 0x87, 0x51, 0xea, 0x7e, 0xf2,
|
||||
0x73, 0x80, 0x13, 0x3f, 0x0c, 0x75, 0x9c, 0x5c, 0x68, 0xd6, 0x82, 0xb5, 0x09, 0x1a, 0x1b, 0xeb,
|
||||
0x84, 0x62, 0xd4, 0xc5, 0xcc, 0xf4, 0x33, 0x9c, 0x60, 0xa2, 0xb4, 0xc9, 0xb9, 0x73, 0xcb, 0x47,
|
||||
0x76, 0x52, 0x29, 0xd3, 0x1b, 0xa7, 0xa9, 0x36, 0x8e, 0x2a, 0x5d, 0x17, 0x73, 0x77, 0x3c, 0x04,
|
||||
0x46, 0xe5, 0xa6, 0xd2, 0x60, 0xe2, 0xde, 0x29, 0x65, 0xd0, 0x5a, 0x1f, 0x4b, 0x66, 0xc7, 0x59,
|
||||
0xac, 0xdc, 0xe4, 0x06, 0x1e, 0xdf, 0xc5, 0x53, 0xbf, 0xf3, 0x11, 0x95, 0xba, 0xb2, 0xb7, 0x10,
|
||||
0x18, 0xaf, 0x9c, 0x7c, 0xf8, 0xcf, 0xfe, 0x37, 0x3c, 0x92, 0x98, 0xc8, 0xf0, 0xfc, 0x77, 0x15,
|
||||
0x6a, 0x5f, 0xdd, 0x54, 0xb3, 0xee, 0x3c, 0x77, 0x63, 0xff, 0x55, 0x09, 0xc7, 0xdd, 0x14, 0x6f,
|
||||
0xd3, 0x60, 0x50, 0x73, 0xd3, 0x58, 0xcd, 0x94, 0xed, 0xcf, 0xac, 0x03, 0x0d, 0x3d, 0x76, 0xe9,
|
||||
0xd8, 0x1d, 0x93, 0x4e, 0x56, 0x48, 0x27, 0xc5, 0x2b, 0xdf, 0x63, 0x1b, 0x99, 0x38, 0x75, 0xad,
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, 0x4c, 0x03, 0xb7,
|
||||
0x04, 0xbc, 0x72, 0xd8, 0x38, 0xad, 0x67, 0x9f, 0x4d, 0x1a, 0x9d, 0xaf, 0xd2, 0x5f, 0xe8, 0xf5,
|
||||
0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x7b, 0x3e, 0x9f, 0xc4, 0x06, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -581,6 +632,7 @@ type CompactTxStreamerClient interface {
|
|||
SendTransaction(ctx context.Context, in *RawTransaction, opts ...grpc.CallOption) (*SendResponse, error)
|
||||
// t-Address support
|
||||
GetUtxos(ctx context.Context, in *TransparentAddress, opts ...grpc.CallOption) (CompactTxStreamer_GetUtxosClient, error)
|
||||
GetAddressTxids(ctx context.Context, in *TransparentAddressBlockFilter, opts ...grpc.CallOption) (CompactTxStreamer_GetAddressTxidsClient, error)
|
||||
// Misc
|
||||
GetLightdInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*LightdInfo, error)
|
||||
}
|
||||
|
@ -693,6 +745,38 @@ func (x *compactTxStreamerGetUtxosClient) Recv() (*Utxo, error) {
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func (c *compactTxStreamerClient) GetAddressTxids(ctx context.Context, in *TransparentAddressBlockFilter, opts ...grpc.CallOption) (CompactTxStreamer_GetAddressTxidsClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_CompactTxStreamer_serviceDesc.Streams[2], "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressTxids", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &compactTxStreamerGetAddressTxidsClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type CompactTxStreamer_GetAddressTxidsClient interface {
|
||||
Recv() (*RawTransaction, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type compactTxStreamerGetAddressTxidsClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *compactTxStreamerGetAddressTxidsClient) Recv() (*RawTransaction, error) {
|
||||
m := new(RawTransaction)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *compactTxStreamerClient) GetLightdInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*LightdInfo, error) {
|
||||
out := new(LightdInfo)
|
||||
err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo", in, out, opts...)
|
||||
|
@ -713,6 +797,7 @@ type CompactTxStreamerServer interface {
|
|||
SendTransaction(context.Context, *RawTransaction) (*SendResponse, error)
|
||||
// t-Address support
|
||||
GetUtxos(*TransparentAddress, CompactTxStreamer_GetUtxosServer) error
|
||||
GetAddressTxids(*TransparentAddressBlockFilter, CompactTxStreamer_GetAddressTxidsServer) error
|
||||
// Misc
|
||||
GetLightdInfo(context.Context, *Empty) (*LightdInfo, error)
|
||||
}
|
||||
|
@ -739,6 +824,9 @@ func (*UnimplementedCompactTxStreamerServer) SendTransaction(ctx context.Context
|
|||
func (*UnimplementedCompactTxStreamerServer) GetUtxos(req *TransparentAddress, srv CompactTxStreamer_GetUtxosServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method GetUtxos not implemented")
|
||||
}
|
||||
func (*UnimplementedCompactTxStreamerServer) GetAddressTxids(req *TransparentAddressBlockFilter, srv CompactTxStreamer_GetAddressTxidsServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method GetAddressTxids not implemented")
|
||||
}
|
||||
func (*UnimplementedCompactTxStreamerServer) GetLightdInfo(ctx context.Context, req *Empty) (*LightdInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetLightdInfo not implemented")
|
||||
}
|
||||
|
@ -861,6 +949,27 @@ func (x *compactTxStreamerGetUtxosServer) Send(m *Utxo) error {
|
|||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _CompactTxStreamer_GetAddressTxids_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(TransparentAddressBlockFilter)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(CompactTxStreamerServer).GetAddressTxids(m, &compactTxStreamerGetAddressTxidsServer{stream})
|
||||
}
|
||||
|
||||
type CompactTxStreamer_GetAddressTxidsServer interface {
|
||||
Send(*RawTransaction) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type compactTxStreamerGetAddressTxidsServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *compactTxStreamerGetAddressTxidsServer) Send(m *RawTransaction) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _CompactTxStreamer_GetLightdInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Empty)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -915,6 +1024,11 @@ var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{
|
|||
Handler: _CompactTxStreamer_GetUtxos_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "GetAddressTxids",
|
||||
Handler: _CompactTxStreamer_GetAddressTxids_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "service.proto",
|
||||
}
|
||||
|
|
|
@ -52,6 +52,11 @@ message TransparentAddress {
|
|||
string address = 1;
|
||||
}
|
||||
|
||||
message TransparentAddressBlockFilter {
|
||||
string address = 1;
|
||||
BlockRange range = 2;
|
||||
}
|
||||
|
||||
message Utxo {
|
||||
TransparentAddress address = 1;
|
||||
bytes txid = 2;
|
||||
|
@ -73,6 +78,7 @@ service CompactTxStreamer {
|
|||
|
||||
// t-Address support
|
||||
rpc GetUtxos(TransparentAddress) returns (stream Utxo) {}
|
||||
rpc GetAddressTxids(TransparentAddressBlockFilter) returns (stream RawTransaction) {}
|
||||
|
||||
// Misc
|
||||
rpc GetLightdInfo(Empty) returns (LightdInfo) {}
|
||||
|
|
Loading…
Reference in New Issue