mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 01:11:35 +00:00
parent
261ad804ca
commit
ea3e3ddbb8
4 changed files with 18 additions and 13 deletions
|
@ -30,7 +30,7 @@ from typing import TYPE_CHECKING, Dict, Optional, Set, Tuple, NamedTuple, Sequen
|
|||
|
||||
from . import bitcoin, util
|
||||
from .bitcoin import COINBASE_MATURITY
|
||||
from .util import profiler, bfh, TxMinedInfo
|
||||
from .util import profiler, bfh, TxMinedInfo, UnrelatedTransactionException
|
||||
from .transaction import Transaction, TxOutput, TxInput, PartialTxInput, TxOutpoint, PartialTransaction
|
||||
from .synchronizer import Synchronizer
|
||||
from .verifier import SPV
|
||||
|
@ -48,14 +48,6 @@ TX_HEIGHT_LOCAL = -2
|
|||
TX_HEIGHT_UNCONF_PARENT = -1
|
||||
TX_HEIGHT_UNCONFIRMED = 0
|
||||
|
||||
class AddTransactionException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class UnrelatedTransactionException(AddTransactionException):
|
||||
def __str__(self):
|
||||
return _("Transaction is unrelated to this wallet.")
|
||||
|
||||
|
||||
class HistoryItem(NamedTuple):
|
||||
txid: str
|
||||
|
|
|
@ -60,12 +60,12 @@ from electrum.util import (format_time,
|
|||
UserFacingException,
|
||||
get_new_wallet_name, send_exception_to_crash_reporter,
|
||||
InvalidBitcoinURI, maybe_extract_bolt11_invoice, NotEnoughFunds,
|
||||
NoDynamicFeeEstimates, MultipleSpendMaxTxOutputs)
|
||||
NoDynamicFeeEstimates, MultipleSpendMaxTxOutputs,
|
||||
AddTransactionException)
|
||||
from electrum.invoices import PR_TYPE_ONCHAIN, PR_TYPE_LN, PR_DEFAULT_EXPIRATION_WHEN_CREATING, Invoice
|
||||
from electrum.invoices import PR_PAID, PR_FAILED, pr_expiration_values, LNInvoice, OnchainInvoice
|
||||
from electrum.transaction import (Transaction, PartialTxInput,
|
||||
PartialTransaction, PartialTxOutput)
|
||||
from electrum.address_synchronizer import AddTransactionException
|
||||
from electrum.wallet import (Multisig_Wallet, CannotBumpFee, Abstract_Wallet,
|
||||
sweep_preparations, InternalAddressCorruption)
|
||||
from electrum.version import ELECTRUM_VERSION
|
||||
|
|
|
@ -23,7 +23,8 @@ from . import bitcoin, util
|
|||
from . import ecc
|
||||
from .ecc import sig_string_from_r_and_s, get_r_and_s_from_sig_string, der_sig_from_sig_string
|
||||
from . import constants
|
||||
from .util import bh2u, bfh, log_exceptions, ignore_exceptions, chunks, SilentTaskGroup
|
||||
from .util import (bh2u, bfh, log_exceptions, ignore_exceptions, chunks, SilentTaskGroup,
|
||||
UnrelatedTransactionException)
|
||||
from . import transaction
|
||||
from .transaction import Transaction, TxOutput, PartialTxOutput, match_script_against_template
|
||||
from .logging import Logger
|
||||
|
@ -1518,7 +1519,10 @@ class Peer(Logger):
|
|||
signing_pubkey=chan.config[REMOTE].multisig_key.pubkey.hex(),
|
||||
sig=bh2u(der_sig_from_sig_string(their_sig) + b'\x01'))
|
||||
# save local transaction and set state
|
||||
self.lnworker.wallet.add_transaction(closing_tx)
|
||||
try:
|
||||
self.lnworker.wallet.add_transaction(closing_tx)
|
||||
except UnrelatedTransactionException:
|
||||
pass # this can happen if (~all the balance goes to REMOTE)
|
||||
chan.set_state(ChannelState.CLOSING)
|
||||
# broadcast
|
||||
await self.network.try_broadcasting(closing_tx, 'closing')
|
||||
|
|
|
@ -119,6 +119,15 @@ class InvalidPassword(Exception):
|
|||
return _("Incorrect password")
|
||||
|
||||
|
||||
class AddTransactionException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class UnrelatedTransactionException(AddTransactionException):
|
||||
def __str__(self):
|
||||
return _("Transaction is unrelated to this wallet.")
|
||||
|
||||
|
||||
class FileImportFailed(Exception):
|
||||
def __init__(self, message=''):
|
||||
self.message = str(message)
|
||||
|
|
Loading…
Add table
Reference in a new issue