Save txcomments/floData locally
This commit is contained in:
parent
1e6edd0abc
commit
d8d2f3329b
@ -66,8 +66,8 @@ class AddressSynchronizer(PrintError):
|
|||||||
# Verified transactions. txid -> VerifiedTxInfo. Access with self.lock.
|
# Verified transactions. txid -> VerifiedTxInfo. Access with self.lock.
|
||||||
verified_tx = storage.get('verified_tx3', {})
|
verified_tx = storage.get('verified_tx3', {})
|
||||||
self.verified_tx = {}
|
self.verified_tx = {}
|
||||||
for txid, (height, timestamp, txpos, header_hash) in verified_tx.items():
|
for txid, (height, timestamp, txpos, header_hash, tx_comment) in verified_tx.items():
|
||||||
self.verified_tx[txid] = VerifiedTxInfo(height, timestamp, txpos, header_hash)
|
self.verified_tx[txid] = VerifiedTxInfo(height, timestamp, txpos, header_hash, tx_comment)
|
||||||
# Transactions pending verification. txid -> tx_height. Access with self.lock.
|
# Transactions pending verification. txid -> tx_height. Access with self.lock.
|
||||||
self.unverified_tx = defaultdict(int)
|
self.unverified_tx = defaultdict(int)
|
||||||
# true when synchronized
|
# true when synchronized
|
||||||
@ -596,6 +596,23 @@ class AddressSynchronizer(PrintError):
|
|||||||
# local transaction
|
# local transaction
|
||||||
return TxMinedStatus(TX_HEIGHT_LOCAL, 0, None, None)
|
return TxMinedStatus(TX_HEIGHT_LOCAL, 0, None, None)
|
||||||
|
|
||||||
|
def get_tx_comment(self, tx_hash: str):
|
||||||
|
""" Given a transaction, returns txcomment/floData """
|
||||||
|
with self.lock:
|
||||||
|
if tx_hash in self.verified_tx:
|
||||||
|
info = self.verified_tx[tx_hash]
|
||||||
|
tx_comment = info[4]
|
||||||
|
return tx_comment
|
||||||
|
elif tx_hash in self.unverified_tx:
|
||||||
|
tx = self.transactions.get(tx_hash)
|
||||||
|
tx_comment = tx.txcomment[5:]
|
||||||
|
return tx_comment
|
||||||
|
else:
|
||||||
|
# local transaction
|
||||||
|
tx = self.transactions.get(tx_hash)
|
||||||
|
tx_comment = tx.txcomment[5:]
|
||||||
|
return tx_comment
|
||||||
|
|
||||||
def set_up_to_date(self, up_to_date):
|
def set_up_to_date(self, up_to_date):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self.up_to_date = up_to_date
|
self.up_to_date = up_to_date
|
||||||
|
|||||||
@ -1103,7 +1103,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
hbox.addStretch(1)
|
hbox.addStretch(1)
|
||||||
grid.addLayout(hbox, 4, 4)
|
grid.addLayout(hbox, 4, 4)
|
||||||
|
|
||||||
msg = _('Bitcoin transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\
|
msg = _('FLO transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\
|
||||||
+ _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\
|
+ _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\
|
||||||
+ _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.')
|
+ _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.')
|
||||||
self.fee_e_label = HelpLabel(_('Fee'), msg)
|
self.fee_e_label = HelpLabel(_('Fee'), msg)
|
||||||
|
|||||||
@ -1063,8 +1063,6 @@ class Transaction:
|
|||||||
return nVersion + marker + flag + txins + txouts + witness + nLocktime
|
return nVersion + marker + flag + txins + txouts + witness + nLocktime
|
||||||
else:
|
else:
|
||||||
if self.version >= 2:
|
if self.version >= 2:
|
||||||
print("Before serialize to network ")
|
|
||||||
print(nVersion + txins + txouts + nLocktime + nTxComment)
|
|
||||||
return nVersion + txins + txouts + nLocktime + nTxComment
|
return nVersion + txins + txouts + nLocktime + nTxComment
|
||||||
else:
|
else:
|
||||||
return nVersion + txins + txouts + nLocktime
|
return nVersion + txins + txouts + nLocktime
|
||||||
|
|||||||
@ -905,4 +905,5 @@ TxMinedStatus = NamedTuple("TxMinedStatus", [("height", int),
|
|||||||
VerifiedTxInfo = NamedTuple("VerifiedTxInfo", [("height", int),
|
VerifiedTxInfo = NamedTuple("VerifiedTxInfo", [("height", int),
|
||||||
("timestamp", int),
|
("timestamp", int),
|
||||||
("txpos", int),
|
("txpos", int),
|
||||||
("header_hash", str)])
|
("header_hash", str),
|
||||||
|
("tx_comment", str)])
|
||||||
|
|||||||
@ -110,7 +110,8 @@ class SPV(ThreadJob):
|
|||||||
except KeyError: pass
|
except KeyError: pass
|
||||||
self.print_error("verified %s" % tx_hash)
|
self.print_error("verified %s" % tx_hash)
|
||||||
header_hash = hash_header(header)
|
header_hash = hash_header(header)
|
||||||
vtx_info = VerifiedTxInfo(tx_height, header.get('timestamp'), pos, header_hash)
|
tx_comment = self.wallet.get_tx_comment(tx_hash)
|
||||||
|
vtx_info = VerifiedTxInfo(tx_height, header.get('timestamp'), pos, header_hash, tx_comment)
|
||||||
self.wallet.add_verified_tx(tx_hash, vtx_info)
|
self.wallet.add_verified_tx(tx_hash, vtx_info)
|
||||||
if self.is_up_to_date() and self.wallet.is_up_to_date():
|
if self.is_up_to_date() and self.wallet.is_up_to_date():
|
||||||
self.wallet.save_verified_tx(write=True)
|
self.wallet.save_verified_tx(write=True)
|
||||||
|
|||||||
@ -401,7 +401,7 @@ class Abstract_Wallet(AddressSynchronizer):
|
|||||||
'value': Satoshis(value),
|
'value': Satoshis(value),
|
||||||
'balance': Satoshis(balance),
|
'balance': Satoshis(balance),
|
||||||
'date': timestamp_to_datetime(timestamp),
|
'date': timestamp_to_datetime(timestamp),
|
||||||
'label': self.get_label(tx_hash),
|
'label': self.get_label(tx_hash)
|
||||||
}
|
}
|
||||||
if show_addresses:
|
if show_addresses:
|
||||||
tx = self.transactions.get(tx_hash)
|
tx = self.transactions.get(tx_hash)
|
||||||
@ -486,10 +486,6 @@ class Abstract_Wallet(AddressSynchronizer):
|
|||||||
return ', '.join(labels)
|
return ', '.join(labels)
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def get_tx_comment(self, tx_hash):
|
|
||||||
tx = self.transactions.get(tx_hash)
|
|
||||||
comment = tx.txcomment[5:]
|
|
||||||
return comment
|
|
||||||
|
|
||||||
def get_tx_status(self, tx_hash, tx_mined_status):
|
def get_tx_status(self, tx_hash, tx_mined_status):
|
||||||
extra = []
|
extra = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user