Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. pendingBalanceBig := int64(p)
  2.  
  3. walletHistory := []store.TransactionETH{}
  4. err = restClient.userStore.GetAllWalletEthTransactions(user.UserID, wallet.CurrencyID, wallet.NetworkID, &walletHistory)
  5. for _, tx := range walletHistory {
  6. if tx.WalletIndex == wallet.WalletIndex {
  7. if (tx.Status == store.TxStatusAppearedInMempoolIncoming || tx.Status == store.TxStatusAppearedInMempoolOutcoming) && (tx.From == address.Address || tx.To == address.Address) {
  8. if tx.Status == store.TxStatusAppearedInMempoolIncoming && p == b {
  9. inTxAmount, _ := new(big.Int).SetString(tx.Amount, 10)
  10. in := inTxAmount.Int64()
  11. pendingBalanceBig += in
  12. pendingBalance = strconv.Itoa(int(pendingBalanceBig))
  13. restClient.log.Warnf("\n Incoming Wallet name %v pending fake balance %v", wallet.WalletName, pendingBalance)
  14. restClient.log.Warnf("\n Incoming node balance %v node pending balance %v", b, p)
  15. }
  16. if tx.Status == store.TxStatusAppearedInMempoolOutcoming && p == b {
  17. // oldPending := pendingBalanceBig
  18. outTxAmount, _ := new(big.Int).SetString(tx.Amount, 10)
  19. out := outTxAmount.Int64()
  20. pendingBalanceBig -= out
  21. fee := tx.GasLimit * tx.GasPrice
  22. pendingBalanceBig -= fee
  23. pendingBalance = big.NewInt(pendingBalanceBig).String()
  24. restClient.log.Warnf("\n Outcoming Wallet name %v pending fake balance %v", wallet.WalletName, pendingBalance)
  25. restClient.log.Warnf("\n Outcoming node balance %v node pending balance %v", b, p)
  26. }
  27. pending = true
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement