Skip to content

Commit

Permalink
Merge pull request #245 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.20.2
  • Loading branch information
danil-lashin authored Apr 23, 2019
2 parents 053e9cb + cf4d7c3 commit 374cd7a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.20.2

BUG FIXES

- [api] Fix block signatures for first block

## 0.20.1

BUG FIXES
Expand Down
40 changes: 20 additions & 20 deletions api/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type BlockResponse struct {
Transactions []BlockTransactionResponse `json:"transactions"`
BlockReward *big.Int `json:"block_reward"`
Size int `json:"size"`
Proposer types.Pubkey `json:"proposer"`
Proposer types.Pubkey `json:"proposer,omitempty"`
Validators []BlockValidatorResponse `json:"validators"`
Evidence types2.EvidenceData `json:"evidence,omitempty"`
}
Expand Down Expand Up @@ -58,7 +58,7 @@ func Block(height int64) (*BlockResponse, error) {

blockResults, err := client.BlockResults(&height)
if err != nil {
return nil, rpctypes.RPCError{Code: 404, Message: "Block not found", Data: err.Error()}
return nil, rpctypes.RPCError{Code: 404, Message: "Block results not found", Data: err.Error()}
}

tmValidators, err := client.Validators(&height)
Expand All @@ -72,7 +72,6 @@ func Block(height int64) (*BlockResponse, error) {
sender, _ := tx.Sender()

tags := make(map[string]string)

for _, tag := range blockResults.Results.DeliverTx[i].Tags {
tags[string(tag.Key)] = string(tag.Value)
}
Expand Down Expand Up @@ -102,27 +101,28 @@ func Block(height int64) (*BlockResponse, error) {

validators := make([]BlockValidatorResponse, len(block.Block.LastCommit.Precommits))
proposer := types.Pubkey{}
for i, tmval := range tmValidators.Validators {
signed := false

for _, vote := range block.Block.LastCommit.Precommits {
if vote == nil {
continue
if height > 1 {
for i, tmval := range tmValidators.Validators {
signed := false
for _, vote := range block.Block.LastCommit.Precommits {
if vote == nil {
continue
}

if bytes.Equal(vote.ValidatorAddress.Bytes(), tmval.Address.Bytes()) {
signed = true
break
}
}

if bytes.Equal(vote.ValidatorAddress.Bytes(), tmval.Address.Bytes()) {
signed = true
break
validators[i] = BlockValidatorResponse{
Pubkey: fmt.Sprintf("Mp%x", tmval.PubKey.Bytes()[5:]),
Signed: signed,
}
}

validators[i] = BlockValidatorResponse{
Pubkey: fmt.Sprintf("Mp%x", tmval.PubKey.Bytes()[5:]),
Signed: signed,
}

if bytes.Equal(tmval.Address.Bytes(), block.Block.ProposerAddress.Bytes()) {
proposer = tmval.PubKey.Bytes()[5:]
if bytes.Equal(tmval.Address.Bytes(), block.Block.ProposerAddress.Bytes()) {
proposer = tmval.PubKey.Bytes()[5:]
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ package version
const (
Maj = "0"
Min = "20"
Fix = "1"
Fix = "2"

AppVer = 4
)

var (
// Must be a string because scripts like dist.sh read this file.
Version = "0.20.1"
Version = "0.20.2"

// GitCommit is the current HEAD set using ldflags.
GitCommit string
Expand Down

0 comments on commit 374cd7a

Please sign in to comment.