Skip to content

Commit ab4c0fe

Browse files
Steven SmithLarryRuane
authored andcommitted
Add support to GetTreeState to return Orchard final state
1 parent 6878935 commit ab4c0fe

File tree

7 files changed

+397
-141
lines changed

7 files changed

+397
-141
lines changed

common/common.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ type (
112112
}
113113
SkipHash string
114114
}
115+
Orchard struct {
116+
Commitments struct {
117+
FinalState string
118+
}
119+
SkipHash string
120+
}
115121
}
116122

117123
// zcashd rpc "getrawtransaction txid 1" (1 means verbose), there are

docs/rtd/index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ <h3 id="cash.z.wallet.sdk.rpc.TreeState">TreeState</h3>
14961496
<td>height</td>
14971497
<td><a href="#uint64">uint64</a></td>
14981498
<td></td>
1499-
<td><p> </p></td>
1499+
<td><p>block height </p></td>
15001500
</tr>
15011501

15021502
<tr>
@@ -1514,12 +1514,19 @@ <h3 id="cash.z.wallet.sdk.rpc.TreeState">TreeState</h3>
15141514
</tr>
15151515

15161516
<tr>
1517-
<td>tree</td>
1517+
<td>saplingTree</td>
15181518
<td><a href="#string">string</a></td>
15191519
<td></td>
15201520
<td><p>sapling commitment tree state </p></td>
15211521
</tr>
15221522

1523+
<tr>
1524+
<td>orchardTree</td>
1525+
<td><a href="#string">string</a></td>
1526+
<td></td>
1527+
<td><p>orchard commitment tree state </p></td>
1528+
</tr>
1529+
15231530
</tbody>
15241531
</table>
15251532

frontend/service.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,12 @@ func (s *lwdStreamer) GetTreeState(ctx context.Context, id *walletrpc.BlockID) (
223223
return nil, errors.New("zcashd did not return treestate")
224224
}
225225
return &walletrpc.TreeState{
226-
Network: s.chainName,
227-
Height: uint64(gettreestateReply.Height),
228-
Hash: gettreestateReply.Hash,
229-
Time: gettreestateReply.Time,
230-
Tree: gettreestateReply.Sapling.Commitments.FinalState,
226+
Network: s.chainName,
227+
Height: uint64(gettreestateReply.Height),
228+
Hash: gettreestateReply.Hash,
229+
Time: gettreestateReply.Time,
230+
SaplingTree: gettreestateReply.Sapling.Commitments.FinalState,
231+
OrchardTree: gettreestateReply.Orchard.Commitments.FinalState,
231232
}, nil
232233
}
233234

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.12
44

55
require (
66
github.com/btcsuite/btcd v0.20.1-beta
7+
github.com/fullstorydev/grpcurl v1.8.6 // indirect
78
github.com/golang/protobuf v1.5.2
89
github.com/gopherjs/gopherjs v0.0.0-20191106031601-ce3c9ade29de // indirect
910
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
@@ -17,13 +18,11 @@ require (
1718
github.com/spf13/afero v1.5.1 // indirect
1819
github.com/spf13/cobra v0.0.6
1920
github.com/spf13/viper v1.6.2
20-
github.com/stretchr/testify v1.6.1 // indirect
2121
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
2222
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
2323
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect
24-
golang.org/x/text v0.3.6 // indirect
2524
google.golang.org/genproto v0.0.0-20210406143921-e86de6bf7a46 // indirect
26-
google.golang.org/grpc v1.37.0
25+
google.golang.org/grpc v1.44.0
2726
google.golang.org/protobuf v1.27.1
2827
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2928
gopkg.in/ini.v1 v1.51.0

go.sum

Lines changed: 231 additions & 0 deletions
Large diffs are not rendered by default.

walletrpc/service.pb.go

Lines changed: 137 additions & 126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

walletrpc/service.proto

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,12 @@ message Exclude {
110110

111111
// The TreeState is derived from the Zcash z_gettreestate rpc.
112112
message TreeState {
113-
string network = 1; // "main" or "test"
114-
uint64 height = 2;
115-
string hash = 3; // block id
116-
uint32 time = 4; // Unix epoch time when the block was mined
117-
string tree = 5; // sapling commitment tree state
113+
string network = 1; // "main" or "test"
114+
uint64 height = 2; // block height
115+
string hash = 3; // block id
116+
uint32 time = 4; // Unix epoch time when the block was mined
117+
string saplingTree = 5; // sapling commitment tree state
118+
string orchardTree = 6; // orchard commitment tree state
118119
}
119120

120121
// Results are sorted by height, which makes it easy to issue another

0 commit comments

Comments
 (0)