Skip to content
Snippets Groups Projects
Commit 1aaabb7f authored by Fabian Schuh's avatar Fabian Schuh
Browse files

cleanup

parent 32b3f5c8
No related branches found
No related tags found
No related merge requests found
...@@ -118,25 +118,15 @@ class Blockchain(object): ...@@ -118,25 +118,15 @@ class Blockchain(object):
* "irreversible": the block that is confirmed by 2/3 of all block producers and is thus irreversible! * "irreversible": the block that is confirmed by 2/3 of all block producers and is thus irreversible!
:param bool only_virtual_ops: Only yield virtual operations :param bool only_virtual_ops: Only yield virtual operations
This call returns a list with elements that look like This call returns a list that only carries one operation and
this and carries only one operation each::: its type!
{'block': 8411453,
'op': ['vote',
{'author': 'dana-edwards',
'permlink': 'church-encoding-numbers-defined-as-functions',
'voter': 'juanmiguelsalas',
'weight': 6000}],
'timestamp': '2017-01-12T12:26:03',
}
""" """
for block in self.blocks(start=start, stop=stop, **kwargs): for block in self.blocks(start=start, stop=stop, **kwargs):
for tx in block["transactions"]: for tx in block["transactions"]:
for op in tx["operations"]: for op in tx["operations"]:
yield { yield {
"block": block["block_num"], "block_num": block["block_num"],
"op": op, "op": op,
"timestamp": block["timestamp"] "timestamp": block["timestamp"]
} }
...@@ -154,21 +144,6 @@ class Blockchain(object): ...@@ -154,21 +144,6 @@ class Blockchain(object):
for op in self.ops(**kwargs): for op in self.ops(**kwargs):
if not opNames or op["op"][0] in opNames: if not opNames or op["op"][0] in opNames:
yield op yield op
def block_time(self, block_num):
""" Returns a datetime of the block with the given block
number.
:param int block_num: Block number
"""
return Block(block_num).time()
def block_timestamp(self, block_num):
""" Returns the timestamp of the block with the given block
number.
:param int block_num: Block number
"""
return int(Block(block_num).time().timestamp())
def awaitTxConfirmation(self, transaction, limit=50): def awaitTxConfirmation(self, transaction, limit=50):
""" Returns the transction as seen by the blockchain after being included into a block """ Returns the transction as seen by the blockchain after being included into a block
...@@ -178,7 +153,6 @@ class Blockchain(object): ...@@ -178,7 +153,6 @@ class Blockchain(object):
``mode="head"``, otherwise, the call will wait until ``mode="head"``, otherwise, the call will wait until
connfirmed in an irreversible block. connfirmed in an irreversible block.
""" """
blocknum = self.get_current_block_num() - 2
counter = 10 counter = 10
for block in self.blocks(): for block in self.blocks():
counter += 1 counter += 1
......
...@@ -77,6 +77,9 @@ class TransactionBuilder(dict): ...@@ -77,6 +77,9 @@ class TransactionBuilder(dict):
from the wallet as defined in "missing_signatures" key from the wallet as defined in "missing_signatures" key
of the transactions. of the transactions.
""" """
# We need to set the default prefix, otherwise pubkeys are
# presented wrongly!
operations.default_prefix = self.bitshares.rpc.chain_params["prefix"]
try: try:
signedtx = Signed_Transaction(**self.json()) signedtx = Signed_Transaction(**self.json())
except: except:
......
default_prefix = "BTS"
known_chains = {"BTS": {"chain_id": "4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8", known_chains = {"BTS": {"chain_id": "4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8",
"core_symbol": "BTS", "core_symbol": "BTS",
"prefix": "BTS"}, "prefix": "BTS"},
......
...@@ -12,9 +12,9 @@ from graphenebase.objects import GrapheneObject, isArgsThisClass ...@@ -12,9 +12,9 @@ from graphenebase.objects import GrapheneObject, isArgsThisClass
from .chains import known_chains from .chains import known_chains
from .objecttypes import object_type from .objecttypes import object_type
from .account import PublicKey from .account import PublicKey
from .chains import default_prefix
from graphenebase.objects import Operation as GPHOperation from graphenebase.objects import Operation as GPHOperation
from .operationids import operations from .operationids import operations
default_prefix = "BTS"
class ObjectId(GPHObjectId): class ObjectId(GPHObjectId):
......
...@@ -9,7 +9,6 @@ from graphenebase.types import ( ...@@ -9,7 +9,6 @@ from graphenebase.types import (
) )
from .objects import GrapheneObject, isArgsThisClass from .objects import GrapheneObject, isArgsThisClass
from .account import PublicKey from .account import PublicKey
from .chains import default_prefix
from .operationids import operations from .operationids import operations
from .objects import ( from .objects import (
Operation, Operation,
...@@ -23,6 +22,8 @@ from .objects import ( ...@@ -23,6 +22,8 @@ from .objects import (
ObjectId ObjectId
) )
default_prefix = "BTS"
def getOperationNameForId(i): def getOperationNameForId(i):
""" Convert an operation id into the corresponding string """ Convert an operation id into the corresponding string
......
...@@ -43,6 +43,7 @@ setup( ...@@ -43,6 +43,7 @@ setup(
install_requires=[ install_requires=[
"graphenelib", "graphenelib",
"websockets==2.0", "websockets==2.0",
"appdirs",
], ],
dependency_links=[ dependency_links=[
"git+https://github.com/xeroc/python-graphenelib@minimal#egg=graphenelib" "git+https://github.com/xeroc/python-graphenelib@minimal#egg=graphenelib"
......
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