Skip to content

Commit

Permalink
Add dry_run support to transaction broadcasting
Browse files Browse the repository at this point in the history
  • Loading branch information
emre committed Oct 11, 2018
1 parent 5754f03 commit 2ff41f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lightsteem/broadcast/transaction_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def _is_canonical(self, sig):
and not (sig[32] & 0x80)
and not (sig[32] == 0 and not (sig[33] & 0x80)))

def broadcast(self, operations, chain=None):
def broadcast(self, operations, chain=None, dry_run=False):
preferred_api_type = self.client.api_type
if not isinstance(operations, list):
operations = [operations, ]

Expand Down Expand Up @@ -192,5 +193,9 @@ def broadcast(self, operations, chain=None):
sigs.append(hexlify(sigstr).decode('ascii'))

self.transaction["signatures"] = sigs
self.client.api_type = preferred_api_type

if dry_run:
return self.transaction

return self.client.broadcast_transaction(self.transaction)

0 comments on commit 2ff41f3

Please sign in to comment.