Skip to content

Commit

Permalink
Merge pull request #322 from devos50/source_block_return
Browse files Browse the repository at this point in the history
Added return value when creating a source block
  • Loading branch information
devos50 authored Oct 8, 2018
2 parents a00010d + 292448a commit 921bf81
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ipv8/attestation/trustchain/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ def create_source_block(self, block_type=b'unknown', transaction=None):
:param block_type: The type of the block to be constructed, as a string
:param transaction: A string describing the interaction in this block
:return: None
:return: A deferred that fires with a (block, None) tuple
"""
self.sign_block(peer=None, public_key=ANY_COUNTERPARTY_PK, block_type=block_type, transaction=transaction)
return self.sign_block(peer=None, public_key=ANY_COUNTERPARTY_PK,
block_type=block_type, transaction=transaction)

def create_link(self, source, block_type=b'unknown', additional_info=None, public_key=None):
"""
Expand Down Expand Up @@ -256,7 +257,7 @@ def sign_block(self, peer, public_key=EMPTY_PK, block_type=b'unknown', transacti
if not peer and public_key == ANY_COUNTERPARTY_PK:
if self.settings.broadcast_blocks:
self.send_block(block)
return
return succeed((block, None))

# If there is a counterparty to sign, we send it
self.send_block(block, address=peer.address)
Expand Down

0 comments on commit 921bf81

Please sign in to comment.