This repository was archived by the owner on Jan 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 126
Add wereAddressesSpentFrom check to used/new address discovery
#271
Merged
lzpap
merged 1 commit into
iotaledger-archive:develop
from
lzpap:pdecol_snapshot_pr_cleaned
Dec 2, 2019
Merged
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -590,12 +590,9 @@ def test_no_stop_threshold_met(self): | |
| """ | ||
| No ``stop`` provided, balance meets ``threshold``. | ||
| """ | ||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [42, 29], | ||
| }) | ||
|
|
||
| # ``getInputs`` uses ``findTransactions`` to identify unused | ||
| # addresses. | ||
| # ``getInputs`` uses ``findTransactions`` and | ||
| # ``wereAddressesSpentFrom`` to identify unused addresses. | ||
| # noinspection SpellCheckingInspection | ||
| self.adapter.seed_response('findTransactions', { | ||
| 'hashes': [ | ||
|
|
@@ -620,6 +617,14 @@ def test_no_stop_threshold_met(self): | |
| 'hashes': [], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('wereAddressesSpentFrom', { | ||
| 'states': [False], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [42, 29], | ||
| }) | ||
|
|
||
| # To keep the unit test nice and speedy, we will mock the address | ||
| # generator. We already have plenty of unit tests for that | ||
| # functionality, so we can get away with mocking it here. | ||
|
|
@@ -686,12 +691,9 @@ def test_no_stop_threshold_zero(self): | |
| """ | ||
| No ``stop`` provided, ``threshold`` is 0. | ||
| """ | ||
| # Note that the first address has a zero balance. | ||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [0, 1], | ||
| }) | ||
|
|
||
| # ``getInputs`` uses ``findTransactions`` to identify unused | ||
| # ``getInputs`` uses ``findTransactions`` and | ||
| # ``wereAddressesSpentFrom`` to identify unused addresses. | ||
| # addresses. | ||
| # noinspection SpellCheckingInspection | ||
| self.adapter.seed_response('findTransactions', { | ||
|
|
@@ -717,6 +719,15 @@ def test_no_stop_threshold_zero(self): | |
| 'hashes': [], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('wereAddressesSpentFrom', { | ||
| 'states': [False], | ||
| }) | ||
|
|
||
| # Note that the first address has a zero balance. | ||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [0, 1], | ||
| }) | ||
|
|
||
| # To keep the unit test nice and speedy, we will mock the address | ||
| # generator. We already have plenty of unit tests for that | ||
| # functionality, so we can get away with mocking it here. | ||
|
|
@@ -750,12 +761,9 @@ def test_no_stop_no_threshold(self): | |
| """ | ||
| No ``stop`` provided, no ``threshold``. | ||
| """ | ||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [42, 29], | ||
| }) | ||
|
|
||
| # ``getInputs`` uses ``findTransactions`` to identify unused | ||
| # addresses. | ||
| # ``getInputs`` uses ``findTransactions`` and | ||
| # ``wereAddressesSpentFrom`` to identify unused addresses. | ||
| # noinspection SpellCheckingInspection | ||
| self.adapter.seed_response('findTransactions', { | ||
| 'hashes': [ | ||
|
|
@@ -780,6 +788,14 @@ def test_no_stop_no_threshold(self): | |
| 'hashes': [], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('wereAddressesSpentFrom', { | ||
| 'states': [False], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [42, 29], | ||
| }) | ||
|
|
||
| # To keep the unit test nice and speedy, we will mock the address | ||
| # generator. We already have plenty of unit tests for that | ||
| # functionality, so we can get away with mocking it here. | ||
|
|
@@ -818,12 +834,9 @@ def test_start(self): | |
| """ | ||
| Using ``start`` to offset the key range. | ||
| """ | ||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [86], | ||
| }) | ||
|
|
||
| # ``getInputs`` uses ``findTransactions`` to identify unused | ||
| # addresses. | ||
| # ``getInputs`` uses ``findTransactions`` and | ||
| # ``wereAddressesSpentFrom`` to identify unused addresses. | ||
| # noinspection SpellCheckingInspection | ||
| self.adapter.seed_response('findTransactions', { | ||
| 'hashes': [ | ||
|
|
@@ -838,6 +851,14 @@ def test_start(self): | |
| 'hashes': [], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('wereAddressesSpentFrom', { | ||
| 'states': [False], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [86], | ||
| }) | ||
|
|
||
| # To keep the unit test nice and speedy, we will mock the address | ||
| # generator. We already have plenty of unit tests for that | ||
| # functionality, so we can get away with mocking it here. | ||
|
|
@@ -926,11 +947,8 @@ def test_security_level_1_no_stop(self): | |
| seed = Seed.random() | ||
| address = AddressGenerator(seed, security_level=1).get_addresses(0)[0] | ||
|
|
||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [86], | ||
| }) | ||
| # ``getInputs`` uses ``findTransactions`` to identify unused | ||
| # addresses. | ||
| # ``getInputs`` uses ``findTransactions`` and | ||
| # ``wereAddressesSpentFrom`` to identify unused addresses. | ||
|
Comment on lines
+950
to
+951
Contributor
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. ❔ We didn't modify
Collaborator
Author
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.
|
||
| # noinspection SpellCheckingInspection | ||
| self.adapter.seed_response('findTransactions', { | ||
| 'hashes': [ | ||
|
|
@@ -944,6 +962,14 @@ def test_security_level_1_no_stop(self): | |
| 'hashes': [], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('wereAddressesSpentFrom', { | ||
| 'states': [False], | ||
| }) | ||
|
|
||
| self.adapter.seed_response('getBalances', { | ||
| 'balances': [86], | ||
| }) | ||
|
|
||
| response = GetInputsCommand(self.adapter)( | ||
| seed=seed, | ||
| securityLevel=1, | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.