mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-23 11:44:19 +01:00
Fix duplicate blank outputs during melt (#795)
* wip blank outputs * wip: working * store ids for promises correctly * tests * fix migraiton * revert * fix tests * fix auth server * fix last tests * retroactively change migration, initial and m017_foreign_keys_proof_tables, remove c_b and replace with c_ (same for b_) * fix constraint * oops * msg stack fix * fix test foreign key constraint * fix postgres tests * foreign key constraint test * should fix psql error * foreign key constraint sqlite * rename to update_blinded_message_signature * drop outputs and change columns from melt_quotes table * switch migration order * reorder migrations again * fix migration * add tests * fix postgres migration too * create signed_at column postgres * foreign key constraingt promises table * migration tool * readme
This commit is contained in:
@@ -231,6 +231,10 @@ class BlindedMessage(BaseModel):
|
||||
id: str # Keyset id
|
||||
B_: str # Hex-encoded blinded message
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: RowMapping):
|
||||
return cls(amount=row["amount"], B_=row["b_"], id=row["id"])
|
||||
|
||||
|
||||
class BlindedMessage_Deprecated(BaseModel):
|
||||
"""
|
||||
@@ -300,7 +304,7 @@ class MeltQuote(LedgerEvent):
|
||||
mint: Optional[str] = None
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row):
|
||||
def from_row(cls, row: Row, change: Optional[List[BlindedSignature]] = None):
|
||||
try:
|
||||
created_time = int(row["created_time"]) if row["created_time"] else None
|
||||
paid_time = int(row["paid_time"]) if row["paid_time"] else None
|
||||
@@ -314,11 +318,6 @@ class MeltQuote(LedgerEvent):
|
||||
|
||||
payment_preimage = row.get("payment_preimage") or row.get("proof") # type: ignore
|
||||
|
||||
# parse change from row as json
|
||||
change = None
|
||||
if "change" in row.keys() and row["change"]:
|
||||
change = json.loads(row["change"])
|
||||
|
||||
outputs = None
|
||||
if "outputs" in row.keys() and row["outputs"]:
|
||||
outputs = json.loads(row["outputs"])
|
||||
|
||||
Reference in New Issue
Block a user