-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
70 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
package com.casper.sdk.model.block; | ||
|
||
import com.casper.sdk.model.common.Digest; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.casper.sdk.model.era.EraEndV2; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* @author [email protected] | ||
*/ | ||
|
@@ -28,6 +26,4 @@ public class BlockHeaderV2 extends BlockHeader { | |
|
||
@JsonProperty("last_switch_block_hash") | ||
private Digest lastSwitchBlockHash; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.casper.sdk.model.era; | ||
|
||
import com.casper.sdk.exception.InvalidKeyBytesException; | ||
import com.casper.sdk.model.key.PublicKey; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonSetter; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.math.BigInteger; | ||
import java.security.NoSuchAlgorithmException; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author [email protected] | ||
*/ | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class EraEndV2 { | ||
|
||
private List<PublicKey> equivocators; | ||
@JsonProperty("inactive_validators") | ||
private List<PublicKey> inactiveValidators; | ||
@JsonProperty("next_era_validator_weights") | ||
private List<ValidatorWeight> nextEraValidatorWeights; | ||
@JsonProperty("rewards") | ||
private Map<PublicKey, List<BigInteger>> rewards; | ||
@JsonProperty("next_era_gas_price") | ||
private int nextEraGasPrice; | ||
|
||
@JsonSetter("rewards") | ||
public void setRewards(final Map<String, List<BigInteger>> rewards) { | ||
|
||
this.rewards = new LinkedHashMap<>(); | ||
|
||
if (rewards != null) { | ||
rewards.forEach((key, value) -> { | ||
try { | ||
// Jackson is not good at deserializing keys so we have to do it manually | ||
this.rewards.put(PublicKey.fromTaggedHexString(key), value); | ||
} catch (NoSuchAlgorithmException e) { | ||
throw new InvalidKeyBytesException(e); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters