Browse Source

remove --broadcast option for payto, and parse transactions from json 'hex' field

283
ThomasV 9 years ago
parent
commit
fbb65416d3
  1. 17
      lib/commands.py
  2. 9
      lib/transaction.py

17
lib/commands.py

@ -412,26 +412,18 @@ class Commands:
return tx return tx
@command('wp') @command('wp')
def payto(self, destination, amount, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False, broadcast=False): def payto(self, destination, amount, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False):
"""Create a transaction. """ """Create a transaction. """
domain = [from_addr] if from_addr else None domain = [from_addr] if from_addr else None
tx = self._mktx([(destination, amount)], tx_fee, change_addr, domain, nocheck, unsigned) tx = self._mktx([(destination, amount)], tx_fee, change_addr, domain, nocheck, unsigned)
if broadcast: return tx.deserialize() if deserialized else tx
r, h = self.wallet.sendtx(tx)
return h
else:
return tx.deserialize() if deserialized else tx
@command('wp') @command('wp')
def paytomany(self, outputs, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False, broadcast=False): def paytomany(self, outputs, tx_fee=None, from_addr=None, change_addr=None, nocheck=False, unsigned=False, deserialized=False):
"""Create a multi-output transaction. """ """Create a multi-output transaction. """
domain = [from_addr] if from_addr else None domain = [from_addr] if from_addr else None
tx = self._mktx(outputs, tx_fee, change_addr, domain, nocheck, unsigned) tx = self._mktx(outputs, tx_fee, change_addr, domain, nocheck, unsigned)
if broadcast: return tx.deserialize() if deserialized else tx
r, h = self.wallet.sendtx(tx)
return h
else:
return tx.deserialize() if deserialized else tx
@command('wn') @command('wn')
def history(self): def history(self):
@ -620,7 +612,6 @@ param_descriptions = {
} }
command_options = { command_options = {
'broadcast': (None, "--broadcast", "Broadcast the transaction to the Bitcoin network"),
'password': ("-W", "--password", "Password"), 'password': ("-W", "--password", "Password"),
'concealed': ("-C", "--concealed", "Don't echo seed to console when restoring"), 'concealed': ("-C", "--concealed", "Don't echo seed to console when restoring"),
'receiving': (None, "--receiving", "Show only receiving addresses"), 'receiving': (None, "--receiving", "Show only receiving addresses"),

9
lib/transaction.py

@ -470,7 +470,14 @@ class Transaction:
return self.raw return self.raw
def __init__(self, raw): def __init__(self, raw):
self.raw = raw.strip() if raw else None if raw is None:
self.raw = None
elif type(raw) in [str, unicode]:
self.raw = raw.strip() if raw else None
elif type(raw) is dict:
self.raw = raw['hex']
else:
raise BaseException("cannot initialize transaction", raw)
self.inputs = None self.inputs = None
def update(self, raw): def update(self, raw):

Loading…
Cancel
Save