Skip to content

Commit

Permalink
Merge pull request #244 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.20.1
  • Loading branch information
danil-lashin authored Apr 23, 2019
2 parents 1b5df2b + 5455bbb commit 053e9cb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 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.1

BUG FIXES

- [api] Fix current blocks signatures

## 0.20.0

IMPROVEMENT
Expand Down
22 changes: 9 additions & 13 deletions api/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ func Block(height int64) (*BlockResponse, error) {
if err != nil {
return nil, rpctypes.RPCError{Code: 404, Message: "Block not found", Data: err.Error()}
}

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

tmValidators, err := client.Validators(&height)
if err != nil {
return nil, rpctypes.RPCError{Code: 404, Message: "Validators for block not found", Data: err.Error()}
}

txs := make([]BlockTransactionResponse, len(block.Block.Data.Txs))
for i, rawTx := range block.Block.Data.Txs {
tx, _ := transaction.TxDecoder.DecodeFromBytes(rawTx)
Expand Down Expand Up @@ -94,22 +100,12 @@ func Block(height int64) (*BlockResponse, error) {
}
}

tmValidators, err := client.Validators(&height)
if err != nil {
return nil, rpctypes.RPCError{Code: 404, Message: "Validators for block not found", Data: err.Error()}
}

commit, err := client.Commit(&height)
if err != nil {
return nil, rpctypes.RPCError{Code: 404, Message: "Commit for block not found", Data: err.Error()}
}

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

for _, vote := range commit.Commit.Precommits {
for _, vote := range block.Block.LastCommit.Precommits {
if vote == nil {
continue
}
Expand All @@ -125,7 +121,7 @@ func Block(height int64) (*BlockResponse, error) {
Signed: signed,
}

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

0 comments on commit 053e9cb

Please sign in to comment.