* Use best block for default in /get-hash-rate
* minor
}
func (a *API) getHashRate(ins BlockReq) Response {
- if len(ins.BlockHash) != 32 && ins.BlockHeight == 0 {
- err := errors.New("Request format error.")
+ if len(ins.BlockHash) != 32 && len(ins.BlockHash) != 0 {
+ err := errors.New("Block hash format error.")
return NewErrorResponse(err)
}
+ if ins.BlockHeight == 0 {
+ ins.BlockHeight = a.chain.BestBlockHeight()
+ }
block, err := a.getBlockHelper(ins)
if err != nil {
Timestamp uint64 `json:"timestamp"` // The time of the block in seconds.
Nonce uint64 `json:"nonce"` // Nonce used to generate the block.
Bits uint64 `json:"bits"` // Difficulty target for the block.
- BlockCommitment *types.BlockCommitment `json:"block_commitment"` //Block commitment
+ BlockCommitment *types.BlockCommitment `json:"block_commitment"` // Block commitment
}
type CoinbaseArbitrary struct {