mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
use all fields in abci types
This commit is contained in:
parent
2897685c57
commit
2edc68c59b
@ -34,16 +34,22 @@ func (tm2pb) Header(header *Header) abci.Header {
|
|||||||
return abci.Header{
|
return abci.Header{
|
||||||
ChainID: header.ChainID,
|
ChainID: header.ChainID,
|
||||||
Height: header.Height,
|
Height: header.Height,
|
||||||
|
|
||||||
Time: header.Time.Unix(),
|
Time: header.Time.Unix(),
|
||||||
NumTxs: int32(header.NumTxs), // XXX: overflow
|
NumTxs: int32(header.NumTxs), // XXX: overflow
|
||||||
|
TotalTxs: header.NumTxs,
|
||||||
|
|
||||||
LastBlockHash: header.LastBlockID.Hash,
|
LastBlockHash: header.LastBlockID.Hash,
|
||||||
ValidatorsHash: header.ValidatorsHash,
|
ValidatorsHash: header.ValidatorsHash,
|
||||||
AppHash: header.AppHash,
|
AppHash: header.AppHash,
|
||||||
|
|
||||||
|
// Proposer: TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tm2pb) Validator(val *Validator) abci.Validator {
|
func (tm2pb) Validator(val *Validator) abci.Validator {
|
||||||
return abci.Validator{
|
return abci.Validator{
|
||||||
|
Address: val.PubKey.Address(),
|
||||||
PubKey: TM2PB.PubKey(val.PubKey),
|
PubKey: TM2PB.PubKey(val.PubKey),
|
||||||
Power: val.VotingPower,
|
Power: val.VotingPower,
|
||||||
}
|
}
|
||||||
@ -101,28 +107,24 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci.
|
|||||||
panic(val)
|
panic(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
abciEvidence := abci.Evidence{
|
|
||||||
Validator: abci.Validator{
|
|
||||||
Address: ev.Address(),
|
|
||||||
PubKey: TM2PB.PubKey(val.PubKey),
|
|
||||||
Power: val.VotingPower,
|
|
||||||
},
|
|
||||||
Height: ev.Height(),
|
|
||||||
Time: evTime.Unix(),
|
|
||||||
TotalVotingPower: valSet.TotalVotingPower(),
|
|
||||||
}
|
|
||||||
|
|
||||||
// set type
|
// set type
|
||||||
|
var evType string
|
||||||
switch ev.(type) {
|
switch ev.(type) {
|
||||||
case *DuplicateVoteEvidence:
|
case *DuplicateVoteEvidence:
|
||||||
abciEvidence.Type = ABCIEvidenceTypeDuplicateVote
|
evType = ABCIEvidenceTypeDuplicateVote
|
||||||
case *MockGoodEvidence, MockGoodEvidence:
|
case *MockGoodEvidence, MockGoodEvidence:
|
||||||
abciEvidence.Type = ABCIEvidenceTypeMockGood
|
evType = ABCIEvidenceTypeMockGood
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("Unknown evidence type: %v %v", ev, reflect.TypeOf(ev)))
|
panic(fmt.Sprintf("Unknown evidence type: %v %v", ev, reflect.TypeOf(ev)))
|
||||||
}
|
}
|
||||||
|
|
||||||
return abciEvidence
|
return abci.Evidence{
|
||||||
|
Type: evType,
|
||||||
|
Validator: TM2PB.Validator(val),
|
||||||
|
Height: ev.Height(),
|
||||||
|
Time: evTime.Unix(),
|
||||||
|
TotalVotingPower: valSet.TotalVotingPower(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tm2pb) ValidatorFromPubKeyAndPower(pubkey crypto.PubKey, power int64) abci.Validator {
|
func (tm2pb) ValidatorFromPubKeyAndPower(pubkey crypto.PubKey, power int64) abci.Validator {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user