Compare commits

...

5 Commits

Author SHA1 Message Date
George Tankersley cca0613bf2 wip: implement sendtransaction 5 years ago
George Tankersley 38ef157813 WIP DO NOT USE 5 years ago
George Tankersley 3071b5759a walletrpc: fix broken rename 5 years ago
George Tankersley a6671794e3 walletrpc: rename rpc to walletrpc 5 years ago
George Tankersley b6b40ffc1c walletrpc: improve protobuf/grpc package naming 5 years ago
  1. 45
      cmd/server/main.go
  2. 37
      frontend/rpc_client.go
  3. 39
      frontend/rpc_test.go
  4. 83
      frontend/service.go
  5. 5
      go.mod
  6. 41
      go.sum
  7. 10
      parser/block.go
  8. 20
      parser/transaction.go
  9. 4
      storage/sqlite3_test.go
  10. 68
      walletrpc/compact_formats.pb.go
  11. 3
      walletrpc/compact_formats.proto
  12. 2
      walletrpc/generate.go
  13. 106
      walletrpc/service.pb.go
  14. 3
      walletrpc/service.proto

45
cmd/server/main.go

@ -16,7 +16,7 @@ import (
"google.golang.org/grpc/reflection"
"github.com/zcash-hackworks/lightwalletd/frontend"
"github.com/zcash-hackworks/lightwalletd/rpc"
"github.com/zcash-hackworks/lightwalletd/walletrpc"
)
var log *logrus.Entry
@ -34,6 +34,8 @@ func init() {
})
}
// TODO stream logging
func LoggingInterceptor() grpc.ServerOption {
return grpc.UnaryInterceptor(logInterceptor)
}
@ -73,12 +75,13 @@ func loggerFromContext(ctx context.Context) *logrus.Entry {
}
type Options struct {
bindAddr string `json:"bind_address,omitempty"`
dbPath string `json:"db_path"`
tlsCertPath string `json:"tls_cert_path,omitempty"`
tlsKeyPath string `json:"tls_cert_key,omitempty"`
logLevel uint64 `json:"log_level,omitempty"`
logPath string `json:"log_file,omitempty"`
bindAddr string `json:"bind_address,omitempty"`
dbPath string `json:"db_path"`
tlsCertPath string `json:"tls_cert_path,omitempty"`
tlsKeyPath string `json:"tls_cert_key,omitempty"`
logLevel uint64 `json:"log_level,omitempty"`
logPath string `json:"log_file,omitempty"`
zcashConfPath string `json:"zcash_conf,omitempty"`
}
func main() {
@ -89,11 +92,12 @@ func main() {
flag.StringVar(&opts.tlsKeyPath, "tls-key", "", "the path to a TLS key file (optional)")
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.zcashConfPath, "conf-file", "", "conf file to pull RPC creds from")
// TODO prod metrics
// TODO support config from file and env vars
flag.Parse()
if opts.dbPath == "" {
if opts.dbPath == "" || opts.zcashConfPath == "" {
flag.Usage()
os.Exit(1)
}
@ -136,18 +140,37 @@ func main() {
reflection.Register(server)
}
// Initialize Zcash RPC client. Right now (Jan 2018) this is only for
// sending transactions, but in the future it could back a different type
// of block streamer.
rpcClient, err := frontend.NewZRPCFromConf(opts.zcashConfPath)
if err != nil {
log.WithFields(logrus.Fields{
"error": err,
}).Warn("zcash.conf failed, will try empty credentials for rpc")
rpcClient, err = frontend.NewZRPCFromCreds("127.0.0.1:8232", "", "")
if err != nil {
log.WithFields(logrus.Fields{
"error": err,
}).Warn("couldn't start rpc conn. won't be able to send transactions")
}
}
// Compact transaction service initialization
service, err := frontend.NewSQLiteStreamer(opts.dbPath)
service, err := frontend.NewSQLiteStreamer(opts.dbPath, rpcClient)
if err != nil {
log.WithFields(logrus.Fields{
"db_path": opts.dbPath,
"error": err,
}).Fatal("couldn't create SQL streamer")
}).Fatal("couldn't create SQL backend")
}
defer service.(*frontend.SqlStreamer).GracefulStop()
// Register service
rpc.RegisterCompactTxStreamerServer(server, service)
walletrpc.RegisterCompactTxStreamerServer(server, service)
// Start listening
listener, err := net.Listen("tcp", opts.bindAddr)

37
frontend/rpc_client.go

