Skip to content
Snippets Groups Projects
Commit ed589627 authored by Holger's avatar Holger
Browse files

Fix tests

* fix EllipticCurvePublicNumbers
* Fix empty block return
parent b40660a9
No related branches found
No related tags found
2 merge requests!5Taken current version of master branch in the https://github.com/holgern/beem,!4Original changes pushed to master at https://github.com/holgern/beem
...@@ -131,7 +131,11 @@ class Block(BlockchainObject): ...@@ -131,7 +131,11 @@ class Block(BlockchainObject):
if self.only_ops or self.only_virtual_ops: if self.only_ops or self.only_virtual_ops:
if self.steem.rpc.get_use_appbase(): if self.steem.rpc.get_use_appbase():
try: try:
ops = self.steem.rpc.get_ops_in_block({"block_num": self.identifier, 'only_virtual': self.only_virtual_ops}, api="account_history")["ops"] ops_ops = self.steem.rpc.get_ops_in_block({"block_num": self.identifier, 'only_virtual': self.only_virtual_ops}, api="account_history")
if ops_ops is None:
ops = None
else:
ops = ops["ops"]
except ApiNotSupported: except ApiNotSupported:
ops = self.steem.rpc.get_ops_in_block(self.identifier, self.only_virtual_ops, api="condenser") ops = self.steem.rpc.get_ops_in_block(self.identifier, self.only_virtual_ops, api="condenser")
else: else:
......
...@@ -104,7 +104,7 @@ def recover_public_key(digest, signature, i, message=None): ...@@ -104,7 +104,7 @@ def recover_public_key(digest, signature, i, message=None):
message = py23_bytes(message, "utf-8") message = py23_bytes(message, "utf-8")
sigder = encode_dss_signature(r, s) sigder = encode_dss_signature(r, s)
try: try:
public_key = ec.EllipticCurvePublicNumbers(Q.__x, Q.__y, ec.SECP256K1()).public_key(default_backend()) public_key = ec.EllipticCurvePublicNumbers(Q.x(), Q.y(), ec.SECP256K1()).public_key(default_backend())
except: except:
public_key = ec.EllipticCurvePublicNumbers(Q._Point__x, Q._Point__y, ec.SECP256K1()).public_key(default_backend()) public_key = ec.EllipticCurvePublicNumbers(Q._Point__x, Q._Point__y, ec.SECP256K1()).public_key(default_backend())
public_key.verify(sigder, message, ec.ECDSA(hashes.SHA256())) public_key.verify(sigder, message, ec.ECDSA(hashes.SHA256()))
......
...@@ -18,7 +18,6 @@ from beem.nodelist import NodeList ...@@ -18,7 +18,6 @@ from beem.nodelist import NodeList
from beembase.signedtransactions import Signed_Transaction from beembase.signedtransactions import Signed_Transaction
wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
nodes_appbase = ["https://api.steemitstage.com", "https://api.steem.house", "https://api.steemit.com"]
class Testcases(unittest.TestCase): class Testcases(unittest.TestCase):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment