Page MenuHomePhabricator

[electrum] use blockchain.transaction.get_height method
ClosedPublic

Authored by PiRK on Sat, Dec 14, 15:03.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC26ca7aa70c44: [electrum] use blockchain.transaction.get_height method
Summary

This removes the only call for blockchain.transaction.get with verbose=True, and uses blockchain.transaction.get_height instead to get the only information we need and avoid some computation.

Also replace a try... except block with a simple check that the jsonrpc response provided to the callback has the expected type. I don't see what else could raise an error in this codepath.

Test Plan

This codepath is only used when inspecting a transaction that does not involve the wallet. So open any wallet, go to a block explorer and copy the raw hex data for a random transaction, use the Tools > Load Transaction > From Text menu and paste the raw hex. Check that the dialog shows the correct block height for this tx.
If running Electrum ABC in verbose mode, look out for the "fetch_input_data: got tx block height" message

Diff Detail

Repository
rABC Bitcoin ABC
Branch
transaction_height
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31653
Build 62802: Build Diffelectrum-tests
Build 62801: arc lint + arc unit

Event Timeline

PiRK requested review of this revision.Sat, Dec 14, 15:03
Fabien added a subscriber: Fabien.

now it works even if electrum is not synced to the tip btw

This revision is now accepted and ready to land.Mon, Dec 16, 11:10