|
1 | 1 | package bitcoin
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "math" |
5 | 4 | "math/big"
|
6 | 5 | "sync"
|
7 | 6 | "time"
|
@@ -225,19 +224,6 @@ func (l *TransactionListener) processSalePayment(txid string, output wallet.Tran
|
225 | 224 | return
|
226 | 225 | }
|
227 | 226 |
|
228 |
| - // update divisibility from contract listing |
229 |
| - if contract.VendorListings[0].Metadata.ContractType != pb.Listing_Metadata_CRYPTOCURRENCY { |
230 |
| - customDivisibility := currencyDivisibilityFromContract(l.multiwallet, contract) |
231 |
| - if customDivisibility != currencyValue.Currency.Divisibility { |
232 |
| - currencyValue.Currency.Divisibility = customDivisibility |
233 |
| - if err := currencyValue.Valid(); err != nil { |
234 |
| - log.Errorf("Invalid currency divisibility (%d) found in contract (%s): %s", customDivisibility, orderId, err.Error()) |
235 |
| - return |
236 |
| - } |
237 |
| - } |
238 |
| - } |
239 |
| - |
240 |
| - // TODO: this comparison needs to consider the possibility of different divisibilities |
241 | 227 | if funding.Cmp(currencyValue.Amount) >= 0 {
|
242 | 228 | log.Debugf("Received payment for order %s", orderId)
|
243 | 229 | funded = true
|
@@ -311,18 +297,6 @@ func (l *TransactionListener) processSalePayment(txid string, output wallet.Tran
|
311 | 297 | }
|
312 | 298 | }
|
313 | 299 |
|
314 |
| -func currencyDivisibilityFromContract(mw multiwallet.MultiWallet, contract *pb.RicardianContract) uint { |
315 |
| - var currencyDivisibility = contract.VendorListings[0].Item.PriceCurrency.Divisibility |
316 |
| - if currencyDivisibility != 0 { |
317 |
| - return uint(currencyDivisibility) |
318 |
| - } |
319 |
| - wallet, err := mw.WalletForCurrencyCode(contract.BuyerOrder.Payment.AmountCurrency.Code) |
320 |
| - if err == nil { |
321 |
| - return uint(math.Log10(float64(wallet.ExchangeRates().UnitsPerCoin()))) |
322 |
| - } |
323 |
| - return core.DefaultCurrencyDivisibility |
324 |
| -} |
325 |
| - |
326 | 300 | func (l *TransactionListener) processPurchasePayment(txid string, output wallet.TransactionOutput, contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord) {
|
327 | 301 | funding := output.Value
|
328 | 302 | for _, r := range records {
|
|
0 commit comments