@ -0,0 +1,37 @@
package frontend
import (
"net"
"github.com/btcsuite/btcd/rpcclient"
"github.com/pkg/errors"
ini "gopkg.in/ini.v1"
)
func NewZRPCFromConf(confPath string) (*rpcclient.Client, error) {
cfg, err := ini.Load(confPath)
if err != nil {
return nil, errors.Wrap(err, "failed to read config file")
}
rpcaddr := cfg.Section("").Key("rpcbind").String()
rpcport := cfg.Section("").Key("rpcport").String()
username := cfg.Section("").Key("rpcuser").String()
password := cfg.Section("").Key("rpcpassword").String()
return NewZRPCFromCreds(net.JoinHostPort(rpcaddr, rpcport), username, password)
}
func NewZRPCFromCreds(addr, username, password string) (*rpcclient.Client, error) {
// Connect to local zcash RPC server using HTTP POST mode.
connCfg := &rpcclient.ConnConfig{
Host: addr,
User: username,
Pass: password,
HTTPPostMode: true, // Zcash only supports HTTP POST mode
DisableTLS: true, // Zcash does not provide TLS by default
}
// Notice the notification parameter is nil since notifications are
// not supported in HTTP POST mode.
return rpcclient.New(connCfg, nil)
}

39
frontend/rpc_test.go

@ -0,0 +1,39 @@
package frontend
import (
"encoding/json"
"strconv"
"strings"
"testing"
)
// a well-formed raw transaction
const coinbaseTxHex = "0400008085202f89010000000000000000000000000000000000000" +
"000000000000000000000000000ffffffff03580101ffffffff0200ca9a3b000000001976a9146b" +
"9ae8c14e917966b0afdf422d32dbac40486d3988ac80b2e60e0000000017a9146708e6670db0b95" +
"0dac68031025cc5b63213a4918700000000000000000000000000000000000000"
func TestSendTransaction(t *testing.T) {
client, err := NewZRPCFromCreds("127.0.0.1:8232", "user", "password")
if err != nil {
t.Fatalf("Couldn't init JSON-RPC client: %v", err)
}
params := make([]json.RawMessage, 1)
params[0] = json.RawMessage("\"" + coinbaseTxHex + "\"")
_, err = client.RawRequest("sendrawtransaction", params)
if err == nil {
t.Fatal("somehow succeeded at sending a coinbase tx")
}
errParts := strings.SplitN(err.Error(), ":", 2)
errCode, err := strconv.ParseInt(errParts[0], 10, 64)
if err != nil {
t.Errorf("couldn't parse error code: %v", err)
}
errMsg := strings.TrimSpace(errParts[1])
if errCode != -26 || errMsg != "16: coinbase" {
t.Error("got the wrong errors")
}
}

83
frontend/service.go

