Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
find hash error
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusGautamah committed Nov 21, 2022
1 parent 9b6151e commit 0ae93c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/services/assign_contracts_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def signatures
@signatures ||= []
end

# block master hash is all unique contracts signatures hashed in SHA256
def generate_master_hash
Digest::SHA256.hexdigest(complete_contracts.map(&:signatures).flatten.map(&:signature).join)
end
Expand Down
3 changes: 3 additions & 0 deletions app/services/create_ticket_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ def shuffled_string
def generate_user_acceptable_hash
puts "Shuffled string: #{shuffled_string}"
hash = Digest::SHA256.hexdigest(shuffled_string)
puts "Hash: #{hash}"
block_hash = Digest::SHA256.hexdigest(@transactions.to_json)
puts "Block hash: #{block_hash}"
master_hash = Digest::SHA256.hexdigest(hash + block_hash)
puts "Master hash: #{master_hash}"
[hash, block_hash, master_hash]
end

Expand Down

0 comments on commit 0ae93c7

Please sign in to comment.