nim-nitro/nitro/channelupdate.nim
2021-03-17 12:22:00 +01:00

21 lines
522 B
Nim

import ./basics
import ./protocol
include questionable/errorban
type
ChannelUpdate* = object
state*: State
signatures*: seq[(EthAddress, Signature)]
func participants*(update: ChannelUpdate): seq[EthAddress] =
update.state.channel.participants
func verifySignatures*(update: ChannelUpdate): bool =
for (participant, signature) in update.signatures:
if not update.participants.contains(participant):
return false
if not signature.verify(update.state, participant):
return false
true