Skip to content

Instantly share code, notes, and snippets.

@xeroc
Created February 1, 2018 09:18
Show Gist options
  • Save xeroc/af7cb3e9428ed64353ef9583c3d80faa to your computer and use it in GitHub Desktop.
Save xeroc/af7cb3e9428ed64353ef9583c3d80faa to your computer and use it in GitHub Desktop.
import threading
import pika
import sys
import json
import config
from piston.account import Account
from .models import User
from .maillog import logmodule
from .operationsqueue import OperationsQueue
log = logmodule(__name__)
class Worker(OperationsQueue):
def process(self, op):
##########################
# For account verification
##########################
if (op["type"] == "transfer" and
op.get("to") == config.steem_account):
log.info("Processing Account Verification on block %d" % op["block_num"])
account_name = op["from"]
user = User.query.filter_by(
steem_account=account_name,
steem_confirm_code=op["memo"].strip().lower()
).first()
if user:
user.confirmSteem()
self.updateStatus(op["block_num"])
def run(begin=None, end=None):
worker = Worker(
"account.verify",
["transfer"]
)
worker.start(begin, end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment