-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DEP] Add Cancel Transaction API #23
base: master
Are you sure you want to change the base?
Conversation
…debase. also setup vscode settings.json file.
formatting updates
Add regtest net support
docker compose setup
I am going to review this, but first, I have some questions:
|
While waiting for review on PRs #18 #21 #22, I merged those branches into master branch on my forked repo. so this PR builds on those PRs. i.e. If we review this PR we won't have to review other PRs and they can be closed instead.
|
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.
in overall I think linting will be a good idea. make the code always cleaner. the logic of the cancel function is also good.
"debug.log*": true, | ||
"wallet_service_db": true, | ||
} | ||
} |
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.
I don't think this be a good Idea. as a developer I like to see all the folders and configs in my vs code. I was trying to run your code but was confused at first where is my venv folder!!
I don't recommend to use a settings.json for vs code as every developer may have different desire for his/her work space.
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.
I agree with everyone having their own preferences. But, I think we should have settings.json added with must have settings for that repo. e.g. without settings.json some might have a warning not ignored and be annoyed when someone else checks in their code having that particular warning. or having different line length and ending up with un-wanted auto-formatting changes because of that.
But yeah, settings that have to do with appearance can be moved to user preference. I will make those changes.
@@ -1,6 +1,7 @@ | |||
[SYSTEM] | |||
wallet_dir = wallets | |||
use_testnet = True | |||
use_regtest = False |
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.
use_testnet and use_regtest are mutually exclusive. it means we cannot set both of them True or both of them False. So it is better to define one variable for this purpose. e.g mode = regtest/testnet
[I will explain the issue it may have in the related code]
@@ -23,9 +24,17 @@ def __init__(self): | |||
self.network = None | |||
if self.config['SYSTEM']['use_testnet'] == 'True': | |||
electrum.constants.set_testnet() | |||
if self.config['SYSTEM']['use_regtest'] == 'True': |
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.
what if somebody set use_testnet and use_regtest == True by mistake! it will be overwritten.
RUN pip install -e Electrum-4.2.1/. | ||
|
||
# set electrum config parameters | ||
RUN export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python |
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.
what is this for ? please add a comment for this line and explain it.
Instead of using RUN export, use the ENV directive for setting environment variables.
best practice here is using ENV.
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.
how much is the final image size? is it large ?
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.
I am not a docker expert but as you have dependency between your services, consider adding health checks for services to ensure they are ready before dependent services start to avoid race condition. this is optional and up to you.
electrum.constants.set_regtest() | ||
# default server add in regtest in electrum is 127.0.0.1 | ||
# this allows us to replace 127.0.0.1 with REGTEST_SERVER | ||
regtest_server = os.environ.get('REGTEST_SERVER') |
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.
did you get REGTEST_SERVER from docker-compose ?
can you explain what does this mean inside docker-compose:
REGTEST_SERVER=host.docker.internal
does it using an external host or it is internal ?? what is the ip it is using ?
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.
did you get REGTEST_SERVER from docker-compose ?
yes
REGTEST_SERVER is basically a env variable containing to regtest address . while running without docker you would most probably have regtest server running on 127.0.0.1, depending on docker networking mode that might not be the case for our containers. Now, using this variable we can easily configure regetest server address.
Here we have set it to host.docker.internal
to point to docker's docker container's localhost
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.
I was thinking, don't we need this cancel operation in cli mode like what you implement in api mode ?
Added Cancel Transaction API which takes
sr_id
to find and remove an already scheduled transaction.Note: Please note that currently this API only removes transaction from our db and doesn't touch electrum wallet.
DEP:
this also includes code from other PRs, we can either review and merge this one PR and close previous ones or review those first and then create a new PR for this one.