Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
fix: update more status code changes (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig authored Jun 1, 2020
1 parent 3489022 commit 23a2a7c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions imports/api/blocks/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ Meteor.methods({
validator.profile_url = getValidatorProfileUrl(validatorData.description.identity)
validator.operator_address = validatorData.operator_address;
validator.delegator_address = Meteor.call('getDelegator', validatorData.operator_address);
validator.jailed = validatorData.jailed;
validator.jailed = !!validatorData.jailed;
validator.status = validatorData.status;
validator.min_self_delegation = validatorData.min_self_delegation;
validator.tokens = validatorData.tokens;
Expand Down Expand Up @@ -427,7 +427,7 @@ Meteor.methods({
if (validatorData){
if (validatorData.description && (!valExist.description || validatorData.description.identity !== valExist.description.identity))
validator.profile_url = getValidatorProfileUrl(validatorData.description.identity)
validator.jailed = validatorData.jailed;
validator.jailed = !!validatorData.jailed;
validator.status = validatorData.status;
validator.tokens = validatorData.tokens;
validator.delegator_shares = validatorData.delegator_shares;
Expand Down Expand Up @@ -521,7 +521,7 @@ Meteor.methods({
Object.keys(validatorSet).forEach((conPubKey) => {
let validatorData = validatorSet[conPubKey];
// Active validators should have been updated in previous steps
if (validatorData.status === 2)
if (validatorData.status === 3)
return

if (dbValidators[conPubKey] == undefined) {
Expand Down Expand Up @@ -621,7 +621,7 @@ Meteor.methods({

if (height % 60 == 1){
console.log("===== calculate voting power distribution =====");
let activeValidators = Validators.find({status:2,jailed:false},{sort:{voting_power:-1}}).fetch();
let activeValidators = Validators.find({status:3,jailed:false},{sort:{voting_power:-1}}).fetch();
let numTopTwenty = Math.ceil(activeValidators.length*0.2);
let numBottomEighty = activeValidators.length - numTopTwenty;

Expand Down
2 changes: 1 addition & 1 deletion imports/api/chain/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Meteor.methods({
delegator_address: msg[m].value.delegator_address,
voting_power: Math.floor(parseInt(msg[m].value.value.amount) / Coin.StakingCoin.fraction),
jailed: false,
status: 2
status: 3
}

totalVotingPower += validator.voting_power;
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/components/AccountTooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class AccountTooltip extends Account{
return
let validator = this.state.validator;
let moniker = validator.description && validator.description.moniker || validator.address;
let isActive = validator.status == 2 && !validator.jailed;
let isActive = validator.status == 3 && !validator.jailed;

return <UncontrolledPopover className='validator-popover' trigger="hover" placement="right" target={this.ref}>
<Card className='validator-popover-card' body outline color="danger">
Expand Down Expand Up @@ -77,7 +77,7 @@ export default class AccountTooltip extends Account{
(validator.unbonding_time?<TimeStamp time={validator.unbonding_time}/>:null)}
</CardText>:null}
{(!isActive)?<CardText className="bond-status data" xs={2}>
<Col xs={6}>{(validator.status == 0)?<Badge color="secondary">Unbonded</Badge>:<Badge color="warning">Unbonding</Badge>}</Col>
<Col xs={6}>{(validator.status == 1)?<Badge color="secondary">Unbonded</Badge>:<Badge color="warning">Unbonding</Badge>}</Col>
<Col xs={6}>{validator.jailed?<Badge color="danger">Jailed</Badge>:''}</Col>
</CardText>:null}
{(isActive)?<CardText className="uptime data">
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/ledger/LedgerActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ return <span><CoinAmount mint className='gas' amount={props.gas * Meteor.setting
}

const isActiveValidator = (validator) => {
return !validator.jailed && validator.status == 2;
return !validator.jailed && validator.status == 3;
}

const isBetween = (value, min, max) => {
Expand Down Expand Up @@ -511,7 +511,7 @@ class LedgerButton extends Component {

getValidatorOptions = () => {
let activeValidators = Validators.find(
{"jailed": false, "status": 2},
{"jailed": false, "status": 3},
{"sort":{"description.moniker":1}}
);
let redelegations = this.state.redelegations || {};
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/validators/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ValidatorRow = (props) => {
{(!props.inactive)?<Col className="commission data" xs={{size:4}} md={{size:1,offset:0}} lg={2}><i className="material-icons d-sm-none">call_split</i> <span>{props.validator.commission.commission_rates?numbro(props.validator.commission.commission_rates.rate).format('0.00%'):''}</span></Col>:''}
{(!props.inactive)?<Col className="uptime data" xs={{size:2,order:"last"}} md={2}><Progress animated value={props.validator.uptime}><span className="d-none d-md-inline">{props.validator.uptime?props.validator.uptime.toFixed(2):0}%</span><span className="d-md-none">&nbsp;</span></Progress></Col>:''}
{(props.inactive)?<Col className="last-seen data" xs={{size:10,offset:2}}md={{size:3, offset:0}}>{props.validator.lastSeen?<TimeStamp time={props.validator.lastSeen}/>:''}</Col>:''}
{(props.inactive)?<Col className="bond-status data" xs={2} md={1}>{(props.validator.status == 0)?<Badge color="secondary"><span>U<span className="d-none d-md-inline">nbonded</span></span></Badge>:<Badge color="warning"><span>U<span className="d-none d-md-inline">nbonding</span></span></Badge>}</Col>:''}
{(props.inactive)?<Col className="bond-status data" xs={2} md={1}>{(props.validator.status == 1)?<Badge color="secondary"><span>U<span className="d-none d-md-inline">nbonded</span></span></Badge>:<Badge color="warning"><span>U<span className="d-none d-md-inline">nbonding</span></span></Badge>}</Col>:''}
{(props.inactive)?<Col className="jail-status data" xs={2} md={1}>{props.validator.jailed?<Badge color="danger"><span>J<span className="d-none d-md-inline">ailed</span></span></Badge>:''}</Col>:''}
</Row></SentryBoundary>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/validators/ListContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default ValidatorListContainer = withTracker((props) => {
}
else{
validatorsCond = {
// jailed: false,
jailed: false,
status: 3
}
}
Expand Down

0 comments on commit 23a2a7c

Please sign in to comment.