nim-nitro/nitro/wallet/signedstate.nim
Jacek Sieka a15660f70f
chore: fix import conflict
There's a new byteutils in newer versions of stew - also, remove
upraises and disable windows testing which requires SSL library install
2025-12-10 22:06:29 +01:00

29 lines
725 B
Nim

import ../basics
import ../protocol
{.push raises: [].}
type
SignedState* = object
state*: State
signatures*: seq[Signature]
func hasParticipant*(signed: SignedState, participant: EthAddress): bool =
signed.state.channel.participants.contains(participant)
func isSignedBy*(signed: SignedState, account: EthAddress): bool =
for signature in signed.signatures:
if signer =? signature.recover(signed.state):
if signer == account:
return true
false
func verifySignatures*(signed: SignedState): bool =
for signature in signed.signatures:
if signer =? signature.recover(signed.state):
if not signed.hasParticipant(signer):
return false
else:
return false
true