Skip to content
Snippets Groups Projects
Commit 7b89cad7 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Tratando de hacer el SC acceptar una lista. Falta actualizar el ABI en local_settings.py

parent cf1a8a77
No related branches found
No related tags found
1 merge request!1replayfix+listfeature
...@@ -8,9 +8,16 @@ contract ProofOfExistence { ...@@ -8,9 +8,16 @@ contract ProofOfExistence {
mapping (uint256 => Dato) private hashstore; mapping (uint256 => Dato) private hashstore;
function stamp(uint256 ots, uint256 file_hash) public { function stamp(uint256[] incoming) public {
if ( hashstore[ots] == 0 ) uint256 len = incoming.length;
hashstore[ots] = Dato({blockNumber: block.number, hash: file_hash}); uint256 i = 0;
while ( i+1 < len )
{
uint256 ots = incoming[i++];
uint256 file_hash = incoming[i++];
if ( hashstore[ots] == 0 )
hashstore[ots] = Dato({blockNumber: block.number, hash: file_hash});
}
} }
function verify(uint256 ots, uint256 file_hash) public view returns(bool){ function verify(uint256 ots, uint256 file_hash) public view returns(bool){
......
...@@ -52,7 +52,7 @@ class TimestampManager(models.Manager): ...@@ -52,7 +52,7 @@ class TimestampManager(models.Manager):
def stamp(ots_hash, file_hash): def stamp(ots_hash, file_hash):
contract = TimestampManager.get_current_contract() contract = TimestampManager.get_current_contract()
return contract.functions.stamp(ots_hash, file_hash).transact({'from': Web3.toChecksumAddress(ACCOUNT_ADDRESS)}) return contract.functions.stamp([ots_hash, file_hash]).transact({'from': Web3.toChecksumAddress(ACCOUNT_ADDRESS)})
@staticmethod @staticmethod
def verify(contract_version, ots_hash, file_hash): def verify(contract_version, ots_hash, file_hash):
......
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