update occurences of get_history
This commit is contained in:
@@ -323,10 +323,10 @@ settings_layout = make_layout(""" <ListView
|
|||||||
|
|
||||||
def get_history_values(n):
|
def get_history_values(n):
|
||||||
values = []
|
values = []
|
||||||
h = wallet.get_tx_history()
|
h = wallet.get_history()
|
||||||
length = min(n, len(h))
|
length = min(n, len(h))
|
||||||
for i in range(length):
|
for i in range(length):
|
||||||
tx_hash, conf, is_mine, value, fee, balance, timestamp = h[-i-1]
|
tx_hash, conf, value, timestamp, balance = h[-i-1]
|
||||||
try:
|
try:
|
||||||
dt = datetime.datetime.fromtimestamp( timestamp )
|
dt = datetime.datetime.fromtimestamp( timestamp )
|
||||||
if dt.date() == dt.today().date():
|
if dt.date() == dt.today().date():
|
||||||
@@ -338,7 +338,7 @@ def get_history_values(n):
|
|||||||
conf_str = 'v' if conf else 'o'
|
conf_str = 'v' if conf else 'o'
|
||||||
label, is_default_label = wallet.get_label(tx_hash)
|
label, is_default_label = wallet.get_label(tx_hash)
|
||||||
label = label.replace('<','').replace('>','')
|
label = label.replace('<','').replace('>','')
|
||||||
values.append((conf_str, ' ' + time_str, ' ' + format_satoshis(value,True), ' ' + label))
|
values.append((conf_str, ' ' + time_str, ' ' + format_satoshis(value, True), ' ' + label))
|
||||||
|
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|||||||
@@ -1171,7 +1171,7 @@ class ElectrumWindow:
|
|||||||
self.history_list.clear()
|
self.history_list.clear()
|
||||||
|
|
||||||
for item in self.wallet.get_history():
|
for item in self.wallet.get_history():
|
||||||
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
tx_hash, conf, value, timestamp, balance = item
|
||||||
if conf > 0:
|
if conf > 0:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
@@ -1199,6 +1199,7 @@ class ElectrumWindow:
|
|||||||
import datetime
|
import datetime
|
||||||
if not tx_hash: return ''
|
if not tx_hash: return ''
|
||||||
tx = self.wallet.transactions.get(tx_hash)
|
tx = self.wallet.transactions.get(tx_hash)
|
||||||
|
tx.deserialize()
|
||||||
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
|
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
|
||||||
conf, timestamp = self.wallet.verifier.get_confirmations(tx_hash)
|
conf, timestamp = self.wallet.verifier.get_confirmations(tx_hash)
|
||||||
|
|
||||||
|
|||||||
@@ -702,15 +702,8 @@ class ElectrumWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
icon = QIcon(":icons/confirmed.png")
|
icon = QIcon(":icons/confirmed.png")
|
||||||
|
|
||||||
if value is not None:
|
v_str = self.format_amount(value, True, whitespaces=True)
|
||||||
v_str = self.format_amount(value, True, whitespaces=True)
|
balance_str = self.format_amount(balance, whitespaces=True)
|
||||||
else:
|
|
||||||
v_str = _('unknown')
|
|
||||||
|
|
||||||
if balance is not None:
|
|
||||||
balance_str = self.format_amount(balance, whitespaces=True)
|
|
||||||
else:
|
|
||||||
balance_str = _('unknown')
|
|
||||||
|
|
||||||
label, is_default_label = self.wallet.get_label(tx_hash)
|
label, is_default_label = self.wallet.get_label(tx_hash)
|
||||||
if is_default_label:
|
if is_default_label:
|
||||||
|
|||||||
@@ -108,10 +108,10 @@ class ElectrumGui:
|
|||||||
self.history = []
|
self.history = []
|
||||||
|
|
||||||
for item in self.wallet.get_history():
|
for item in self.wallet.get_history():
|
||||||
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
tx_hash, conf, value, timestamp, balance = item
|
||||||
if conf:
|
if conf:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
||||||
except Exception:
|
except Exception:
|
||||||
time_str = "------"
|
time_str = "------"
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ def user_dir():
|
|||||||
|
|
||||||
def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False):
|
def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False):
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
if x is None:
|
||||||
|
return 'unknown'
|
||||||
s = Decimal(x)
|
s = Decimal(x)
|
||||||
sign, digits, exp = s.as_tuple()
|
sign, digits, exp = s.as_tuple()
|
||||||
digits = map(str, digits)
|
digits = map(str, digits)
|
||||||
|
|||||||
Reference in New Issue
Block a user