Skip to content

Commit

Permalink
Support empty block range end in getaddresstxids calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttycom authored and LarryRuane committed Oct 16, 2024
1 parent 9cba3e0 commit 1e63bee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type (
ZcashdRpcRequestGetaddresstxids struct {
Addresses []string `json:"addresses"`
Start uint64 `json:"start"`
End uint64 `json:"end"`
End uint64 `json:"end,omitempty"`
}

// zcashd rpc "z_gettreestate"
Expand Down
13 changes: 7 additions & 6 deletions frontend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,21 @@ func (s *lwdStreamer) GetTaddressTxids(addressBlockFilter *walletrpc.Transparent
if addressBlockFilter.Range.Start == nil {
return errors.New("must specify a start block height")
}
if addressBlockFilter.Range.End == nil {
return errors.New("must specify an end block height")
}
params := make([]json.RawMessage, 1)

request := &common.ZcashdRpcRequestGetaddresstxids{
Addresses: []string{addressBlockFilter.Address},
Start: addressBlockFilter.Range.Start.Height,
End: addressBlockFilter.Range.End.Height,
}
if addressBlockFilter.Range.End != nil {
request.End = addressBlockFilter.Range.End.Height
}

param, err := json.Marshal(request)
if err != nil {
return err
}
params[0] = param
params := []json.RawMessage{param}

result, rpcErr := common.RawRequest("getaddresstxids", params)

// For some reason, the error responses are not JSON
Expand Down

0 comments on commit 1e63bee

Please sign in to comment.