nim-nitro/nitro/channelupdate.nim

21 lines
522 B
Nim
Raw Normal View History

2021-03-16 12:50:46 +01:00
import ./basics
import ./protocol
include questionable/errorban
type
ChannelUpdate* = object
state*: State
signatures*: seq[(EthAddress, Signature)]
2021-03-17 12:22:00 +01:00
func participants*(update: ChannelUpdate): seq[EthAddress] =
2021-03-16 12:50:46 +01:00
update.state.channel.participants
2021-03-17 12:22:00 +01:00
func verifySignatures*(update: ChannelUpdate): bool =
2021-03-16 12:50:46 +01:00
for (participant, signature) in update.signatures:
if not update.participants.contains(participant):
return false
if not signature.verify(update.state, participant):
return false
true