@ -4,28 +4,34 @@ import (
"context"
"database/sql"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"strconv"
"strings"
"time"
"github.com/btcsuite/btcd/rpcclient"
"github.com/golang/protobuf/proto"
// blank import for sqlite driver support
_ "github.com/mattn/go-sqlite3"
"github.com/zcash-hackworks/lightwalletd/rpc"
"github.com/zcash-hackworks/lightwalletd/storage"
"github.com/zcash-hackworks/lightwalletd/walletrpc"
)
var (
ErrNoImpl = errors.New("not yet implemented")
ErrUnspecified = errors.New("request for unspecified identifier")
)
// the service type
type SqlStreamer struct {
db *sql.DB
db *sql.DB
client *rpcclient.Client
}
func NewSQLiteStreamer(dbPath string) (rpc.CompactTxStreamerServer, error) {
func NewSQLiteStreamer(dbPath string, client *rpcclient.Client) (walletrpc.CompactTxStreamerServer, error) {
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?_busy_timeout=10000&cache=shared", dbPath))
db.SetMaxOpenConns(1)
if err != nil {
@ -38,24 +44,24 @@ func NewSQLiteStreamer(dbPath string) (rpc.CompactTxStreamerServer, error) {
return nil, err
}
return &SqlStreamer{db}, nil
return &SqlStreamer{db, client}, nil
}
func (s *SqlStreamer) GracefulStop() error {
return s.db.Close()
}
func (s *SqlStreamer) GetLatestBlock(ctx context.Context, placeholder *rpc.ChainSpec) (*rpc.BlockID, error) {
func (s *SqlStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc.ChainSpec) (*walletrpc.BlockID, error) {
// the ChainSpec type is an empty placeholder
height, err := storage.GetCurrentHeight(ctx, s.db)
if err != nil {
return nil, err
}
// TODO: also return block hashes here
return &rpc.BlockID{Height: uint64(height)}, nil
return &walletrpc.BlockID{Height: uint64(height)}, nil
}
func (s *SqlStreamer) GetBlock(ctx context.Context, id *rpc.BlockID) (*rpc.CompactBlock, error) {
func (s *SqlStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*walletrpc.CompactBlock, error) {
if id.Height == 0 && id.Hash == nil {
return nil, ErrUnspecified
}
@ -75,12 +81,12 @@ func (s *SqlStreamer) GetBlock(ctx context.Context, id *rpc.BlockID) (*rpc.Compa
return nil, err
}
cBlock := &rpc.CompactBlock{}
cBlock := &walletrpc.CompactBlock{}
err = proto.Unmarshal(blockBytes, cBlock)
return cBlock, err
}
func (s *SqlStreamer) GetBlockRange(span *rpc.BlockRange, resp rpc.CompactTxStreamer_GetBlockRangeServer) error {
func (s *SqlStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.CompactTxStreamer_GetBlockRangeServer) error {
blockChan := make(chan []byte)
errChan := make(chan error)
@ -101,7 +107,7 @@ func (s *SqlStreamer) GetBlockRange(span *rpc.BlockRange, resp rpc.CompactTxStre
// this will also catch context.DeadlineExceeded from the timeout
return err
case blockBytes := <-blockChan:
cBlock := &rpc.CompactBlock{}
cBlock := &walletrpc.CompactBlock{}
err := proto.Unmarshal(blockBytes, cBlock)
if err != nil {
return err // TODO really need better logging in this whole service
@ -116,7 +122,7 @@ func (s *SqlStreamer) GetBlockRange(span *rpc.BlockRange, resp rpc.CompactTxStre
return nil
}
func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*rpc.RawTransaction, error) {
func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilter) (*walletrpc.RawTransaction, error) {
var txBytes []byte
var err error
@ -126,7 +132,7 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*r
if err != nil {
return nil, err
}
return &rpc.RawTransaction{Data: txBytes}, nil
return &walletrpc.RawTransaction{Data: txBytes}, nil
}
@ -136,7 +142,7 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*r
if err != nil {
return nil, err
}
return &rpc.RawTransaction{Data: txBytes}, nil
return &walletrpc.RawTransaction{Data: txBytes}, nil
}
// A totally unset protobuf will attempt to fetch the genesis coinbase tx.
@ -144,9 +150,52 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *rpc.TxFilter) (*r
if err != nil {
return nil, err
}
return &rpc.RawTransaction{Data: txBytes}, nil
return &walletrpc.RawTransaction{Data: txBytes}, nil
}
func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *rpc.RawTransaction) (*rpc.SendResponse, error) {
return nil, ErrNoImpl
// SendTransaction forwards raw transaction bytes to a zcashd instance over JSON-RPC
func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) {
// sendrawtransaction "hexstring" ( allowhighfees )
//
// Submits raw transaction (serialized, hex-encoded) to local node and network.
//
// Also see createrawtransaction and signrawtransaction calls.
//
// Arguments:
// 1. "hexstring" (string, required) The hex string of the raw transaction)
// 2. allowhighfees (boolean, optional, default=false) Allow high fees
//
// Result:
// "hex" (string) The transaction hash in hex
// Construct raw JSON-RPC params
params := make([]json.RawMessage, 1)
txHexString := hex.EncodeToString(rawtx.Data)
params[0] = json.RawMessage("\"" + txHexString + "\"")
result, rpcErr := s.client.RawRequest("sendrawtransaction", params)
var err error
var errCode int64
var errMsg string
// For some reason, the error responses are not JSON
if rpcErr != nil {
errParts := strings.SplitN(rpcErr.Error(), ":", 2)
errMsg = strings.TrimSpace(errParts[1])
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
if err != nil {
// This should never happen. We can't panic here, but it's that class of error.
// This is why we need integration testing to work better than regtest currently does. TODO.
return nil, errors.New("SendTransaction couldn't parse error code")
}
} else {
errMsg = string(result)
}
// TODO these are called Error but they aren't at the moment.
// A success will return code 0 and message txhash.
return &walletrpc.SendResponse{
ErrorCode: int32(errCode),
ErrorMessage: errMsg,
}, nil
}

5
go.mod

@ -3,11 +3,16 @@ module github.com/zcash-hackworks/lightwalletd
go 1.12
require (
github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d
github.com/golang/protobuf v1.2.0
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/mattn/go-sqlite3 v1.10.0
github.com/pebbe/zmq4 v1.0.0
github.com/pkg/errors v0.8.0
github.com/sirupsen/logrus v1.2.0
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
golang.org/x/net v0.0.0-20181220203305-927f97764cc3
google.golang.org/grpc v1.17.0
gopkg.in/ini.v1 v1.41.0
)

41
go.sum

@ -1,17 +1,43 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d h1:xG8Pj6Y6J760xwETNmMzmlt38QSwz0BLp1cZ09g27uw=
github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a h1:RQMUrEILyYJEoAT34XS/kLu40vC0+po/UfxrBBA4qZE=
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
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/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pebbe/zmq4 v1.0.0 h1:D+MSmPpqkL5PSSmnh8g51ogirUCyemThuZzLW7Nrt78=
github.com/pebbe/zmq4 v1.0.0/go.mod h1:7N4y5R18zBiu3l0vajMUWQgZyjv464prE8RCyBcmnZM=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
@ -20,21 +46,30 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w=
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@ -43,4 +78,10 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/ini.v1 v1.41.0 h1:Ka3ViY6gNYSKiVy71zXBEqKplnV35ImDLVG+8uoIklE=
gopkg.in/ini.v1 v1.41.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

10
parser/block.go

@ -3,9 +3,9 @@ package parser
import (
"fmt"
"github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring"
"github.com/zcash-hackworks/lightwalletd/rpc"
"github.com/pkg/errors"
"github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring"
"github.com/zcash-hackworks/lightwalletd/walletrpc"
)
type block struct {
@ -78,8 +78,8 @@ func (b *block) GetHeight() int {
return int(blockHeight)
}
func (b *block) ToCompact() *rpc.CompactBlock {
compactBlock := &rpc.CompactBlock{
func (b *block) ToCompact() *walletrpc.CompactBlock {
compactBlock := &walletrpc.CompactBlock{
//TODO ProtoVersion: 1,
Height: uint64(b.GetHeight()),
Hash: b.GetEncodableHash(),
@ -87,7 +87,7 @@ func (b *block) ToCompact() *rpc.CompactBlock {
}
// Only Sapling transactions have a meaningful compact encoding
saplingTxns := make([]*rpc.CompactTx, 0, len(b.vtx))
saplingTxns := make([]*walletrpc.CompactTx, 0, len(b.vtx))
for idx, tx := range b.vtx {
if tx.HasSaplingTransactions() {
saplingTxns = append(saplingTxns, tx.ToCompact(idx))

20
parser/transaction.go

@ -3,9 +3,9 @@ package parser
import (
"crypto/sha256"
"github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring"
"github.com/zcash-hackworks/lightwalletd/rpc"
"github.com/pkg/errors"
"github.com/zcash-hackworks/lightwalletd/parser/internal/bytestring"
"github.com/zcash-hackworks/lightwalletd/walletrpc"
)
type rawTransaction struct {
@ -126,8 +126,8 @@ func (p *spend) ParseFromSlice(data []byte) ([]byte, error) {
return []byte(s), nil
}
func (p *spend) ToCompact() *rpc.CompactSpend {
return &rpc.CompactSpend{
func (p *spend) ToCompact() *walletrpc.CompactSpend {
return &walletrpc.CompactSpend{
Nf: p.nullifier,
}
}
@ -173,8 +173,8 @@ func (p *output) ParseFromSlice(data []byte) ([]byte, error) {
return []byte(s), nil
}
func (p *output) ToCompact() *rpc.CompactOutput {
return &rpc.CompactOutput{
func (p *output) ToCompact() *walletrpc.CompactOutput {
return &walletrpc.CompactOutput{
Cmu: p.cmu,
Epk: p.ephemeralKey,
Ciphertext: p.encCiphertext[:52],
@ -304,13 +304,13 @@ func (tx *Transaction) HasSaplingTransactions() bool {
return tx.version >= 4 && (len(tx.shieldedSpends)+len(tx.shieldedOutputs)) > 0
}
func (tx *Transaction) ToCompact(index int) *rpc.CompactTx {
ctx := &rpc.CompactTx{
func (tx *Transaction) ToCompact(index int) *walletrpc.CompactTx {
ctx := &walletrpc.CompactTx{
Index: uint64(index), // index is contextual
Hash: tx.GetEncodableHash(),
//Fee: 0, // TODO: calculate fees
Spends: make([]*rpc.CompactSpend, len(tx.shieldedSpends)),
Outputs: make([]*rpc.CompactOutput, len(tx.shieldedOutputs)),
Spends: make([]*walletrpc.CompactSpend, len(tx.shieldedSpends)),
Outputs: make([]*walletrpc.CompactOutput, len(tx.shieldedOutputs)),
}
for i, spend := range tx.shieldedSpends {
ctx.Spends[i] = spend.ToCompact()

4
storage/sqlite3_test.go

@ -15,7 +15,7 @@ import (
"github.com/pkg/errors"
"github.com/zcash-hackworks/lightwalletd/parser"
"github.com/zcash-hackworks/lightwalletd/rpc"
"github.com/zcash-hackworks/lightwalletd/walletrpc"
)
type compactTest struct {
@ -107,7 +107,7 @@ func TestSqliteStorage(t *testing.T) {
if err != nil {
t.Error(errors.Wrap(err, "retrieving stored block"))
}
cblock := &rpc.CompactBlock{}
cblock := &walletrpc.CompactBlock{}
err = proto.Unmarshal(storedBlock, cblock)
if err != nil {
t.Fatal(err)

68
rpc/compact_formats.pb.go → walletrpc/compact_formats.pb.go

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: compact_formats.proto
package rpc
package walletrpc
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
@ -38,7 +38,7 @@ func (m *CompactBlock) Reset() { *m = CompactBlock{} }
func (m *CompactBlock) String() string { return proto.CompactTextString(m) }
func (*CompactBlock) ProtoMessage() {}
func (*CompactBlock) Descriptor() ([]byte, []int) {
return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{0}
return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{0}
}
func (m *CompactBlock) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CompactBlock.Unmarshal(m, b)
@ -123,7 +123,7 @@ func (m *CompactTx) Reset() { *m = CompactTx{} }
func (m *CompactTx) String() string { return proto.CompactTextString(m) }
func (*CompactTx) ProtoMessage() {}
func (*CompactTx) Descriptor() ([]byte, []int) {
return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{1}
return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{1}
}
func (m *CompactTx) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CompactTx.Unmarshal(m, b)
@ -189,7 +189,7 @@ func (m *CompactSpend) Reset() { *m = CompactSpend{} }
func (m *CompactSpend) String() string { return proto.CompactTextString(m) }
func (*CompactSpend) ProtoMessage() {}
func (*CompactSpend) Descriptor() ([]byte, []int) {
return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{2}
return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{2}
}
func (m *CompactSpend) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CompactSpend.Unmarshal(m, b)
@ -229,7 +229,7 @@ func (m *CompactOutput) Reset() { *m = CompactOutput{} }
func (m *CompactOutput) String() string { return proto.CompactTextString(m) }
func (*CompactOutput) ProtoMessage() {}
func (*CompactOutput) Descriptor() ([]byte, []int) {
return fileDescriptor_compact_formats_9dd2f8e478a3b8fc, []int{3}
return fileDescriptor_compact_formats_e98cba77ef7a6fd2, []int{3}
}
func (m *CompactOutput) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CompactOutput.Unmarshal(m, b)
@ -271,35 +271,37 @@ func (m *CompactOutput) GetCiphertext() []byte {
}
func init() {
proto.RegisterType((*CompactBlock)(nil), "rpc.CompactBlock")
proto.RegisterType((*CompactTx)(nil), "rpc.CompactTx")
proto.RegisterType((*CompactSpend)(nil), "rpc.CompactSpend")
proto.RegisterType((*CompactOutput)(nil), "rpc.CompactOutput")
proto.RegisterType((*CompactBlock)(nil), "cash.z.wallet.sdk.rpc.CompactBlock")
proto.RegisterType((*CompactTx)(nil), "cash.z.wallet.sdk.rpc.CompactTx")
proto.RegisterType((*CompactSpend)(nil), "cash.z.wallet.sdk.rpc.CompactSpend")
proto.RegisterType((*CompactOutput)(nil), "cash.z.wallet.sdk.rpc.CompactOutput")
}
func init() {
proto.RegisterFile("compact_formats.proto", fileDescriptor_compact_formats_9dd2f8e478a3b8fc)
}
var fileDescriptor_compact_formats_9dd2f8e478a3b8fc = []byte{
// 302 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x51, 0x4b, 0x4e, 0xc3, 0x30,
0x10, 0x55, 0x3e, 0x0d, 0x62, 0x48, 0x2b, 0x18, 0x01, 0xf2, 0xaa, 0x8a, 0xb2, 0x0a, 0x12, 0xea,
0x02, 0x6e, 0x00, 0x07, 0x40, 0x72, 0x11, 0x5b, 0x14, 0x5c, 0x87, 0x44, 0x25, 0xb1, 0x65, 0xbb,
0x28, 0xc7, 0xe1, 0x00, 0x1c, 0x12, 0x79, 0x6a, 0xa2, 0x74, 0xf7, 0xe6, 0xbd, 0x37, 0x33, 0xcf,
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x61, 0xce, 0xe3, 0xa1, 0x29, 0xb7, 0xb0, 0x3c,
0xe9, 0xf4, 0xd9, 0x44, 0x7f, 0x08, 0x0e, 0x0f, 0x3d, 0x23, 0xf5, 0x3e, 0x3c, 0xc0, 0x43, 0x5c,
0x03, 0x88, 0x4e, 0xb7, 0xd2, 0x38, 0x39, 0xba, 0x70, 0xdf, 0x19, 0xf3, 0x91, 0xd1, 0xff, 0x3c,
0xfe, 0x05, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x23, 0xf6, 0xee, 0xeb, 0x01, 0x00, 0x00,
proto.RegisterFile("compact_formats.proto", fileDescriptor_compact_formats_e98cba77ef7a6fd2)
}
var fileDescriptor_compact_formats_e98cba77ef7a6fd2 = []byte{
// 332 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x3f, 0x6b, 0xeb, 0x30,
0x14, 0xc5, 0xf1, 0x9f, 0xf8, 0x91, 0x1b, 0xe7, 0xf1, 0x10, 0x2f, 0x45, 0x53, 0x30, 0x6e, 0x07,
0x4f, 0x1a, 0xd2, 0xb1, 0xd0, 0x21, 0xfd, 0x00, 0x05, 0xa5, 0x74, 0xe8, 0x52, 0x5c, 0x59, 0xae,
0x4d, 0x62, 0x4b, 0x48, 0x4a, 0x6b, 0xfa, 0xe1, 0x3a, 0xf5, 0x83, 0x15, 0xc9, 0x6a, 0x48, 0xa0,
0x64, 0x3b, 0xf7, 0x70, 0xce, 0xe5, 0x77, 0xb9, 0xb0, 0x60, 0xa2, 0x93, 0x25, 0x33, 0xcf, 0xb5,
0x50, 0x5d, 0x69, 0x34, 0x91, 0x4a, 0x18, 0x81, 0x16, 0xac, 0xd4, 0x0d, 0xf9, 0x20, 0xef, 0xe5,
0x6e, 0xc7, 0x0d, 0xd1, 0xd5, 0x96, 0x28, 0xc9, 0xf2, 0xcf, 0x00, 0xd2, 0xbb, 0xb1, 0xb0, 0xde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25, 0x5a, 0x02, 0xb0, 0x56, 0x36, 0x5c, 0x19, 0x3e, 0x18, 0xff,
0x95, 0x23, 0x67, 0x3d, 0x7b, 0x9a, 0x8e, 0x74, 0x4a, 0xb2, 0x97, 0xc4, 0xbd, 0xf8, 0xfa, 0x3b,
0x00, 0x00, 0xff, 0xff, 0xf7, 0x3a, 0x6a, 0x01, 0x40, 0x02, 0x00, 0x00,
}

3
rpc/compact_formats.proto → walletrpc/compact_formats.proto

@ -1,5 +1,6 @@
syntax = "proto3";
package rpc;
package cash.z.wallet.sdk.rpc;
option go_package = "walletrpc";
// Remember that proto3 fields are all optional. A field that is not present will be set to its zero value.
// bytes fields of hashes are in canonical little-endian format.

2
rpc/generate.go → walletrpc/generate.go

@ -1,4 +1,4 @@
package rpc
package walletrpc
//go:generate protoc -I . ./compact_formats.proto --go_out=plugins=grpc:.
//go:generate protoc -I . ./service.proto --go_out=plugins=grpc:.

106
rpc/service.pb.go → walletrpc/service.pb.go

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: service.proto
package rpc
package walletrpc
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
@ -37,7 +37,7 @@ func (m *BlockID) Reset() { *m = BlockID{} }
func (m *BlockID) String() string { return proto.CompactTextString(m) }
func (*BlockID) ProtoMessage() {}
func (*BlockID) Descriptor() ([]byte, []int) {
return fileDescriptor_service_a868da2f21e04b98, []int{0}
return fileDescriptor_service_087f17e455cf31eb, []int{0}
}
func (m *BlockID) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockID.Unmarshal(m, b)
@ -86,7 +86,7 @@ func (m *BlockRange) Reset() { *m = BlockRange{} }
func (m *BlockRange) String() string { return proto.CompactTextString(m) }
func (*BlockRange) ProtoMessage() {}
func (*BlockRange) Descriptor() ([]byte, []int) {
return fileDescriptor_service_a868da2f21e04b98, []int{1}
return fileDescriptor_service_087f17e455cf31eb, []int{1}
}
func (m *BlockRange) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockRange.Unmarshal(m, b)
@ -135,7 +135,7 @@ func (m *TxFilter) Reset() { *m = TxFilter{} }
func (m *TxFilter) String() string { return proto.CompactTextString(m) }
func (*TxFilter) ProtoMessage() {}
func (*TxFilter) Descriptor() ([]byte, []int) {
return fileDescriptor_service_a868da2f21e04b98, []int{2}
return fileDescriptor_service_087f17e455cf31eb, []int{2}
}
func (m *TxFilter) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TxFilter.Unmarshal(m, b)
@ -188,7 +188,7 @@ func (m *RawTransaction) Reset() { *m = RawTransaction{} }
func (m *RawTransaction) String() string { return proto.CompactTextString(m) }
func (*RawTransaction) ProtoMessage() {}
func (*RawTransaction) Descriptor() ([]byte, []int) {
return fileDescriptor_service_a868da2f21e04b98, []int{3}
return fileDescriptor_service_087f17e455cf31eb, []int{3}
}
func (m *RawTransaction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RawTransaction.Unmarshal(m, b)
@ -227,7 +227,7 @@ func (m *SendResponse) Reset() { *m = SendResponse{} }
func (m *SendResponse) String() string { return proto.CompactTextString(m) }
func (*SendResponse) ProtoMessage() {}
func (*SendResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_service_a868da2f21e04b98, []int{4}
return fileDescriptor_service_087f17e455cf31eb, []int{4}
}
func (m *SendResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendResponse.Unmarshal(m, b)
@ -272,7 +272,7 @@ func (m *ChainSpec) Reset() { *m = ChainSpec{} }
func (m *ChainSpec) String() string { return proto.CompactTextString(m) }
func (*ChainSpec) ProtoMessage() {}
func (*ChainSpec) Descriptor() ([]byte, []int) {
return fileDescriptor_service_a868da2f21e04b98, []int{5}
return fileDescriptor_service_087f17e455cf31eb, []int{5}
}
func (m *ChainSpec) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChainSpec.Unmarshal(m, b)
@ -293,12 +293,12 @@ func (m *ChainSpec) XXX_DiscardUnknown() {
var xxx_messageInfo_ChainSpec proto.InternalMessageInfo
func init() {
proto.RegisterType((*BlockID)(nil), "rpc.BlockID")
proto.RegisterType((*BlockRange)(nil), "rpc.BlockRange")
proto.RegisterType((*TxFilter)(nil), "rpc.TxFilter")
proto.RegisterType((*RawTransaction)(nil), "rpc.RawTransaction")
proto.RegisterType((*SendResponse)(nil), "rpc.SendResponse")
proto.RegisterType((*ChainSpec)(nil), "rpc.ChainSpec")
proto.RegisterType((*BlockID)(nil), "cash.z.wallet.sdk.rpc.BlockID")
proto.RegisterType((*BlockRange)(nil), "cash.z.wallet.sdk.rpc.BlockRange")
proto.RegisterType((*TxFilter)(nil), "cash.z.wallet.sdk.rpc.TxFilter")
proto.RegisterType((*RawTransaction)(nil), "cash.z.wallet.sdk.rpc.RawTransaction")
proto.RegisterType((*SendResponse)(nil), "cash.z.wallet.sdk.rpc.SendResponse")
proto.RegisterType((*ChainSpec)(nil), "cash.z.wallet.sdk.rpc.ChainSpec")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -330,7 +330,7 @@ func NewCompactTxStreamerClient(cc *grpc.ClientConn) CompactTxStreamerClient {
func (c *compactTxStreamerClient) GetLatestBlock(ctx context.Context, in *ChainSpec, opts ...grpc.CallOption) (*BlockID, error) {
out := new(BlockID)
err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/GetLatestBlock", in, out, opts...)
err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock", in, out, opts...)
if err != nil {
return nil, err
}
@ -339,7 +339,7 @@ func (c *compactTxStreamerClient) GetLatestBlock(ctx context.Context, in *ChainS
func (c *compactTxStreamerClient) GetBlock(ctx context.Context, in *BlockID, opts ...grpc.CallOption) (*CompactBlock, error) {
out := new(CompactBlock)
err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/GetBlock", in, out, opts...)
err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock", in, out, opts...)
if err != nil {
return nil, err
}
@ -347,7 +347,7 @@ func (c *compactTxStreamerClient) GetBlock(ctx context.Context, in *BlockID, opt
}
func (c *compactTxStreamerClient) GetBlockRange(ctx context.Context, in *BlockRange, opts ...grpc.CallOption) (CompactTxStreamer_GetBlockRangeClient, error) {
stream, err := c.cc.NewStream(ctx, &_CompactTxStreamer_serviceDesc.Streams[0], "/rpc.CompactTxStreamer/GetBlockRange", opts...)
stream, err := c.cc.NewStream(ctx, &_CompactTxStreamer_serviceDesc.Streams[0], "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange", opts...)
if err != nil {
return nil, err
}
@ -380,7 +380,7 @@ func (x *compactTxStreamerGetBlockRangeClient) Recv() (*CompactBlock, error) {
func (c *compactTxStreamerClient) GetTransaction(ctx context.Context, in *TxFilter, opts ...grpc.CallOption) (*RawTransaction, error) {
out := new(RawTransaction)
err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/GetTransaction", in, out, opts...)
err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction", in, out, opts...)
if err != nil {
return nil, err
}
@ -389,7 +389,7 @@ func (c *compactTxStreamerClient) GetTransaction(ctx context.Context, in *TxFilt
func (c *compactTxStreamerClient) SendTransaction(ctx context.Context, in *RawTransaction, opts ...grpc.CallOption) (*SendResponse, error) {
out := new(SendResponse)
err := c.cc.Invoke(ctx, "/rpc.CompactTxStreamer/SendTransaction", in, out, opts...)
err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction", in, out, opts...)
if err != nil {
return nil, err
}
@ -419,7 +419,7 @@ func _CompactTxStreamer_GetLatestBlock_Handler(srv interface{}, ctx context.Cont
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.CompactTxStreamer/GetLatestBlock",
FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CompactTxStreamerServer).GetLatestBlock(ctx, req.(*ChainSpec))
@ -437,7 +437,7 @@ func _CompactTxStreamer_GetBlock_Handler(srv interface{}, ctx context.Context, d
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.CompactTxStreamer/GetBlock",
FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CompactTxStreamerServer).GetBlock(ctx, req.(*BlockID))
@ -476,7 +476,7 @@ func _CompactTxStreamer_GetTransaction_Handler(srv interface{}, ctx context.Cont
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.CompactTxStreamer/GetTransaction",
FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CompactTxStreamerServer).GetTransaction(ctx, req.(*TxFilter))
@ -494,7 +494,7 @@ func _CompactTxStreamer_SendTransaction_Handler(srv interface{}, ctx context.Con
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rpc.CompactTxStreamer/SendTransaction",
FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CompactTxStreamerServer).SendTransaction(ctx, req.(*RawTransaction))
@ -503,7 +503,7 @@ func _CompactTxStreamer_SendTransaction_Handler(srv interface{}, ctx context.Con
}
var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{
ServiceName: "rpc.CompactTxStreamer",
ServiceName: "cash.z.wallet.sdk.rpc.CompactTxStreamer",
HandlerType: (*CompactTxStreamerServer)(nil),
Methods: []grpc.MethodDesc{
{
@ -533,33 +533,35 @@ var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{
Metadata: "service.proto",
}
func init() { proto.RegisterFile("service.proto", fileDescriptor_service_a868da2f21e04b98) }
var fileDescriptor_service_a868da2f21e04b98 = []byte{
// 386 bytes of a g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8f, 0x36,
0xd7, 0xf4, 0x27, 0xdf, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xe7, 0x91, 0x93, 0xc0, 0x02,
0x00, 0x00,
func init() { proto.RegisterFile("service.proto", fileDescriptor_service_087f17e455cf31eb) }
var fileDescriptor_service_087f17e455cf31eb = []byte{
// 420 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x51, 0x6f, 0xd3, 0x30,
0x10, 0xc7, 0x1b, 0xda, 0x8e, 0xe5, 0x9a, 0x0d, 0x61, 0x31, 0x34, 0x45, 0x08, 0x8a, 0x01, 0x69,
0x4f, 0xd1, 0x34, 0xe0, 0x0b, 0xac, 0x88, 0x09, 0x09, 0x24, 0x70, 0xf3, 0x34, 0x1e, 0xa6, 0x9b,
0x73, 0x34, 0x61, 0xa9, 0x1d, 0xd9, 0x16, 0xab, 0xf8, 0xa0, 0x7c, 0x1e, 0x14, 0xbb, 0x1b, 0x99,
0x44, 0xd6, 0xbe, 0xf9, 0x9c, 0xdf, 0xfd, 0xff, 0x77, 0xbe, 0x0b, 0xec, 0x59, 0x32, 0xbf, 0x2a,
0x49, 0x59, 0x63, 0xb4, 0xd3, 0xec, 0x40, 0xa2, 0x2d, 0xb3, 0xdf, 0xd9, 0x35, 0xd6, 0x35, 0xb9,
0xcc, 0x16, 0x57, 0x99, 0x69, 0x64, 0x7a, 0x20, 0xf5, 0xb2, 0x41, 0xe9, 0x2e, 0x7e, 0x68, 0xb3,
0x44, 0x67, 0x03, 0xcd, 0xdf, 0xc3, 0xc3, 0xd3, 0x5a, 0xcb, 0xab, 0x4f, 0x1f, 0xd8, 0x53, 0xd8,
0x29, 0xa9, 0x5a, 0x94, 0xee, 0x30, 0x9a, 0x46, 0x47, 0x23, 0xb1, 0x8e, 0x18, 0x83, 0x51, 0x89,
0xb6, 0x3c, 0x7c, 0x30, 0x8d, 0x8e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, 0x74, 0xfa, 0xaa,
0xcf, 0x2f, 0xd4, 0xea, 0x31, 0x3e, 0x60, 0xdf, 0x61, 0xef, 0x46, 0x32, 0x2c, 0xca, 0xcb, 0xfb,
0x74, 0x3d, 0xb2, 0xa5, 0xf4, 0x71, 0xc4, 0xce, 0xfd, 0x2b, 0x74, 0x07, 0xf4, 0xa2, 0x27, 0xf5,
0x66, 0x67, 0xd2, 0x37, 0x3d, 0xc0, 0xdd, 0x41, 0xf3, 0x01, 0xbb, 0x80, 0x47, 0xed, 0x58, 0xbb,
0xe2, 0xdb, 0xe5, 0xf6, 0x96, 0xdf, 0xdd, 0x12, 0x3e, 0x38, 0x9d, 0x9c, 0xc7, 0x01, 0x30, 0x8d,
0xbc, 0xdc, 0xf1, 0xbf, 0xe2, 0xdb, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x58, 0x6c, 0xab, 0xf9,
0xc9, 0x03, 0x00, 0x00,
}

3
rpc/service.proto → walletrpc/service.proto

@ -1,5 +1,6 @@
syntax = "proto3";
package rpc;
package cash.z.wallet.sdk.rpc;
option go_package = "walletrpc";
import "compact_formats.proto";
Loading…
Cancel
Save