----------------------------------------------------------------------------
-- Vote
----------------------------------------------------------------------------

vote
    :: MonadAuxxMode m
    => ProtocolMagic
    -> Diffusion m
    -> Int
    -> Bool
    -> UpId
    -> m ()
vote pm diffusion idx decision upid = do
    logDebug $ "Submitting a vote :" <> show (idx, decision, upid)
    skey <- (!! idx) <$> getSecretKeysPlain
    mbVoteUpd <- withSafeSigner skey (pure emptyPassphrase) $ mapM $ \signer ->
        pure $ mkUpdateVoteSafe pm signer upid decision
    case mbVoteUpd of
        Nothing -> logError "Invalid passphrase"
        Just voteUpd -> do
            submitVote diffusion voteUpd
            logInfo "Submitted vote"

----------------------------------------------------------------------------
-- Propose, hash installer
----------------------------------------------------------------------------
vote
    :: MonadAuxxMode m
    => ProtocolMagic
    -> Diffusion m
    -> Int
    -> Bool
    -> UpId
    -> m ()
vote pm diffusion idx decision upid = do
    logDebug $ "Submitting a vote :" <> show (idx, decision, upid)
    skey <- (!! idx) <$> getSecretKeysPlain
    mbVoteUpd <- withSafeSigner skey (pure emptyPassphrase) $ mapM $ \signer ->
        pure $ mkUpdateVoteSafe pm signer upid decision
    case mbVoteUpd of
        Nothing -> logError "Invalid passphrase"
        Just voteUpd -> do
            submitVote diffusion voteUpd
            logInfo "Submitted vote"

----------------------------------------------------------------------------
-- Propose, hash installer
----------------------------------------------------------------------------
vote pm diffusion idx decision upid = do
    logDebug $ "Submitting a vote :" <> show (idx, decision, upid)
    skey <- (!! idx) <$> getSecretKeysPlain
    mbVoteUpd <- withSafeSigner skey (pure emptyPassphrase) $ mapM $ \signer ->
        pure $ mkUpdateVoteSafe pm signer upid decision
    case mbVoteUpd of
        Nothing -> logError "Invalid passphrase"
        Just voteUpd -> do
            submitVote diffusion voteUpd
            logInfo "Submitted vote"

----------------------------------------------------------------------------
-- Propose, hash installer
----------------------------------------------------------------------------