Conversation
Codecov Report
@@ Coverage Diff @@
## v2-master #66 +/- ##
=============================================
+ Coverage 78.33% 84.75% +6.41%
=============================================
Files 17 15 -2
Lines 1071 774 -297
Branches 115 83 -32
=============================================
- Hits 839 656 -183
+ Misses 200 93 -107
+ Partials 32 25 -7
Continue to review full report at Codecov.
|
| services: | ||
| stellar-core-1: | ||
| image: kinecosystem/stellar-core:kinecosystem-v2.0.0-stellar-v9.2.0 | ||
| image: kinecosystem/stellar-core:latest |
There was a problem hiding this comment.
It's better to hardcode the version. This is the only way to be 100% sure the build is stable. Future updates might break the code.
|
|
||
| stellar-core-2: | ||
| image: kinecosystem/stellar-core:kinecosystem-v2.0.0-stellar-v9.2.0 | ||
| image: kinecosystem/stellar-core:latest |
There was a problem hiding this comment.
Same. Let's hardcode the versions in this file.
There was a problem hiding this comment.
blockchain team removes their docker images a lot so the tests fail. latest will always be there
requirements-dev.txt
Outdated
| py==1.5.2 | ||
| pytest-cov==2.5.1 | ||
| pytest==3.4.0 | ||
| codecov |
| return raw_tx | ||
|
|
||
| def get_account_tx_history(self, address, amount=10, descending=True, cursor=None, simple=True): | ||
| async def get_account_tx_history(self, address: str, amount: Optional[int] = 10, descending: Optional[bool] = True, |
There was a problem hiding this comment.
from a talking with @mrsegev we decided we should't expose this utill we solve history issue on the blockchain side, as it's not reliable now it can cause just troubles,
There was a problem hiding this comment.
@mrsegev This has been exposed for months now, should I remove it then?
| response = requests.get(self.environment.friendbot_url, params={'addr': address}) | ||
| if response.ok: | ||
| return response.json()['hash'] | ||
| response = await self.horizon._session.get(self.environment.friendbot_url, params={'addr': address}) |
There was a problem hiding this comment.
in node-sdk, I've added also the fund option, in case of an existing account, you might want to add it as well (not necessarily now)
There was a problem hiding this comment.
Good idea, I will create a ticket
| class ChannelPool(queue): | ||
| """ | ||
| A thread-safe queue that sets a member's status instead of pulling it in/out of the queue. | ||
| An async queue that sets a member's status instead of pulling it in/out of the queue. |
There was a problem hiding this comment.
out of curiosity, why queue is needed? seems simple list/set will provide the same functionality? I mean there's no real use of push/pop here.
(mainly trying to understand that I'm not missing something with my node impl for that)
There was a problem hiding this comment.
There is really no use of any push/pop here. I used the queue class before since it helped me with thread-safety.
Now I'm inheriting it since it has asnyc methods to get/push back to the "queue". Otherwise, I would need to write my own implementation to select an item from the set asyncrounsly
There was a problem hiding this comment.
ok, so I understood it correctly, I would suggest to call it pool instead of queue (just in case it is a public api)
| :param threading.Event stop_event: an event that can be used to stop this method | ||
| """ | ||
| import json | ||
| async def single_monitor(kin_client: 'KinClient', address: str, |
There was a problem hiding this comment.
why does the KinClinet is wrapped with ' ?
There was a problem hiding this comment.
Kin client imports "Single Monitor"
If I wanted to write KinClient without '' I would need to import KinClient in SingleMonitor, and then I would have a circular loop of importing. So instead of importing the type you can just write it as a string. That's called 'forward referencing'
https://stackoverflow.com/questions/39740632/python-type-hinting-without-cyclic-imports
| :raises: asyncio.TimeoutError: If too much time has passed between events (only if "timeout" is set) | ||
| """ | ||
| if not is_valid_address(address): | ||
| raise StellarAddressInvalidError('invalid address: {}'.format(address)) |
There was a problem hiding this comment.
can we remove Stellar from this error name?
| import json | ||
| tx_data = SimplifiedTransaction(RawTransaction(tx)) | ||
| except CantSimplifyError: | ||
| logger.debug("SSE transaction couldn't be simplified: ", tx) |
There was a problem hiding this comment.
what's exactly this logger? is it controllable by the developer?
There was a problem hiding this comment.
Just a logger like any other. And yes, you can set it's level
See https://github.com/kinecosystem/migration-server/blob/master/scripts/src/init.py#L42
| logger.debug("Non-payment SSE transaction skipped: ", tx_data) | ||
| continue | ||
|
|
||
| # Will yield twice if both of these are correct. (someone sent to himself) - which it fine |
There was a problem hiding this comment.
why not check both and send an only single event? (not crucial as it's an edge case, but don't see a reason to fire twice)
There was a problem hiding this comment.
This is just how it worked so far so I didnt wanted to change it
| sleep(10) | ||
| assert not monitor.thread.is_alive() | ||
| assert hash4 not in txs_found2 | ||
| pass |
There was a problem hiding this comment.
what exactly is broken? does it happen also on testnet?
There was a problem hiding this comment.
I tested my sse implementation manually and it works, but yes we get these 404s from time to time so I didn't want to get my test to fail because of a BC issue
Update the kin-sdk to work with asyncio:
Changes: