Skip to content
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

Some typos fixed and removed electrum-merchant requirement #1631

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

markmeson
Copy link

Electrum Merchant is the only use-as-is solution for BIP70 payment requests in Electron Cash but there are other solutions that allow for greater flexibility by setting index_url to something other than the index.html file provided by that package. Even still, this check is not necessary to allow electrum-merchant to function or even avoid a crash in the case that it is not installed properly (the link will simply be dead).

@@ -137,7 +137,7 @@ def import_addresses_or_keys(self):
title = _("Import Bitcoin Addresses")
message = _("Enter a list of Bitcoin Cash addresses (this will create a watching-only wallet), or a list of private keys.")
if bitcoin.is_bip38_available():
message += " " + _("BIP38 encrpted keys are supported.")
message += " " + _("BIP38 encyrpted keys are supported.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. That was my typo. Thanks for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although you continued to typo it -- encrypted -- you have encyrpted :) Typos are contagious sometimes. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, that's hilarious. I'm so done with typing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah there is a known phenomenon that typos are contagious. Thanks for catching this. I do this more than I like to admit in my user-facing messages.

@@ -820,10 +820,11 @@ def help(self):
config_variables = {

'addrequest': {
'requests_dir': 'directory where a bip70 file will be written.',
'ssl_privkey': 'Path to your SSL private key, needed to sign the request.',
'requests_dir': 'Directory where BIP70 payment request files will be written.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

if not os.path.exists(path):
print("Requests directory not configured.")
print("You can configure it using https://github.com/spesmilo/electrum-merchant")
sys.exit(1)
Copy link
Collaborator

@cculianu cculianu Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok -- I still have to check if other parts of the code will crash if they don't find the requests_dir when they expected it (namely the stuff in websockets.py and commands.py has to at least be made resilient to the absence of the dir and should not throw up a stack trace).

I do agree checking for index.html here is kind of dumb.

So you are 100% sure no check here is needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, as far as I know, electrum-merchant just installs its script there with some other jquery files and stuff like that. On the one hand, enforcing this restricts users to serving their payment requests with electrum-merchant. On the other hand, not enforcing it doesn't break electrum merchant (the user will simply get a broken link when they visit the index_url if electrum-merchant is not installed) but allows users to have a requests_dir and also serve the PR with any URL they want.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

The thing is wallet.py also refers to that index.html file:

out['index_url'] = os.path.join(baseurl, 'index.html') + '?id=' + key

So -- what do we do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although if you want to continue to support https://electroncash.readthedocs.io/en/latest/old/merchant.html then that doc should be updated to indicate the need to either install electrum-merchant OR serve the PR some other way.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should also explain how to specify BCH when installing electrum-merchant. But imho that static html tool is not great because users can simply spoof their own payments by sending a 'paid' message through the websocket.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

The thing is wallet.py also refers to that index.html file:

out['index_url'] = os.path.join(baseurl, 'index.html') + '?id=' + key

So -- what do we do?

Yeah, because that index_url is included as part of the PR json file. But I don't know that it ever gets read from anywhere after that. Does it just sit there doing nothing? I think so. When the user's webserver gets a request for mydomain.com/requests_dir/index.html?id=FOO, the PR will be accessed by the javascript in electrum-merchant (https://github.com/spesmilo/electrum-merchant/blob/master/electrum-merchant/simple/index.html) without ever needing to access index_url from the JSON file. Pretty sure that field does nothing. You could remove that line as well. (Hope I'm right about that haha)

Yuki Matsumoto added 3 commits September 28, 2019 11:52
When an EC merchant receieves a BIP70 Payment from a customer it can be
archived alongside the associated payment request for future reference and for
extracting transaction data. A subsequent PaymentACK can be constructed
from the Payment and a user-defined memo.
@cculianu
Copy link
Collaborator

Hey man sorry I'm still on vacation -- likely next week this can get more thoroughly reviewed and merged. I noticed you pushed more stuff. Thanks.

@markmeson
Copy link
Author

markmeson commented Sep 28, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants