Skip to content

Commit 5886ae7

Browse files
committed
fix from comments
1 parent 86e28d5 commit 5886ae7

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

x/feeds/types/median.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ func CalculateMedianPriceFeedInfo(priceFeedInfos []PriceFeedInfo) (uint64, error
109109
}
110110
wps = append(
111111
wps,
112-
WeightedPrice{
113-
Price: priceFeedInfo.Price,
114-
Power: totalWeight,
115-
},
112+
NewWeightedPrice(
113+
priceFeedInfo.Price,
114+
totalWeight,
115+
),
116116
)
117117
}
118118

@@ -125,6 +125,14 @@ type WeightedPrice struct {
125125
Price uint64 // Price represents the price
126126
}
127127

128+
// NewWeightedPrice returns a new WeightedPrice
129+
func NewWeightedPrice(power uint64, price uint64) WeightedPrice {
130+
return WeightedPrice{
131+
Power: power,
132+
Price: price,
133+
}
134+
}
135+
128136
// CalculateMedianWeightedPrice calculates the median of weighted prices
129137
func CalculateMedianWeightedPrice(wps []WeightedPrice) (uint64, error) {
130138
sort.Slice(wps, func(i, j int) bool {

x/feeds/types/msgs.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ func (m *MsgSubmitSignalPrices) GetSigners() []sdk.AccAddress {
4444

4545
// ValidateBasic does a check on the provided data.
4646
func (m *MsgSubmitSignalPrices) ValidateBasic() error {
47-
_, err := sdk.ValAddressFromBech32(m.Validator)
48-
if err != nil {
47+
if _, err := sdk.ValAddressFromBech32(m.Validator); err != nil {
4948
return err
5049
}
5150

0 commit comments

Comments
 (0)