les: fixed cost table update (#19546)

This commit is contained in:
Felföldi Zsolt
2019-05-13 13:26:47 +02:00
committed by Péter Szilágyi
parent 751effa35e
commit f4fb1a1801
3 changed files with 13 additions and 8 deletions

View File

@ -346,12 +346,14 @@ func (table requestCostTable) getCost(code, amount uint64) uint64 {
}
// decode converts a cost list to a cost table
func (list RequestCostList) decode() requestCostTable {
func (list RequestCostList) decode(protocolLength uint64) requestCostTable {
table := make(requestCostTable)
for _, e := range list {
table[e.MsgCode] = &requestCosts{
baseCost: e.BaseCost,
reqCost: e.ReqCost,
if e.MsgCode < protocolLength {
table[e.MsgCode] = &requestCosts{
baseCost: e.BaseCost,
reqCost: e.ReqCost,
}
}
}
return table