Skip to content

Commit

Permalink
Only marked data supplier can show
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiushi committed Dec 19, 2023
1 parent 85da9e1 commit 0f15713
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/public_data_storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ contract PublicDataStorage {
}


function _validPublicSupplier(address supplierAddress, bytes32 dataMixedHash) internal view returns(bool) {
function _validPublicSupplier(address supplierAddress, bytes32 dataMixedHash) internal returns(bool) {
uint256 supplierPledge = supplier_pledge[supplierAddress];
uint64 dataSize = getDataSize(dataMixedHash);
return supplierPledge > 16 * _dataSizeToGWT(dataSize);
Expand All @@ -256,6 +256,7 @@ contract PublicDataStorage {
// show_hash = keccak256(abiEncode[sender, dataMixedHash, prev_block_hash, block_number])
function showData(bytes32 dataMixedHash, bytes32 showHash) public {
address supplier = msg.sender;
require(data_suppliers[dataMixedHash][supplier] == true);
require(_validPublicSupplier(supplier, dataMixedHash));
// 每个块的每个supplier只能show一次数据
require(all_shows[block.number][supplier] == false);
Expand Down

0 comments on commit 0f15713

Please sign in to comment.