Skip to content

Commit

Permalink
[sky] refs #279 - May not request transaction fee in CalculatedHour
Browse files Browse the repository at this point in the history
  • Loading branch information
olemis committed Jan 8, 2020
1 parent 10b7016 commit f713d25
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/coin/skycoin/models/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ func (txn *SkycoinPendingTransaction) ComputeFee(ticker string) (uint64, error)
logCoin.Info("Computing fee for " + ticker + " ticket")
if ticker == CoinHour {
return txn.Transaction.Transaction.Fee, nil
} else if util.StringInList(ticker, txn.SupportedAssets()) {
} else if ticker == Sky {
return uint64(0), nil
} else if ticker == CalculatedHour {
return uint64(0), errors.ErrNotImplemented
}
logCoin.Errorf("Invalid ticker %v\n", ticker)
logCoin.Warningf("Invalid ticker %v\n", ticker)
return uint64(0), errors.ErrInvalidAltcoinTicker
}

Expand Down Expand Up @@ -345,10 +347,12 @@ func (skyTxn *SkycoinUninjectedTransaction) ComputeFee(ticker string) (uint64, e
logCoin.Info("Computing fee for un injected transaction with" + ticker + " ticker")
if ticker == CoinHour {
return skyTxn.fee, nil
} else if util.StringInList(ticker, skyTxn.SupportedAssets()) {
} else if ticker == Sky {
return uint64(0), nil
} else if ticker == CalculatedHour {
return uint64(0), errors.ErrNotImplemented
}
logCoin.Errorf("Invalid ticker %v\n", ticker)
logCoin.Warningf("Invalid ticker %v\n", ticker)
return uint64(0), errors.ErrInvalidAltcoinTicker
}

Expand Down Expand Up @@ -458,10 +462,12 @@ func (txn *SkycoinTransaction) ComputeFee(ticker string) (uint64, error) {
logCoin.Info("Compute fee for transaction with " + ticker + "ticker")
if ticker == CoinHour {
return txn.skyTxn.Fee, nil
} else if util.StringInList(ticker, txn.SupportedAssets()) {
} else if ticker == Sky {
return uint64(0), nil
} else if ticker == CalculatedHour {
return uint64(0), errors.ErrNotImplemented
}
logCoin.Errorf("Invalid ticker %v\n", ticker)
logCoin.Warningf("Invalid ticker %v\n", ticker)
return uint64(0), errors.ErrInvalidAltcoinTicker
}

Expand Down Expand Up @@ -966,10 +972,12 @@ func (txn *SkycoinCreatedTransaction) ComputeFee(ticker string) (uint64, error)
return uint64(0), err
}
return uint64(fee), nil
} else if util.StringInList(ticker, txn.SupportedAssets()) {
} else if ticker == Sky {
return uint64(0), nil
} else if ticker == CalculatedHour {
return uint64(0), errors.ErrNotImplemented
}
logCoin.Errorf("Invalid ticker %v\n", ticker)
logCoin.Warningf("Invalid ticker %v\n", ticker)
return uint64(0), errors.ErrInvalidAltcoinTicker
}

Expand Down

0 comments on commit f713d25

Please sign in to comment.