From ec1c47915622dd0ce2b932d9d9c17b65f83ba261 Mon Sep 17 00:00:00 2001 From: DanS Date: Sat, 21 Mar 2026 03:50:55 -0500 Subject: [PATCH] Increase block cache size to 400k for faster wallet sync - Increase default cache-size from 40,000 to 400,000 blocks - Add Python gRPC protobuf bindings for testing --- cmd/server/main.go | 2 +- common/common.go | 6 + frontend/service.go | 38 +- .../compact_formats_pb2.cpython-310.pyc | Bin 0 -> 1704 bytes .../__pycache__/service_pb2.cpython-310.pyc | Bin 0 -> 3325 bytes .../service_pb2_grpc.cpython-310.pyc | Bin 0 -> 7072 bytes walletrpc/compact_formats_pb2.py | 43 ++ walletrpc/compact_formats_pb2_grpc.py | 24 ++ walletrpc/service_pb2.py | 60 +++ walletrpc/service_pb2_grpc.py | 403 ++++++++++++++++++ 10 files changed, 574 insertions(+), 2 deletions(-) create mode 100644 walletrpc/__pycache__/compact_formats_pb2.cpython-310.pyc create mode 100644 walletrpc/__pycache__/service_pb2.cpython-310.pyc create mode 100644 walletrpc/__pycache__/service_pb2_grpc.cpython-310.pyc create mode 100644 walletrpc/compact_formats_pb2.py create mode 100644 walletrpc/compact_formats_pb2_grpc.py create mode 100644 walletrpc/service_pb2.py create mode 100644 walletrpc/service_pb2_grpc.py diff --git a/cmd/server/main.go b/cmd/server/main.go index b51776f..aa4c0ba 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -98,7 +98,7 @@ func main() { flag.Uint64Var(&opts.logLevel, "log-level", uint64(logrus.InfoLevel), "log level (logrus 1-7)") flag.StringVar(&opts.logPath, "log-file", "", "log file to write to") flag.StringVar(&opts.confPath, "conf-file", "", "conf file to pull RPC creds from") - flag.IntVar(&opts.cacheSize, "cache-size", 40000, "number of blocks to hold in the cache") + flag.IntVar(&opts.cacheSize, "cache-size", 400000, "number of blocks to hold in the cache") // creating --version as a requirement of help2man if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") { diff --git a/common/common.go b/common/common.go index cad904f..e063523 100644 --- a/common/common.go +++ b/common/common.go @@ -258,6 +258,12 @@ func GetBlockRange(rpcClient *rpcclient.Client, cache *BlockCache, return } + if block == nil { + errOut <- errors.New( + fmt.Sprintf("Block %d was nil without error", i)) + return + } + blockOut <- *block } diff --git a/frontend/service.go b/frontend/service.go index 9916e6b..14ece28 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -42,6 +42,9 @@ func (s *SqlStreamer) GetCache() *common.BlockCache { func (s *SqlStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc.ChainSpec) (*walletrpc.BlockID, error) { latestBlock := s.cache.GetLatestBlock() + s.log.WithFields(logrus.Fields{ + "latestBlock": latestBlock, + }).Info("GetLatestBlock called") if latestBlock == -1 { return nil, errors.New("Cache is empty. Server is probably not yet ready.") @@ -136,21 +139,47 @@ func (s *SqlStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*wal } func (s *SqlStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.CompactTxStreamer_GetBlockRangeServer) error { + s.log.WithFields(logrus.Fields{ + "start": span.Start.Height, + "end": span.End.Height, + }).Info("GetBlockRange called") + blockChan := make(chan walletrpc.CompactBlock) errChan := make(chan error) go common.GetBlockRange(s.client, s.cache, blockChan, errChan, int(span.Start.Height), int(span.End.Height)) + blockCount := 0 for { select { case err := <-errChan: - // this will also catch context.DeadlineExceeded from the timeout + if err != nil { + s.log.WithFields(logrus.Fields{ + "start": span.Start.Height, + "end": span.End.Height, + "blocksSent": blockCount, + "error": err, + }).Error("GetBlockRange error") + } else { + s.log.WithFields(logrus.Fields{ + "start": span.Start.Height, + "end": span.End.Height, + "blocksSent": blockCount, + }).Info("GetBlockRange completed") + } return err case cBlock := <-blockChan: err := resp.Send(&cBlock) if err != nil { + s.log.WithFields(logrus.Fields{ + "start": span.Start.Height, + "end": span.End.Height, + "blocksSent": blockCount, + "error": err, + }).Error("GetBlockRange send error") return err } + blockCount++ } } @@ -239,6 +268,13 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilte func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) { saplingHeight, blockHeight, chainName, consensusBranchId, difficulty, longestchain, notarized, err := common.GetSaplingInfo(s.client) + s.log.WithFields(logrus.Fields{ + "saplingHeight": saplingHeight, + "blockHeight": blockHeight, + "chainName": chainName, + "consensusBranchId": consensusBranchId, + }).Info("GetLightdInfo called") + if err != nil { s.log.WithFields(logrus.Fields{ "error": err, diff --git a/walletrpc/__pycache__/compact_formats_pb2.cpython-310.pyc b/walletrpc/__pycache__/compact_formats_pb2.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..536673c7f5c1aa1a6a47bc7836abfa801b9c4226 GIT binary patch literal 1704 zcmaJ>&2HO95GM6QNh?aSDJzj3ClTBpVg!-U1iiIEZOLteCb3}2L7)pkaYqtul1uDT zuHr*4d4r-4U>|zuL-Zk9pch^X6z~i5kW*(#SyCM%B((bGo7tUjcW1~-C8FT-e)zld zYe7-|md5InN8=m(2}M;DstgpW(v+)usXSR3SGoJE`;6k@Eo#48ST zRe{_^334aplM2nzJS|W{iv!sbp8 zGLBYdX_*0IuB7H8GvLBuzNExEZ^&GeTA?+x1R#|gP92v5ztV8otA}#Hdr%_f zyk;{muHq=KYqfE33IO9oJPobSLbds6idi69~y0J#`0f)2iC6kF6^vnI#v&-2Q z?xe28-X|n|7S8IqM*30lX`^|ovgTY>evNL{*7BY~hQTxxC|=I`{L`}z&p!Rqg**fEf&*zK%%e zpw~Wn(d{1|i6WND%FL@TWa*U5_Tj7UUc0~l^058G)t|Da{*n%I?dZRC&ajM}84keTsD2|))A2*#zU6Y+Gg020w@~!pjpaJnThNt_i;9kt4xE>H zq;;5QIew&dkN01`Xh*pYjI5~};+8O{Nr%z;9;H3t4z6*D=^tL zday4W_Z0|XjbYEH2maLSEItV$O8k8mtdJNspCBT`JnkKsZF6~>y{KZk3|okrEC}(7 zA)=}&7HSsc`YI_xi-$OIB@Qe6H-$e&-SP0D*P1X7TC~-}{rF*rTVv+GMJ=2;w1qVo zA7;yyt)CPjZ7qtibxRF4gLhH>E058s3(v7A6!9E~OjcK~-;AoMsl}W5kSFD=meSQS M^5mnptY-fG4`DX)!2kdN literal 0 HcmV?d00001 diff --git a/walletrpc/__pycache__/service_pb2.cpython-310.pyc b/walletrpc/__pycache__/service_pb2.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c11bc6093aa11eb439bcd8e41c17990bf1e7cbc GIT binary patch literal 3325 zcmbVO&2!U66qn=gwc`+l5GQ~VOeqA4LjxTyowkl`f``O$EklEQP-XAh7RXx7N)Ab` zbf!0^oldWvaO%hZ(Ep*sQP*}llWT9Km%d#oiAgb`wZ@v?{`T$r*nO+_==eC2;Plz*!@mR!K7qgUV@Q&))Rb@tkC~zVSTh{rI1D(_j0zk99Bak}jsi|JlLE&~ z)K4|jA&JEI#!389=FtR>;{;A(gj3IBz$f=kJ(rr3pf7F8%_$P)XyddF6bIuE#CNp?qR?^PmQvo`MCjrU8oySuFQt)X& z(}Ft_AO+6=$_j2aKnk7%bXIWZ0;J&cfE2;a2S~vSfG!9w7a#>+1oV#JE(J)z?*h6k zxGMot@FJkAg1Z(V1-}RAy5RBwQt%R>8-ja3Knh+4bW?D*0;J%yD)Il~2fOpD#3D?0 z30|-nb!nTL3#~z?L)b!_Vv^tIhrAf_5GGEW8MaFqj3$monoX(6DK@ZNqffLg!W@HI zoN{*hEoy35clDO;5TN3%fnj38_G6%Sf1bY}UnEc39d`)ZGTJ0B+^9OwKmxr=%F}J# z>E(CxPju5HZr;I<^UQ9~O}A;^*4wVup{%dFj;|tj8O2vj+J0Oq$r%*u5u@94v!R91 zm57{1ksheZj=?CM>meir>$=q?@^ut-T%Gx%sbwYqTBG>`)z?s%SXgK}Q8@PiB^ujz z4AUiy+i7w4gi9wbmB&%kurS#cmX0C_iwN>4Q`es~m~J_+53u_@LcZ-nd3q>*9&sdh z8>Ln7x=tLMS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fz?_+#L7PHeqKS@lkZuyuF$$yq5sl;D0GNiUk~Q;NGyh$b3V$~B#hBK` z`RnMJ-LFPO)i4wI@<>X{4y-iPSkZuc#H4!Gl$fb<{{+iR&V&~rVT}U zs636A{MRG$r{t$v#sF6mxRA*Buz@ki4e|qXP#6>k)}W*=C~C?Bh$8xJJk$jZh8?c9 zV};-E;@G7wM%rQ)6fxd>YRjq3N89kBEq;oREF_-T;)yIqT{^@fuNxjUTp!18WQjPe z$8y@oiGLr)!jX{sJ;7z!$BB(jr06bd+a3-PIJ#k*cx*=&6L1st5@})AdCbFX2Qo2= z9be&9Ic}kB;JmSS)=0}^Son9}IV9zS$>Ea<8lj?P9Vh5AnA;F*fc26RvsgztBi*q> z8~L)-(``_@1Is0!_gBLI7NCEA;&Red^QeUg7d;UJ1ckr}j6F@GE43?EsnmW7#>lxo zqOOXui$^n-W~E1R_cM$^+*R=%a+g}?L9r?Kt+;b&S``~6NsO|I8hlL3*kl99rl==! zRy&C^#gF1l#grpCqp(vSarW$CksVBAPh@RsGHYX%s?c@{p-~*XejIBD6WSA5BZqaY zK2@w$tf_!|q|_)dyCc>n8(JpIJ(01Q(=$f#|7b&d0o48pjE!?)_*~`MS8uH1saGc@ z#<(7%8)`qzI8K{|Wn6}G9x6?y6!|ZB<1YayO*RZ8H+GFws(fvn|9`gd!)q?1@|59@JPrRvM%Ie4Y!vB?H~zwEDSXzZZU9VR2LYsverY$ z>+rNzi0-zypQy_sbqrCdkXqR!B}wbe^p5InSdkXvFEu*O(9f`R(={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) diff --git a/walletrpc/service_pb2.py b/walletrpc/service_pb2.py new file mode 100644 index 0000000..32899ee --- /dev/null +++ b/walletrpc/service_pb2.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: service.proto +# Protobuf Python Version: 6.31.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 6, + 31, + 1, + '', + 'service.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +import compact_formats_pb2 as compact__formats__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x12\x15\x63\x61sh.z.wallet.sdk.rpc\x1a\x15\x63ompact_formats.proto\"\'\n\x07\x42lockID\x12\x0e\n\x06height\x18\x01 \x01(\x04\x12\x0c\n\x04hash\x18\x02 \x01(\x0c\"h\n\nBlockRange\x12-\n\x05start\x18\x01 \x01(\x0b\x32\x1e.cash.z.wallet.sdk.rpc.BlockID\x12+\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1e.cash.z.wallet.sdk.rpc.BlockID\"V\n\x08TxFilter\x12-\n\x05\x62lock\x18\x01 \x01(\x0b\x32\x1e.cash.z.wallet.sdk.rpc.BlockID\x12\r\n\x05index\x18\x02 \x01(\x04\x12\x0c\n\x04hash\x18\x03 \x01(\x0c\".\n\x0eRawTransaction\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x0e\n\x06height\x18\x02 \x01(\x04\"7\n\x0cSendResponse\x12\x11\n\terrorCode\x18\x01 \x01(\x05\x12\x14\n\x0c\x65rrorMessage\x18\x02 \x01(\t\"\x0b\n\tChainSpec\"\x07\n\x05\x45mpty\"\xe4\x01\n\nLightdInfo\x12\x0f\n\x07version\x18\x01 \x01(\t\x12\x0e\n\x06vendor\x18\x02 \x01(\t\x12\x14\n\x0ctaddrSupport\x18\x03 \x01(\x08\x12\x11\n\tchainName\x18\x04 \x01(\t\x12\x1f\n\x17saplingActivationHeight\x18\x05 \x01(\x04\x12\x19\n\x11\x63onsensusBranchId\x18\x06 \x01(\t\x12\x13\n\x0b\x62lockHeight\x18\x07 \x01(\x04\x12\x12\n\ndifficulty\x18\x08 \x01(\x04\x12\x14\n\x0clongestchain\x18\t \x01(\x04\x12\x11\n\tnotarized\x18\n \x01(\x04\"i\n\nCoinsupply\x12\x0e\n\x06result\x18\x01 \x01(\t\x12\x0c\n\x04\x63oin\x18\x02 \x01(\t\x12\x0e\n\x06height\x18\x03 \x01(\x04\x12\x0e\n\x06supply\x18\x04 \x01(\x04\x12\x0e\n\x06zfunds\x18\x05 \x01(\x04\x12\r\n\x05total\x18\x06 \x01(\x04\"%\n\x12TransparentAddress\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"b\n\x1dTransparentAddressBlockFilter\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x30\n\x05range\x18\x02 \x01(\x0b\x32!.cash.z.wallet.sdk.rpc.BlockRange2\xf2\x05\n\x11\x43ompactTxStreamer\x12T\n\x0eGetLatestBlock\x12 .cash.z.wallet.sdk.rpc.ChainSpec\x1a\x1e.cash.z.wallet.sdk.rpc.BlockID\"\x00\x12Q\n\x08GetBlock\x12\x1e.cash.z.wallet.sdk.rpc.BlockID\x1a#.cash.z.wallet.sdk.rpc.CompactBlock\"\x00\x12[\n\rGetBlockRange\x12!.cash.z.wallet.sdk.rpc.BlockRange\x1a#.cash.z.wallet.sdk.rpc.CompactBlock\"\x00\x30\x01\x12Z\n\x0eGetTransaction\x12\x1f.cash.z.wallet.sdk.rpc.TxFilter\x1a%.cash.z.wallet.sdk.rpc.RawTransaction\"\x00\x12_\n\x0fSendTransaction\x12%.cash.z.wallet.sdk.rpc.RawTransaction\x1a#.cash.z.wallet.sdk.rpc.SendResponse\"\x00\x12r\n\x0fGetAddressTxids\x12\x34.cash.z.wallet.sdk.rpc.TransparentAddressBlockFilter\x1a%.cash.z.wallet.sdk.rpc.RawTransaction\"\x00\x30\x01\x12R\n\rGetLightdInfo\x12\x1c.cash.z.wallet.sdk.rpc.Empty\x1a!.cash.z.wallet.sdk.rpc.LightdInfo\"\x00\x12R\n\rGetCoinsupply\x12\x1c.cash.z.wallet.sdk.rpc.Empty\x1a!.cash.z.wallet.sdk.rpc.Coinsupply\"\x00\x42\x0bZ\twalletrpcb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'service_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'Z\twalletrpc' + _globals['_BLOCKID']._serialized_start=63 + _globals['_BLOCKID']._serialized_end=102 + _globals['_BLOCKRANGE']._serialized_start=104 + _globals['_BLOCKRANGE']._serialized_end=208 + _globals['_TXFILTER']._serialized_start=210 + _globals['_TXFILTER']._serialized_end=296 + _globals['_RAWTRANSACTION']._serialized_start=298 + _globals['_RAWTRANSACTION']._serialized_end=344 + _globals['_SENDRESPONSE']._serialized_start=346 + _globals['_SENDRESPONSE']._serialized_end=401 + _globals['_CHAINSPEC']._serialized_start=403 + _globals['_CHAINSPEC']._serialized_end=414 + _globals['_EMPTY']._serialized_start=416 + _globals['_EMPTY']._serialized_end=423 + _globals['_LIGHTDINFO']._serialized_start=426 + _globals['_LIGHTDINFO']._serialized_end=654 + _globals['_COINSUPPLY']._serialized_start=656 + _globals['_COINSUPPLY']._serialized_end=761 + _globals['_TRANSPARENTADDRESS']._serialized_start=763 + _globals['_TRANSPARENTADDRESS']._serialized_end=800 + _globals['_TRANSPARENTADDRESSBLOCKFILTER']._serialized_start=802 + _globals['_TRANSPARENTADDRESSBLOCKFILTER']._serialized_end=900 + _globals['_COMPACTTXSTREAMER']._serialized_start=903 + _globals['_COMPACTTXSTREAMER']._serialized_end=1657 +# @@protoc_insertion_point(module_scope) diff --git a/walletrpc/service_pb2_grpc.py b/walletrpc/service_pb2_grpc.py new file mode 100644 index 0000000..84c3126 --- /dev/null +++ b/walletrpc/service_pb2_grpc.py @@ -0,0 +1,403 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +import compact_formats_pb2 as compact__formats__pb2 +import service_pb2 as service__pb2 + +GRPC_GENERATED_VERSION = '1.78.0' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + ' but the generated code in service_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + + +class CompactTxStreamerStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetLatestBlock = channel.unary_unary( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock', + request_serializer=service__pb2.ChainSpec.SerializeToString, + response_deserializer=service__pb2.BlockID.FromString, + _registered_method=True) + self.GetBlock = channel.unary_unary( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock', + request_serializer=service__pb2.BlockID.SerializeToString, + response_deserializer=compact__formats__pb2.CompactBlock.FromString, + _registered_method=True) + self.GetBlockRange = channel.unary_stream( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange', + request_serializer=service__pb2.BlockRange.SerializeToString, + response_deserializer=compact__formats__pb2.CompactBlock.FromString, + _registered_method=True) + self.GetTransaction = channel.unary_unary( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction', + request_serializer=service__pb2.TxFilter.SerializeToString, + response_deserializer=service__pb2.RawTransaction.FromString, + _registered_method=True) + self.SendTransaction = channel.unary_unary( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction', + request_serializer=service__pb2.RawTransaction.SerializeToString, + response_deserializer=service__pb2.SendResponse.FromString, + _registered_method=True) + self.GetAddressTxids = channel.unary_stream( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressTxids', + request_serializer=service__pb2.TransparentAddressBlockFilter.SerializeToString, + response_deserializer=service__pb2.RawTransaction.FromString, + _registered_method=True) + self.GetLightdInfo = channel.unary_unary( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.LightdInfo.FromString, + _registered_method=True) + self.GetCoinsupply = channel.unary_unary( + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetCoinsupply', + request_serializer=service__pb2.Empty.SerializeToString, + response_deserializer=service__pb2.Coinsupply.FromString, + _registered_method=True) + + +class CompactTxStreamerServicer(object): + """Missing associated documentation comment in .proto file.""" + + def GetLatestBlock(self, request, context): + """Compact Blocks + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetBlock(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetBlockRange(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetTransaction(self, request, context): + """Transactions + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SendTransaction(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetAddressTxids(self, request, context): + """t-Address support + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetLightdInfo(self, request, context): + """Misc + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetCoinsupply(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_CompactTxStreamerServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GetLatestBlock': grpc.unary_unary_rpc_method_handler( + servicer.GetLatestBlock, + request_deserializer=service__pb2.ChainSpec.FromString, + response_serializer=service__pb2.BlockID.SerializeToString, + ), + 'GetBlock': grpc.unary_unary_rpc_method_handler( + servicer.GetBlock, + request_deserializer=service__pb2.BlockID.FromString, + response_serializer=compact__formats__pb2.CompactBlock.SerializeToString, + ), + 'GetBlockRange': grpc.unary_stream_rpc_method_handler( + servicer.GetBlockRange, + request_deserializer=service__pb2.BlockRange.FromString, + response_serializer=compact__formats__pb2.CompactBlock.SerializeToString, + ), + 'GetTransaction': grpc.unary_unary_rpc_method_handler( + servicer.GetTransaction, + request_deserializer=service__pb2.TxFilter.FromString, + response_serializer=service__pb2.RawTransaction.SerializeToString, + ), + 'SendTransaction': grpc.unary_unary_rpc_method_handler( + servicer.SendTransaction, + request_deserializer=service__pb2.RawTransaction.FromString, + response_serializer=service__pb2.SendResponse.SerializeToString, + ), + 'GetAddressTxids': grpc.unary_stream_rpc_method_handler( + servicer.GetAddressTxids, + request_deserializer=service__pb2.TransparentAddressBlockFilter.FromString, + response_serializer=service__pb2.RawTransaction.SerializeToString, + ), + 'GetLightdInfo': grpc.unary_unary_rpc_method_handler( + servicer.GetLightdInfo, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.LightdInfo.SerializeToString, + ), + 'GetCoinsupply': grpc.unary_unary_rpc_method_handler( + servicer.GetCoinsupply, + request_deserializer=service__pb2.Empty.FromString, + response_serializer=service__pb2.Coinsupply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'cash.z.wallet.sdk.rpc.CompactTxStreamer', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('cash.z.wallet.sdk.rpc.CompactTxStreamer', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class CompactTxStreamer(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def GetLatestBlock(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock', + service__pb2.ChainSpec.SerializeToString, + service__pb2.BlockID.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def GetBlock(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock', + service__pb2.BlockID.SerializeToString, + compact__formats__pb2.CompactBlock.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def GetBlockRange(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange', + service__pb2.BlockRange.SerializeToString, + compact__formats__pb2.CompactBlock.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def GetTransaction(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction', + service__pb2.TxFilter.SerializeToString, + service__pb2.RawTransaction.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SendTransaction(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction', + service__pb2.RawTransaction.SerializeToString, + service__pb2.SendResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def GetAddressTxids(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressTxids', + service__pb2.TransparentAddressBlockFilter.SerializeToString, + service__pb2.RawTransaction.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def GetLightdInfo(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo', + service__pb2.Empty.SerializeToString, + service__pb2.LightdInfo.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def GetCoinsupply(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetCoinsupply', + service__pb2.Empty.SerializeToString, + service__pb2.Coinsupply.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True)