goat-systems / go-tezos

Go Tezos Is a Go library that exposes and builds upon the Tezos RPC.
MIT License
71 stars 45 forks source link

ContractDelegate Incorrectly Errors When No Delegate Is Set #187

Open utdrmac opened 3 years ago

utdrmac commented 3 years ago

Use rpc.ContractDelegate() to fetch the delegate address of a delegator, or baker (to check if baker is registered to bake). In the case of no baker set, or not registered to bake, the RPC context/contracts/%s/delegate returns 404. The JSON Unmarshal attempts to unmarshal a non-existent response body which fails as error.

This is a false-negative and the function overall should succeed and return "" when no delegate is set.