use FeePolicy in qeswaphelper
This commit is contained in:
@@ -13,6 +13,7 @@ from electrum.logging import get_logger
|
|||||||
from electrum.transaction import PartialTxOutput, PartialTransaction
|
from electrum.transaction import PartialTxOutput, PartialTransaction
|
||||||
from electrum.util import NotEnoughFunds, NoDynamicFeeEstimates, profiler, get_asyncio_loop, age
|
from electrum.util import NotEnoughFunds, NoDynamicFeeEstimates, profiler, get_asyncio_loop, age
|
||||||
from electrum.submarine_swaps import NostrTransport, SwapServerTransport
|
from electrum.submarine_swaps import NostrTransport, SwapServerTransport
|
||||||
|
from electrum.fee_policy import FeePolicy
|
||||||
|
|
||||||
from electrum.gui import messages
|
from electrum.gui import messages
|
||||||
|
|
||||||
@@ -465,10 +466,12 @@ class QESwapHelper(AuthMixin, QObject, QtEventListener):
|
|||||||
return
|
return
|
||||||
outputs = [PartialTxOutput.from_address_and_value(DummyAddress.SWAP, onchain_amount)]
|
outputs = [PartialTxOutput.from_address_and_value(DummyAddress.SWAP, onchain_amount)]
|
||||||
coins = self._wallet.wallet.get_spendable_coins(None)
|
coins = self._wallet.wallet.get_spendable_coins(None)
|
||||||
|
fee_policy = FeePolicy(self._wallet.wallet.config.FEE_POLICY)
|
||||||
try:
|
try:
|
||||||
self._tx = self._wallet.wallet.make_unsigned_transaction(
|
self._tx = self._wallet.wallet.make_unsigned_transaction(
|
||||||
coins=coins,
|
coins=coins,
|
||||||
outputs=outputs)
|
outputs=outputs,
|
||||||
|
fee_policy=fee_policy)
|
||||||
except (NotEnoughFunds, NoDynamicFeeEstimates):
|
except (NotEnoughFunds, NoDynamicFeeEstimates):
|
||||||
self._tx = None
|
self._tx = None
|
||||||
self.valid = False
|
self.valid = False
|
||||||
@@ -599,11 +602,13 @@ class QESwapHelper(AuthMixin, QObject, QtEventListener):
|
|||||||
if max_amount > max_swap_amount:
|
if max_amount > max_swap_amount:
|
||||||
onchain_amount = max_swap_amount
|
onchain_amount = max_swap_amount
|
||||||
outputs = [PartialTxOutput.from_address_and_value(DummyAddress.SWAP, onchain_amount)]
|
outputs = [PartialTxOutput.from_address_and_value(DummyAddress.SWAP, onchain_amount)]
|
||||||
|
fee_policy = FeePolicy(self._wallet.wallet.config.FEE_POLICY)
|
||||||
try:
|
try:
|
||||||
tx = self._wallet.wallet.make_unsigned_transaction(
|
tx = self._wallet.wallet.make_unsigned_transaction(
|
||||||
coins=coins,
|
coins=coins,
|
||||||
outputs=outputs,
|
outputs=outputs,
|
||||||
send_change_to_lightning=False,
|
send_change_to_lightning=False,
|
||||||
|
fee_policy=fee_policy
|
||||||
)
|
)
|
||||||
except (NotEnoughFunds, NoDynamicFeeEstimates) as e:
|
except (NotEnoughFunds, NoDynamicFeeEstimates) as e:
|
||||||
raise InvalidSwapParameters(str(e)) from e
|
raise InvalidSwapParameters(str(e)) from e
|
||||||
|
|||||||
Reference in New Issue
Block a user