|
28 | 28 | import org.tron.common.utils.ByteArray; |
29 | 29 | import org.tron.common.utils.DialogOptional; |
30 | 30 | import org.tron.common.utils.Sha256Hash; |
| 31 | +import org.tron.common.utils.StringUtil; |
31 | 32 | import org.tron.common.utils.Time; |
32 | 33 | import org.tron.core.actuator.Actuator; |
33 | 34 | import org.tron.core.actuator.ActuatorFactory; |
@@ -507,11 +508,12 @@ public void pushBlock(final BlockCapsule block) |
507 | 508 | public void updateDynamicProperties(BlockCapsule block) { |
508 | 509 | long slot = 1; |
509 | 510 | if (block.getNum() != 1){ |
510 | | - slot = getSlotAtTime(block.getTimeStamp()); |
| 511 | + slot = witnessController.getSlotAtTime(block.getTimeStamp()); |
511 | 512 | } |
512 | 513 | for (int i = 1; i < slot; ++i){ |
513 | | - if (!getScheduledWitness(i).equals(block.getWitnessAddress())){ |
514 | | - WitnessCapsule w = this.witnessStore.get(createDbKey(getScheduledWitness(i))); |
| 514 | + if (!witnessController.getScheduledWitness(i).equals(block.getWitnessAddress())) { |
| 515 | + WitnessCapsule w = this.witnessStore |
| 516 | + .get(StringUtil.createDbKey(witnessController.getScheduledWitness(i))); |
515 | 517 | w.setTotalMissed(w.getTotalMissed()+1); |
516 | 518 | this.witnessStore.put(w.createDbKey(), w); |
517 | 519 | logger.info("{} miss a block. totalMissed = {}", |
@@ -828,7 +830,7 @@ public void updateSignedWitness(BlockCapsule block) { |
828 | 830 | .get(block.getInstance().getBlockHeader().getRawData().getWitnessAddress().toByteArray()); |
829 | 831 | witnessCapsule.setTotalProduced(witnessCapsule.getTotalProduced()+1); |
830 | 832 | witnessCapsule.setLatestBlockNum(block.getNum()); |
831 | | - witnessCapsule.setLatestSlotNum(getAbSlotAtTime(block.getTimeStamp())); |
| 833 | + witnessCapsule.setLatestSlotNum(witnessController.getAbSlotAtTime(block.getTimeStamp())); |
832 | 834 |
|
833 | 835 | this.getWitnessStore().put(witnessCapsule.getAddress().toByteArray(),witnessCapsule); |
834 | 836 |
|
|
0 commit comments