fix for getrawtransaction
authorThomasV <thomasv@gitorious>
Mon, 13 Jan 2014 20:27:31 +0000 (21:27 +0100)
committerThomasV <thomasv@gitorious>
Mon, 13 Jan 2014 20:27:31 +0000 (21:27 +0100)
lib/commands.py

index ccaa038..ef04fe0 100644 (file)
@@ -72,7 +72,7 @@ register_command('getaddressbalance',    1, 1, True,  True,  False, 'Return the
 register_command('getaddresshistory',    1, 1, True,  True,  False, 'Return the transaction history of a wallet address', 'getaddresshistory <address>')
 register_command('getconfig',            1, 1, False, False, False, 'Return a configuration variable', 'getconfig <name>')
 register_command('getpubkeys',           1, 1, False, True,  False, 'Return the public keys for a wallet address', 'getpubkeys <bitcoin address>')
-register_command('getrawtransaction',    1, 2, True,  False, False, 'Retrieve a transaction', 'getrawtransaction <txhash> <height>')
+register_command('getrawtransaction',    1, 1, True,  False, False, 'Retrieve a transaction', 'getrawtransaction <txhash>')
 register_command('getseed',              0, 0, False, True,  True,  'Print the generation seed of your wallet.')
 register_command('getmpk',               0, 0, False, True,  False, 'Return your wallet\'s master public key', 'getmpk')
 register_command('help',                 0, 1, False, False, False, 'Prints this help')
@@ -350,11 +350,11 @@ class Commands:
             if cmd.options: print_msg("options:\n" + cmd.options)
         return None
 
-    def getrawtransaction(self, tx_hash, height = 0):
-        tx = self.wallet.transactions.get(tx_hash)
-        if tx:
-            return tx
-        height = int(height)
-        return self.network.retrieve_transaction(tx_hash, height)
+    def getrawtransaction(self, tx_hash):
+        if self.wallet:
+            tx = self.wallet.transactions.get(tx_hash)
+            if tx:
+                return tx
+        return self.network.retrieve_transaction(tx_hash)