From 8db2744b067025bb31477e7a9059e92194d03075 Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 18 Aug 2022 23:05:04 +0800 Subject: [PATCH] canceling transactions --- funding/orm.py | 72 +++++++++++++++++++++++++++++++- funding/routes.py | 104 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 172 insertions(+), 4 deletions(-) diff --git a/funding/orm.py b/funding/orm.py index 71fa907..5450709 100644 --- a/funding/orm.py +++ b/funding/orm.py @@ -111,8 +111,6 @@ class Slate(db.Model): db.session.rollback() return False - - @classmethod def add(cls, slate, receivingAddress): from funding.factory import db @@ -132,3 +130,73 @@ class Slate(db.Model): except Exception as ex: db.session.rollback() raise + + +class Cancel(db.Model): + __tablename__ = "cancels" + id = db.Column(db.Integer, primary_key=True) + slate_id = db.Column(db.String()) + # TODO: clear slatse that have been in the database past a certain time + posted_time = db.Column(db.DateTime) + receivingAddress = db.Column(db.String(52), nullable=False) + sendersAddress = db.Column(db.String(52), nullable=False) + + def __init__(self, slate_id, receivingAddress, sendersAddress): + from funding.factory import bcrypt + self.slate_id = slate_id + self.receivingAddress = receivingAddress + self.sendersAddress = sendersAddress + self.posted_time = datetime.utcnow() + + def __repr__(self): + return "