mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-02 13:43:06 +00:00
Fix ABI encoding of channel; should be in a tuple
This commit is contained in:
parent
38a6e6ab95
commit
61df75b1a1
@ -12,7 +12,9 @@ type
|
||||
|
||||
proc getChannelId*(channel: Channel): array[32, byte] =
|
||||
var writer: AbiWriter
|
||||
writer.startTuple()
|
||||
writer.write(channel.chainId)
|
||||
writer.write(channel.participants)
|
||||
writer.write(channel.nonce)
|
||||
writer.finishTuple()
|
||||
keccak256.digest(writer.finish()).data
|
||||
|
||||
@ -10,9 +10,11 @@ suite "channel":
|
||||
|
||||
test "calculates channel id":
|
||||
var writer: AbiWriter
|
||||
writer.startTuple()
|
||||
writer.write(channel.chainId)
|
||||
writer.write(channel.participants)
|
||||
writer.write(channel.nonce)
|
||||
writer.finishTuple()
|
||||
let encoded = writer.finish()
|
||||
let hashed = keccak256.digest(encoded).data
|
||||
check getChannelId(channel) == hashed
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user