From 8f5ca40d10e921f87f1faf6162d81a62d114f1d7 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 5 Mar 2019 17:01:54 +0100 Subject: [PATCH] new cli command: get_tx_status --- electrum/commands.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/electrum/commands.py b/electrum/commands.py index 19ea8b44c..4797a7481 100644 --- a/electrum/commands.py +++ b/electrum/commands.py @@ -737,6 +737,19 @@ class Commands: self.wallet.remove_transaction(tx_hash) self.wallet.storage.write() + @command('wn') + def get_tx_status(self, txid): + """Returns some information regarding the tx. For now, only confirmations. + The transaction must be related to the wallet. + """ + if not is_hash256_str(txid): + raise Exception(f"{repr(txid)} is not a txid") + if not self.wallet.db.get_transaction(txid): + raise Exception("Transaction not in wallet.") + return { + "confirmations": self.wallet.get_tx_height(txid).conf, + } + @command('') def help(self): # for the python console