Skip to content

Commit

Permalink
Merge branch 'master' into verifySeed
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsands authored Jul 30, 2019
2 parents 6fe3255 + dd2c906 commit 314ee95
Show file tree
Hide file tree
Showing 34 changed files with 1,671 additions and 1,036 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dcrwallet
vendor
*~
.vscode
.idea
rpc/tools/bin/
46 changes: 42 additions & 4 deletions chain/backendwrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package chain
import (
"context"
"encoding/hex"
"encoding/json"
"strings"

"github.com/decred/dcrd/chaincfg/chainhash"
Expand Down Expand Up @@ -92,12 +93,31 @@ func (b *rpcBackend) GetCFilters(ctx context.Context, blockHashes []*chainhash.H
func (b *rpcBackend) GetHeaders(ctx context.Context, blockLocators []*chainhash.Hash, hashStop *chainhash.Hash) ([]*wire.BlockHeader, error) {
const op errors.Op = "dcrd.jsonrpc.getheaders"

r, err := b.rpcClient.GetHeaders(blockLocators, hashStop)
locatorStrings := make([]string, len(blockLocators))
for i := range blockLocators {
locatorStrings[i] = blockLocators[i].String()
}
param0, err := json.Marshal(locatorStrings)
if err != nil {
return nil, errors.E(op, errors.Encoding, err)
}
param1, err := json.Marshal(hashStop.String())
if err != nil {
return nil, errors.E(op, errors.Encoding, err)
}
result, err := b.rpcClient.RawRequest("getheaders", []json.RawMessage{param0, param1})
if err != nil {
return nil, errors.E(op, err)
}
headers := make([]*wire.BlockHeader, 0, len(r.Headers))
for _, hexHeader := range r.Headers {
var headersMsg struct {
Headers []string `json:"headers"`
}
err = json.Unmarshal(result, &headersMsg)
if err != nil {
return nil, errors.E(op, errors.Encoding, err)
}
headers := make([]*wire.BlockHeader, 0, len(headersMsg.Headers))
for _, hexHeader := range headersMsg.Headers {
header := new(wire.BlockHeader)
err := header.Deserialize(hex.NewDecoder(strings.NewReader(hexHeader)))
if err != nil {
Expand Down Expand Up @@ -148,10 +168,28 @@ func (b *rpcBackend) PublishTransactions(ctx context.Context, txs ...*wire.MsgTx
func (b *rpcBackend) Rescan(ctx context.Context, blocks []chainhash.Hash, r wallet.RescanSaver) error {
const op errors.Op = "dcrd.jsonrpc.rescan"

res, err := b.rpcClient.Rescan(blocks)
blockStrings := make([]string, len(blocks))
for i := range blocks {
blockStrings[i] = blocks[i].String()
}
param0, err := json.Marshal(blockStrings)
if err != nil {
return errors.E(op, errors.Encoding, err)
}
result, err := b.rpcClient.RawRequest("rescan", []json.RawMessage{param0})
if err != nil {
return errors.E(op, err)
}
var res struct {
DiscoveredData []struct {
Hash string `json:"hash"`
Transactions []string `json:"transactions"`
} `json:"discovereddata"`
}
err = json.Unmarshal(result, &res)
if err != nil {
return errors.E(op, errors.Encoding, err)
}
for _, d := range res.DiscoveredData {
blockHash, err := chainhash.NewHashFromStr(d.Hash)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/decred/dcrwallet/errors"
)

var requiredChainServerAPI = semver{major: 5, minor: 0, patch: 0}
var requiredChainServerAPI = semver{major: 6, minor: 0, patch: 0}

// RPCClient represents a persistent client connection to a decred RPC server
// for information regarding the current best block chain.
Expand Down
23 changes: 22 additions & 1 deletion chain/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"strings"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -450,10 +451,30 @@ func (s *RPCSyncer) startupSync(ctx context.Context) error {
}
var headers []*wire.BlockHeader
err := ctxdo(ctx, "dcrd.jsonrpc.getheaders", func() error {
headersMsg, err := s.rpcClient.GetHeaders(locators, &hashStop)
locatorStrings := make([]string, len(locators))
for i := range locators {
locatorStrings[i] = locators[i].String()
}
param0, err := json.Marshal(locatorStrings)
if err != nil {
return err
}
param1, err := json.Marshal(hashStop.String())
if err != nil {
return err
}
result, err := s.rpcClient.RawRequest("getheaders", []json.RawMessage{param0, param1})
if err != nil {
return err
}
var headersMsg struct {
Headers []string `json:"headers"`
}
err = json.Unmarshal(result, &headersMsg)
if err != nil {
return err
}

headers = make([]*wire.BlockHeader, 0, len(headersMsg.Headers))
for _, h := range headersMsg.Headers {
header := new(wire.BlockHeader)
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ require (
github.com/decred/dcrd/blockchain v1.1.1
github.com/decred/dcrd/blockchain/stake v1.1.0
github.com/decred/dcrd/certgen v1.1.0
github.com/decred/dcrd/chaincfg v1.5.1
github.com/decred/dcrd/chaincfg v1.5.2
github.com/decred/dcrd/chaincfg/chainhash v1.0.1
github.com/decred/dcrd/connmgr v1.0.2
github.com/decred/dcrd/dcrec v1.0.0
github.com/decred/dcrd/dcrjson/v2 v2.0.0
github.com/decred/dcrd/dcrjson/v2 v2.2.0
github.com/decred/dcrd/dcrjson/v3 v3.0.0
github.com/decred/dcrd/dcrutil v1.2.0
github.com/decred/dcrd/hdkeychain v1.1.1
github.com/decred/dcrd/hdkeychain/v2 v2.0.0
github.com/decred/dcrd/rpc/jsonrpc/types v1.0.0
github.com/decred/dcrd/rpcclient/v2 v2.0.0
github.com/decred/dcrd/txscript v1.0.2
github.com/decred/dcrd/wire v1.2.0
Expand All @@ -35,7 +37,7 @@ require (
github.com/jessevdk/go-flags v1.4.0
github.com/jrick/logrotate v1.0.0
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576
google.golang.org/grpc v1.21.1
google.golang.org/grpc v1.22.0
)

replace (
Expand Down
41 changes: 26 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ github.com/dchest/siphash v1.2.1 h1:4cLinnzVJDKxTCl9B01807Yiy+W7ZzVHj/KIroQRvT4=
github.com/dchest/siphash v1.2.1/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4=
github.com/decred/base58 v1.0.0 h1:BVi1FQCThIjZ0ehG+I99NJ51o0xcc9A/fDKhmJxY6+w=
github.com/decred/base58 v1.0.0/go.mod h1:LLY1p5e3g91byL/UO1eiZaYd+uRoVRarybgcoymu9Ks=
github.com/decred/dcrd v1.3.0 h1:EEXm7BdiROfazDtuFsOu9mfotnyy00bgCuVwUqaszFo=
github.com/decred/dcrd/addrmgr v1.0.2 h1:BfJoFEkdDDhaQSsx9NkVOTiOTUbEevbVf+aYRQSIAmU=
github.com/decred/dcrd/addrmgr v1.0.2/go.mod h1:gNnmTuf/Xkg8ZX3j5GXbajzPrSdf5bA7HitO2bjmq0Q=
github.com/decred/dcrd/blockchain v1.0.1 h1:7cviDS26sZ9ZyTFka3aC9C/EChXBslmAvse+4nF5d60=
Expand All @@ -45,6 +46,8 @@ github.com/decred/dcrd/chaincfg v1.4.0 h1:dIJhXQooiVW5AVZ0c4brylsiwkc8KSawpZ3NPq
github.com/decred/dcrd/chaincfg v1.4.0/go.mod h1:ypuM30F+XgZmZTFfAkWHWd0lwwkWWAOAQYNRkRDlYLc=
github.com/decred/dcrd/chaincfg v1.5.1 h1:u1Xbq0VTnAXIHW5ECqrWe0VYSgf5vWHqpSiwoLBzxAQ=
github.com/decred/dcrd/chaincfg v1.5.1/go.mod h1:FukMzTjkwzjPU+hK7CqDMQe3NMbSZAYU5PAcsx1wlv0=
github.com/decred/dcrd/chaincfg v1.5.2 h1:dd6l9rqcpxg2GF5neBmE2XxRc5Lqda45fWmN4XOJRW8=
github.com/decred/dcrd/chaincfg v1.5.2/go.mod h1:FukMzTjkwzjPU+hK7CqDMQe3NMbSZAYU5PAcsx1wlv0=
github.com/decred/dcrd/chaincfg/chainhash v1.0.1 h1:0vG7U9+dSjSCaHQKdoSKURK2pOb47+b+8FK5q4+Je7M=
github.com/decred/dcrd/chaincfg/chainhash v1.0.1/go.mod h1:OVfvaOsNLS/A1y4Eod0Ip/Lf8qga7VXCQjUQLbkY0Go=
github.com/decred/dcrd/connmgr v1.0.2 h1:ipHJBV9fmhLi8ZZCtsNpG+kLY2c+yu59/8oOkA8BNJY=
Expand Down Expand Up @@ -78,8 +81,13 @@ github.com/decred/dcrd/dcrec/secp256k1 v1.0.1 h1:EFWVd1p0t0Y5tnsm/dJujgV0ORogRJ6
github.com/decred/dcrd/dcrec/secp256k1 v1.0.1/go.mod h1:lhu4eZFSfTJWUnR3CFRcpD+Vta0KUAqnhTsTksHXgy0=
github.com/decred/dcrd/dcrjson v1.0.0 h1:50DnA0XeV2JrQXoHh43TCKmH+kz2gHjZ1Mj/Pdk7Oz0=
github.com/decred/dcrd/dcrjson v1.0.0/go.mod h1:ozddIaeF+EAvZZvFuB3zpfxhyxBGfvbt22crQh+PYuI=
github.com/decred/dcrd/dcrjson v1.2.0 h1:3BFFQHq3/YO/zae9WLxQkXsX6AXKx3+M8H3yk4oXZi0=
github.com/decred/dcrd/dcrjson/v2 v2.0.0 h1:W0q4Alh36c5N318eUpfmU8kXoCNgImMLI87NIXni9Us=
github.com/decred/dcrd/dcrjson/v2 v2.0.0/go.mod h1:FYueNy8BREAFq04YNEwcTsmGFcNqY+ehUUO81w2igi4=
github.com/decred/dcrd/dcrjson/v2 v2.2.0 h1:u0ON3IZ8/fqoA624HPNBsWYjIgBtC82DGMtq35bthhI=
github.com/decred/dcrd/dcrjson/v2 v2.2.0/go.mod h1:/vbjikqJR0MVih59iOMtPjRyN5lVRDzJHHfqzHAln2Y=
github.com/decred/dcrd/dcrjson/v3 v3.0.0 h1:yDrNFvyn2l/557iZHB236jTqQjAmhZnVaFgMb2vm0UM=
github.com/decred/dcrd/dcrjson/v3 v3.0.0/go.mod h1:pWYlHJ3VFidPwqD5HHiJXjfGaplif8uspAL2qFdifkY=
github.com/decred/dcrd/dcrutil v1.1.1 h1:zOkGiumN/JkobhAgpG/zfFgUoolGKVGYT5na1hbYUoE=
github.com/decred/dcrd/dcrutil v1.1.1/go.mod h1:Jsttr0pEvzPAw+qay1kS1/PsbZYPyhluiNwwY6yBJS4=
github.com/decred/dcrd/dcrutil v1.2.0 h1:Pd5Wf650g6Xu6luYDfGkh1yiUoPUAgqzRu6K+BGyJGg=
Expand All @@ -96,6 +104,8 @@ github.com/decred/dcrd/mempool/v2 v2.0.0 h1:QoQC5Lri311unqCr/PejBEwNERWMSWtnSa7b
github.com/decred/dcrd/mempool/v2 v2.0.0/go.mod h1:/AH0mFOKCglSdEDubF3oRDbWUmDj26gwnrIlFsr+lbM=
github.com/decred/dcrd/mining v1.1.0 h1:9Wtla+i+pEjfYsNCfixsipmyyoB26DgL4LSXWAin/zw=
github.com/decred/dcrd/mining v1.1.0/go.mod h1:NQEtX604XgNwKcPFId1hVTTiBqmVQDlnqV1yNqGl4oU=
github.com/decred/dcrd/rpc/jsonrpc/types v1.0.0 h1:d5ptnjuSADTQMa3i83VpeJNoMRTOJZZBqk7P+E41VXM=
github.com/decred/dcrd/rpc/jsonrpc/types v1.0.0/go.mod h1:0dwmpIP21tJxjg/UuUHWIFMbfoLv2ifCBMokNKlOxpo=
github.com/decred/dcrd/rpcclient/v2 v2.0.0 h1:Zy9twdEaOGUdCj/89LAs/IrStm6FcabxzBve4UsA73A=
github.com/decred/dcrd/rpcclient/v2 v2.0.0/go.mod h1:9XjbRHBSNqN+DXz8I47gUZszvVjvugqLGK8TZQ4c/u0=
github.com/decred/dcrd/txscript v1.0.1 h1:IMgxZFCw3AyG4EbKwywE3SDNshOSHsoUK1Wk/5GqWJ0=
Expand Down Expand Up @@ -127,8 +137,8 @@ github.com/golang/protobuf v1.1.0 h1:0iH4Ffd/meGoXqF2lSAhZHt8X+cPgkfn/cb6Cce5Vpc
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
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/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
Expand All @@ -138,9 +148,16 @@ github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGAR
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jrick/bitset v1.0.0 h1:Ws0PXV3PwXqWK2n7Vz6idCdrV/9OrBXgHEJi27ZB9Dw=
github.com/jrick/bitset v1.0.0/go.mod h1:ZOYB5Uvkla7wIEY4FEssPVi3IQXa02arznRaYaAEPe4=
github.com/jrick/btcd/dcrjson/v2 v2.0.0-20190712210503-292c1e5e80ac h1:2vTh3IBLNrz5hsSpL8ADkxaIRSU8UW64wqUC0wmADtc=
github.com/jrick/btcd/dcrjson/v2 v2.0.0-20190712210503-292c1e5e80ac/go.mod h1:JwKNPWI2B+oMTtj4zv5ale8682i99PF+ETEydAGdQIg=
github.com/jrick/btcd/dcrjson/v3 v3.0.0-20190711163540-0c004bf518d0 h1:UQrfwOHt1NCeZlsAGKw3eBdcGs+wBBSxpumvOpMwJeg=
github.com/jrick/btcd/dcrjson/v3 v3.0.0-20190711163540-0c004bf518d0/go.mod h1:pWYlHJ3VFidPwqD5HHiJXjfGaplif8uspAL2qFdifkY=
github.com/jrick/btcd/dcrjson/v3 v3.0.0-20190715142707-3cb493ab8e1b h1:RGeZOjBdmDwch9oug6Uvi4kW6RXKQvxBeZQcoPINmFg=
github.com/jrick/btcd/dcrjson/v3 v3.0.0-20190715142707-3cb493ab8e1b/go.mod h1:pWYlHJ3VFidPwqD5HHiJXjfGaplif8uspAL2qFdifkY=
github.com/jrick/btcd/rpc/jsonrpc/types v0.0.0-20190711163540-0c004bf518d0 h1:Fa07+yCdWWysRLEeAJwhlt3Rse/yj6LJ63p8s4Q1kJo=
github.com/jrick/btcd/rpc/jsonrpc/types v0.0.0-20190711163540-0c004bf518d0/go.mod h1:Dl5M4hBL2F6/CNtE7CpjRtX7ChnGgpsWXTn6EdL1Khs=
github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand All @@ -163,15 +180,11 @@ golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576 h1:aUX/1G2gFSs4AsJJg2cL3HuoRhCSCz733FE5GUSuaT4=
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180808004115-f9ce57c11b24 h1:mEsFm194MmS9vCwxFy+zwu0EU7ZkxxMD1iH++vmGdUY=
golang.org/x/net v0.0.0-20180808004115-f9ce57c11b24/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
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-20181207154023-610586996380 h1:zPQexyRtNYBc7bcHmehl1dH6TB3qn8zytv8cBGLDNY0=
golang.org/x/net v0.0.0-20181207154023-610586996380/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 h1:ulvT7fqt0yHWzpJwI57MezWnYDVpCAYBVuYst/L+fAY=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
Expand All @@ -183,8 +196,9 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTm
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181212120007-b05ddf57801d h1:G59MrP9Qg6bymPjN3yGmqnmuCEH1h0eFP8zpRpl1RiU=
Expand All @@ -195,15 +209,13 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/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=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
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=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
Expand All @@ -216,5 +228,4 @@ gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
12 changes: 8 additions & 4 deletions internal/rpchelp/genrpcserverhelp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ import (
"os"
"strings"

"github.com/decred/dcrd/dcrjson/v2"
"github.com/decred/dcrd/dcrjson/v3"
"github.com/decred/dcrwallet/internal/rpchelp"
_ "github.com/decred/dcrwallet/rpc/jsonrpc/types"
"github.com/decred/dcrwallet/rpc/jsonrpc/types"
)

func init() {
log.SetFlags(log.Lshortfile | log.LstdFlags)
}

var outputFile = func() *os.File {
fi, err := os.Create("rpcserverhelp.go")
if err != nil {
Expand All @@ -43,7 +47,7 @@ func writeLocaleHelp(locale, goLocale string, descs map[string]string) {
writefln("return map[string]string{")
for i := range rpchelp.Methods {
m := &rpchelp.Methods[i]
helpText, err := dcrjson.GenerateHelp(m.Method, descs, m.ResultTypes...)
helpText, err := dcrjson.GenerateHelp(types.Method(m.Method), descs, m.ResultTypes...)
if err != nil {
log.Fatal(err)
}
Expand All @@ -65,7 +69,7 @@ func writeUsage() {
usageStrs := make([]string, len(rpchelp.Methods))
var err error
for i := range rpchelp.Methods {
usageStrs[i], err = dcrjson.MethodUsageText(rpchelp.Methods[i].Method)
usageStrs[i], err = dcrjson.MethodUsageText(types.Method(rpchelp.Methods[i].Method))
if err != nil {
log.Fatal(err)
}
Expand Down
Loading

0 comments on commit 314ee95

Please sign in to comment.