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

fix bad iteration in finish_batch certificate_handlers.py #127

Merged
merged 2 commits into from Feb 8, 2019

Conversation

Projects
None yet
3 participants
@WLBF
Copy link
Contributor

WLBF commented Jan 28, 2019

I run the demo as quick start described, however get an error:

ab987a087865:/etc/cert-issuer# cert-issuer -c /etc/cert-issuer/conf.ini
WARNING - Your app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - This run will try to issue on the bitcoin_regtest chain
INFO - Set cost constants to recommended_tx_fee=0.000600,min_per_output=0.000028,satoshi_per_byte=250
INFO - Processing 1 certificates
INFO - Processing 1 certificates under work path=/etc/cert-issuer/work
INFO - Total cost will be 133500 satoshis
INFO - Starting finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - Stopping finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - here is the op_return_code data: c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f20
INFO - Unsigned hextx=0100000001e862aefcfcabe00e7552b3d7b5b1f2000a66ea90b02581bc6338436dabdd757f0000000000ffffffff028068c21d000000001976a914effebb7d38501a55f6dc4352b9a27ca6643582e888ac0000000000000000226a20c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f2000000000
INFO - Preparing tx for signing
INFO - Starting finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - Stopping finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - The actual transaction size is 235 bytes
INFO - Signed hextx=0100000001e862aefcfcabe00e7552b3d7b5b1f2000a66ea90b02581bc6338436dabdd757f000000006b48304502210096a3b426b0d17a105cc1efd44d8d45b235ec0d862033c8c135c694a9a0b8e92302201a1f94a47faa76619c143e627ba5114e379d90ec0bdcfa53a4ae9b0086c1f004012103f4e1b15d91e18c157eaa1624f185bb6aef3d9181c9b55181556956cdbb7854b7ffffffff028068c21d000000001976a914effebb7d38501a55f6dc4352b9a27ca6643582e888ac0000000000000000
226a20c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f2000000000
INFO - Signed hextx=0100000001e862aefcfcabe00e7552b3d7b5b1f2000a66ea90b02581bc6338436dabdd757f000000006b48304502210096a3b426b0d17a105cc1efd44d8d45b235ec0d862033c8c135c694a9a0b8e92302201a1f94a47faa76619c143e627ba5114e379d90ec0bdcfa53a4ae9b0086c1f004012103f4e1b15d91e18c157eaa1624f185bb6aef3d9181c9b55181556956cdbb7854b7ffffffff028068c21d000000001976a914effebb7d38501a55f6dc4352b9a27ca6643582e888ac0000000000000000
226a20c65c6184e3d5a945ddb5437e93ea312411fd33aa1def22b0746d6ecd4aa30f2000000000
INFO - verifying op_return value for transaction
INFO - verified OP_RETURN
INFO - Broadcasting succeeded with method_provider=<bound method BitcoindConnector.broadcast_tx of <cert_issuer.blockchain_handlers.bitcoin.connectors.BitcoindConnector object at 0x7f3d0b924a58>>, txid=ebe8a3910a0f4519402eab04d39182edbadd4f6ef42e3183c270613fc6854faf
Traceback (most recent call last):
  File "/usr/bin/cert-issuer", line 11, in <module>
    load_entry_point('cert-issuer==2.0.15', 'console_scripts', 'cert-issuer')()
  File "/usr/lib/python3.6/site-packages/cert_issuer/__main__.py", line 17, in cert_issuer_main
    issue_certificates.main(parsed_config)
  File "/usr/lib/python3.6/site-packages/cert_issuer/issue_certificates.py", line 36, in main
    return issue(app_config, certificate_batch_handler, transaction_handler)
  File "/usr/lib/python3.6/site-packages/cert_issuer/issue_certificates.py", line 22, in issue
    tx_id = issuer.issue(app_config.chain)
  File "/usr/lib/python3.6/site-packages/cert_issuer/issuer.py", line 28, in issue
    self.certificate_batch_handler.finish_batch(txid, chain)
  File "/usr/lib/python3.6/site-packages/cert_issuer/certificate_handlers.py", line 126, in finish_batch
    self.certificate_handler.add_proof(metadata, proof)
  File "/usr/lib/python3.6/site-packages/cert_issuer/certificate_handlers.py", line 24, in add_proof
    certificate_json = self._get_certificate_to_issue(certificate_metadata)
  File "/usr/lib/python3.6/site-packages/cert_issuer/certificate_handlers.py", line 30, in _get_certificate_to_issue
    with open(certificate_metadata.unsigned_cert_file_name, 'r') as unsigned_cert_file:
AttributeError: 'tuple' object has no attribute 'unsigned_cert_file_name'

same problem: https://community.blockcerts.org/t/error-of-cert-issuer-c-etc-cert-issuer-conf-ini/1643

It seems that the problem is caused by this line, which is a bad iteration, bring in by #121.

WLBF added some commits Jan 28, 2019

@yancyribbens
Copy link
Contributor

yancyribbens left a comment

LGTM. Thanks for fixing this and correcting the line spacing!

@@ -121,7 +121,7 @@ def get_certificate_generator(self):

def finish_batch(self, tx_id, chain):
proof_generator = self.merkle_tree.get_proof_generator(tx_id, chain)
for metadata in self.certificates_to_issue.items():
for _, metadata in self.certificates_to_issue.items():

This comment has been minimized.

@yancyribbens

yancyribbens Jan 29, 2019

Contributor

It would be nice to add a test for this :). I notice if I undo this line in your PR the test-suite still passes..

@kimdhamilton
Copy link
Member

kimdhamilton left a comment

LGTM, thanks @yancyribbens

@kimdhamilton kimdhamilton merged commit c17f0bd into blockchain-certificates:master Feb 8, 2019

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment