mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
merge
This commit is contained in:
parent
0a8407e69e
commit
45d035e80d
@ -57,7 +57,7 @@ outputs:create_index('unique_search' ,{type='hash', parts={'output_id'}})
|
||||
outputs:create_index('id_search' ,{type='tree', unique=false, parts={'transaction_id'}})
|
||||
|
||||
keys = box.schema.space.create('keys')
|
||||
keys:format({{name = 'id', type='string'}, {name = 'transaction_id', type = 'string'} ,{name = 'output_id', type = 'string'}, {name = 'public_key', type = 'string'}})
|
||||
keys:format({{name = 'id', type='string'}, {name = 'transaction_id', type = 'string'} ,{name = 'output_id', type = 'string'}, {name = 'public_key', type = 'string'}, {name = 'key_index', type = 'integer'}})
|
||||
keys:create_index('id_search', {type = 'hash', parts={'id'}})
|
||||
keys:create_index('keys_search', {type = 'tree', unique=false, parts={'public_key'}})
|
||||
keys:create_index('txid_search', {type = 'tree', unique=false, parts={'transaction_id'}})
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
from secrets import token_hex
|
||||
import copy
|
||||
|
||||
|
||||
def _save_keys_order(dictionary):
|
||||
@ -106,9 +107,11 @@ class TransactionDecompose:
|
||||
# print(f"\noutput: {tmp_output}")
|
||||
_outputs.append(tmp_output)
|
||||
output_index = output_index + 1
|
||||
key_index = 0
|
||||
for _key in _output["public_keys"]:
|
||||
key_id = self.__create_hash(7)
|
||||
_keys.append((key_id, self._transaction["id"], output_id, _key))
|
||||
_keys.append((key_id, self._transaction["id"], output_id, _key, key_index))
|
||||
key_index = key_index + 1
|
||||
return _keys, _outputs
|
||||
|
||||
def __prepare_transaction(self):
|
||||
@ -155,7 +158,7 @@ class TransactionCompose:
|
||||
def _get_inputs(self):
|
||||
_inputs = []
|
||||
for _input in self.db_results["inputs"]:
|
||||
_in = self._map["inputs"].copy()
|
||||
_in = copy.deepcopy(self._map["inputs"])
|
||||
_in["fulfillment"] = _input[1]
|
||||
if _in["fulfills"] is not None:
|
||||
_in["fulfills"]["transaction_id"] = _input[3]
|
||||
@ -164,16 +167,19 @@ class TransactionCompose:
|
||||
_inputs.append(_in)
|
||||
return _inputs
|
||||
|
||||
|
||||
def _get_outputs(self):
|
||||
|
||||
_outputs = []
|
||||
for _output in self.db_results["outputs"]:
|
||||
# print (f"\noutput : {_output}")
|
||||
_out = self._map["outputs"].copy()
|
||||
print(f"\noutput : {_output}")
|
||||
_out = copy.deepcopy(self._map["outputs"])
|
||||
_out["amount"] = _output[1]
|
||||
_out["public_keys"] = [_key[3] for _key in self.db_results["keys"] if _key[2] == _output[5]]
|
||||
_tmp_keys = [(_key[3], _key[4]) for _key in self.db_results["keys"] if _key[2] == _output[5]]
|
||||
_sorted_keys = sorted(_tmp_keys, key=lambda tup: (tup[1]))
|
||||
_out["public_keys"] = [_key[0] for _key in _sorted_keys]
|
||||
|
||||
_out["condition"]["uri"] = _output[2]
|
||||
if self.db_results["outputs"][0][7] is None:
|
||||
if _output[7] is None:
|
||||
_out["condition"]["details"]["type"] = _output[3]
|
||||
_out["condition"]["details"]["public_key"] = _output[4]
|
||||
else:
|
||||
|
||||
@ -369,7 +369,7 @@ def test_muiltiple_in_mix_own_multiple_out_single_own_transfer(alice, b, user_pk
|
||||
tx_transfer_signed = tx_transfer.sign([alice.private_key, user_sk])
|
||||
|
||||
b.store_bulk_transactions([tx_create_signed])
|
||||
|
||||
print(tx_transfer_signed.to_dict())
|
||||
assert tx_transfer_signed.validate(b) == tx_transfer_signed
|
||||
assert len(tx_transfer_signed.outputs) == 1
|
||||
assert tx_transfer_signed.outputs[0].amount == 100
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user