diff --git a/api/logics.py b/api/logics.py index 7049e21c..72122288 100644 --- a/api/logics.py +++ b/api/logics.py @@ -736,9 +736,10 @@ class Logics: valid = cls.create_onchain_payment( order, user, preliminary_amount=context["invoice_amount"] ) - order.log( - f"Suggested mining fee is {order.payout_tx.suggested_mining_fee_rate} Sats/vbyte, the swap fee rate is {order.payout_tx.swap_fee_rate}%" - ) + if order.payout_tx is not None: + order.log( + f"Suggested mining fee is {order.payout_tx.suggested_mining_fee_rate} Sats/vbyte, the swap fee rate is {order.payout_tx.swap_fee_rate}%" + ) if not valid: context["swap_allowed"] = False context[ diff --git a/tests/test_trade_pipeline.py b/tests/test_trade_pipeline.py index 32a39c9e..d27b0197 100644 --- a/tests/test_trade_pipeline.py +++ b/tests/test_trade_pipeline.py @@ -1012,8 +1012,8 @@ class TradeTest(BaseAPITestCase): invoice = add_invoice("robot", response.json()["earned_rewards"]) signed_payout_invoice = sign_message( invoice, - passphrase_path=f"tests/robots/{trade.taker_index}/token", - private_key_path=f"tests/robots/{trade.taker_index}/enc_priv_key", + passphrase_path=f"tests/robots/{trade.maker_index}/token", + private_key_path=f"tests/robots/{trade.maker_index}/enc_priv_key", ) body = { "invoice": signed_payout_invoice, diff --git a/tests/utils/pgp.py b/tests/utils/pgp.py index a269ef7e..7150c64f 100644 --- a/tests/utils/pgp.py +++ b/tests/utils/pgp.py @@ -10,11 +10,11 @@ def sign_message(message, private_key_path, passphrase_path): with open(passphrase_path, "r") as f: passphrase = f.read() - gpg.import_keys(private_key, passphrase=passphrase) + import_result = gpg.import_keys(private_key, passphrase=passphrase) - # keyid=import_result.fingerprints[0] signed_message = gpg.sign( - message, passphrase=passphrase, extra_args=["--digest-algo", "SHA512"] + message, keyid=import_result.fingerprints[0], passphrase=passphrase, + extra_args=["--digest-algo", "SHA512"] ) # [print(name, getattr(signed_message, name)) for name in dir(signed_message) if not callable(getattr(signed_message, name))]