diff --git a/bigchaindb/core.py b/bigchaindb/core.py index cb511f10..10369395 100644 --- a/bigchaindb/core.py +++ b/bigchaindb/core.py @@ -217,18 +217,18 @@ class Bigchain(object): else: return None - def get_tx_by_payload_hash(self, payload_hash): + def get_tx_by_payload_uuid(self, payload_uuid): """Retrieves transactions related to a digital asset. When creating a transaction one of the optional arguments is the `payload`. The payload is a generic dict that contains information about the digital asset. - To make it easy to query the bigchain for that digital asset we create a sha3-256 hash of the - serialized payload and store it with the transaction. This makes it easy for developers to keep track - of their digital assets in bigchain. + To make it easy to query the bigchain for that digital asset we create a UUID for the payload and + store it with the transaction. This makes it easy for developers to keep track of their digital + assets in bigchain. Args: - payload_hash (str): sha3-256 hash of the serialized payload. + payload_uuid (str): the UUID for this particular payload. Returns: A list of transactions containing that payload. If no transaction exists with that payload it @@ -236,7 +236,7 @@ class Bigchain(object): """ cursor = r.table('bigchain') \ - .get_all(payload_hash, index='payload_hash') \ + .get_all(payload_uuid, index='payload_uuid') \ .run(self.conn) transactions = list(cursor) diff --git a/bigchaindb/db/utils.py b/bigchaindb/db/utils.py index 726a08b7..882c982c 100644 --- a/bigchaindb/db/utils.py +++ b/bigchaindb/db/utils.py @@ -56,10 +56,6 @@ def init(): r.db(dbname).table('bigchain')\ .index_create('payload_uuid', r.row['block']['transactions']['transaction']['data']['uuid'], multi=True)\ .run(conn) - # secondary index for payload hash - r.db(dbname).table('bigchain')\ - .index_create('payload_hash', r.row['block']['transactions']['transaction']['data']['hash'], multi=True)\ - .run(conn) # wait for rethinkdb to finish creating secondary indexes r.db(dbname).table('backlog').index_wait().run(conn)