This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
Snapshot proof commands #244
Closed
pdecol
wants to merge
1
commit into
iotaledger:develop
from
pdecol:feature/217-snapshot-proof-commands
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,7 +8,10 @@ | |||||
TransactionHash | ||||||
from iota.adapter import BaseAdapter | ||||||
from iota.commands.core.find_transactions import FindTransactionsCommand | ||||||
from iota.commands.core.get_balances import GetBalancesCommand | ||||||
from iota.commands.core.get_trytes import GetTrytesCommand | ||||||
from iota.commands.core.were_addresses_spent_from import \ | ||||||
WereAddressesSpentFromCommand | ||||||
from iota.commands.extended import FindTransactionObjectsCommand | ||||||
from iota.commands.extended.get_bundles import GetBundlesCommand | ||||||
from iota.commands.extended.get_latest_inclusion import \ | ||||||
|
@@ -25,26 +28,39 @@ def iter_used_addresses( | |||||
): | ||||||
# type: (...) -> Generator[Tuple[Address, List[TransactionHash]], None, None] | ||||||
""" | ||||||
Scans the Tangle for used addresses. | ||||||
Scans the Tangle for used addresses. A used address is an address that | ||||||
was spent from or has a balance or has a transaction. | ||||||
|
||||||
This is basically the opposite of invoking ``getNewAddresses`` with | ||||||
``stop=None``. | ||||||
``count=None``. | ||||||
""" | ||||||
if security_level is None: | ||||||
security_level = AddressGenerator.DEFAULT_SECURITY_LEVEL | ||||||
|
||||||
ft_command = FindTransactionsCommand(adapter) | ||||||
wasf_command = WereAddressesSpentFromCommand(adapter) | ||||||
gb_command = GetBalancesCommand(adapter) | ||||||
|
||||||
for addy in AddressGenerator(seed, security_level).create_iterator(start): | ||||||
ft_response = ft_command(addresses=[addy]) | ||||||
|
||||||
if ft_response['hashes']: | ||||||
yield addy, ft_response['hashes'] | ||||||
else: | ||||||
break | ||||||
|
||||||
# Reset the command so that we can call it again. | ||||||
wasp_response = wasf_command(addresses=[addy]) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if wasp_response['states'][0]: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
yield addy, [] | ||||||
else: | ||||||
gb_response = gb_command(addresses=[addy]) | ||||||
if gb_response['balances'][0] != 0: | ||||||
yield addy, [] | ||||||
else: | ||||||
break | ||||||
|
||||||
# Reset the commands so that we can call them again. | ||||||
ft_command.reset() | ||||||
wasf_command.reset() | ||||||
gb_command.reset() | ||||||
|
||||||
|
||||||
def get_bundles_from_transaction_hashes( | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙀 Wow, good catch!