Skip to content

Commit

Permalink
Use checkpoint to verify pre-checkpoint headers from the server, remo…
Browse files Browse the repository at this point in the history
…ving the need for complete header synchronisation. Now only post-checkpoint headers are synchronised, and pre-checkpoint headers are fetched primarily to aid the verifier. This commit incorporates selected changes from Electrum modified to support the different checkpoint models. If the hardcoded checkpoint heights in `networks.py` are replaced with None, then the application will fetch at least three checkpoints from different servers and compare them, using those to proceed. This can be used to get obtain the a recent checkpoint for release, and won't be used unless specifically activated, as this commit comes with the initial hard-coded checkpoint heights.
  • Loading branch information
rt121212121 committed Jul 24, 2018
1 parent d91d11f commit abf12b6
Show file tree
Hide file tree
Showing 15 changed files with 732 additions and 284 deletions.
2 changes: 1 addition & 1 deletion gui/kivy/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ def _sign_tx(self, tx, password, on_success, on_failure):
Clock.schedule_once(lambda dt: on_success(tx))

def _broadcast_thread(self, tx, on_complete):
ok, txid = self.network.broadcast(tx)
ok, txid = self.network.broadcast_transaction(tx)
Clock.schedule_once(lambda dt: on_complete(ok, txid))

def broadcast(self, tx, pr=None):
Expand Down
2 changes: 1 addition & 1 deletion gui/qt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ def broadcast_thread():
if pr and pr.has_expired():
self.payment_request = None
return False, _("Payment request has expired")
status, msg = self.network.broadcast(tx)
status, msg = self.network.broadcast_transaction(tx)
if pr and status is True:
self.invoices.set_paid(pr, tx.txid())
self.invoices.save()
Expand Down
2 changes: 1 addition & 1 deletion gui/qt/network_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def update(self, network):
if n_chains >1:
x = QTreeWidgetItem([name + '@%d'%b.get_checkpoint(), '%d'%b.height()])
x.setData(0, Qt.UserRole, 1)
x.setData(1, Qt.UserRole, b.checkpoint)
x.setData(1, Qt.UserRole, b.base_height)
else:
x = self
for i in items:
Expand Down
2 changes: 1 addition & 1 deletion gui/stdio.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def do_send(self):
self.wallet.labels[tx.txid()] = self.str_description

print(_("Please wait..."))
status, msg = self.network.broadcast(tx)
status, msg = self.network.broadcast_transaction(tx)

if status:
print(_('Payment sent.'))
Expand Down
2 changes: 1 addition & 1 deletion gui/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def do_send(self):
self.wallet.labels[tx.txid()] = self.str_description

self.show_message(_("Please wait..."), getchar=False)
status, msg = self.network.broadcast(tx)
status, msg = self.network.broadcast_transaction(tx)

if status:
self.show_message(_('Payment sent.'))
Expand Down
2 changes: 1 addition & 1 deletion ios/ElectronCash/electroncash_gui/ios_native/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@ def broadcast_thread(): # non-GUI thread
#if pr and pr.has_expired():
# self.payment_request = None
# return False, _("Payment request has expired")
status, msg = self.daemon.network.broadcast(tx)
status, msg = self.daemon.network.broadcast_transaction(tx)
#if pr and status is True:
# self.invoices.set_paid(pr, tx.txid())
# self.invoices.save()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def refresh(self) -> None:
extraData = None
if n_chains > 1:
secHeader = "(" + (name + '@%d'%b.get_checkpoint()) + ") " + _("Host") + ", " + _("Height")
extraData = [ False, b.checkpoint, name ]
extraData = [ False, b.base_height, name ]
for i in items:
star = ' *' if i == network.interface else ''
extraData = [True, i.server, ''] #if n_chains <= 1 else extraData
Expand Down
Loading

0 comments on commit abf12b6

Please sign in to comment.