SomberNight
2c962abe51
network: randomise the order of address subscriptions
...
Before this, we were subscribing to our addresses in their bip32 order,
leaking this information to servers. While this leak seems mostly harmless,
it is trivial to fix.
6 years ago
ThomasV
782f9ed273
lnwatcher: use generic callbacks
6 years ago
SomberNight
62be1cc367
small clean-up re "extract preimage from on-chain htlc_tx"
...
related: #6122
6 years ago
ThomasV
8ba7e68064
fix #6122 : extract preimage from on-chain htlc_tx
6 years ago
ThomasV
123b8c1792
(minor) rename chan.sweep_htlc
6 years ago
SomberNight
2b1a150c52
multi-wallet: properly stop lnworker/lnwatcher
6 years ago
ThomasV
bdb870af00
follow-up c454564ed6
6 years ago
ThomasV
9224404108
Move callback manager out of Network class
6 years ago
SomberNight
8e8ab775eb
lnchannel: make AbstractChannel inherit ABC
...
and add some type annotations, clean up method signatures
6 years ago
ThomasV
8f41aeb783
Replace wallet backup with channel backups
...
- channels can be backed up individually
- backups are added to lnwatcher
- AbstractChannel ancestor class
6 years ago
ThomasV
aa32e31a3d
follow-up previous commit
6 years ago
ThomasV
06dfe1699c
LNWatcher: Distinguish between blockchain-triggered channel state
...
transitions, and actions taken as a result.
- state transitions are performed in lnchannel.update_onchain_state()
- peer actions are in LNWorker.on_channel_update()
6 years ago
SomberNight
79d57784c1
lnchannel: add more type hints
6 years ago
SomberNight
ec6be665d5
lnwatcher: unwatch deeply mined channels
...
reduces log spam generated by "REDEEMED" channels...
6 years ago
ThomasV
8b63f7176e
Add short channel id to tx labels
6 years ago
ThomasV
3c111471e9
Fix bug with save_funding_height, save_closing_height
...
(it would enter a state where only closing_height was saved)
6 years ago
SomberNight
931d961721
lnpeer/lnwatcher: include channel id in log lines
6 years ago
ThomasV
5785c2fa2f
Fix #5975 : Forget or redeem channels that are never funded.
...
- initiator: wait until double spent
- non-initiator: wait until timeout
6 years ago
ThomasV
20d8da7e24
db upgrade: store channel tx height and timestamps in 'channels'
6 years ago
ThomasV
9616333b39
add_future_tx should return success
6 years ago
ThomasV
874efc125d
(minor) trigger 'wallet_updated' callback when adding future tx
6 years ago
ThomasV
3329d9dd0e
lnwatcher: fix keep_watching if the wallet was not force-closed
6 years ago
ThomasV
fe4ca4c466
follow-up previous commit
6 years ago
ThomasV
c9e39d3a79
remove channel from channel_timestamps if funding_tx has been dropped from mempool
6 years ago
SomberNight
d1fc4399e6
lnwatcher: use is_mine(addr) instead of (addr in get_addresses())
...
small performance gain
6 years ago
ThomasV
72f4e83333
fix race in check_onchain_situation
6 years ago
ThomasV
6e6e829ef7
breach remedy: get spender transaction from LNWatcher's db
6 years ago
ThomasV
938fab86d1
detect redeemed channels ( fix #5963 )
6 years ago
ThomasV
f8da0f87a7
follow-up previous commit
6 years ago
ThomasV
3a35f90aa0
Do not use network callback to update channel states; call LNWorker methods directly instead.
...
A callback was used because a single LNWnwatcher object used to be shared for all wallets.
Since wallet now have their own LNWatcher instance, this can be simplified.
6 years ago
ThomasV
dba6cb8a96
lnwatcher: use height == TX_HEIGHT_LOCAL to determine channel onchain state
6 years ago
ThomasV
149cd9598a
Separate JsonDB and WalletDB
6 years ago
ThomasV
cded582fe9
Start watchtower if run_watchtower is set, even if lightning is not activated ( fix #5896 ).
...
Fix parameters of sweepstore.add_sweep_tx, rm dead code.
6 years ago
ThomasV
61dfcba092
Refactor channel states:
...
- persisted states are saved
- state transitions are checked
- transient states are stored in channel.peer_state
- new channel states: 'PREOPENING', 'FUNDED' and 'REDEEMED'
- upgrade storage to version 21
6 years ago
ThomasV
8e08ca7cb1
simplify network callbacks in lnworker
6 years ago
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP
6 years ago
SomberNight
ccccaf099f
(trivial) logging "verbosity_filter" was renamed to "LOGGING_SHORTCUT"
6 years ago
SomberNight
75902f8e35
fix logic error in lnworker.on_channel_closed
6 years ago
ThomasV
215dc96de7
define LNWatcher.do_breach_remedy
6 years ago
SomberNight
befa8ea771
transaction: kill "name", "csv_delay", "cltv_expiry" fields
6 years ago
ThomasV
e5502a58ba
uncomment breach_remedy in watchtower
6 years ago
ThomasV
de29fe6930
remove unused import
6 years ago
ThomasV
740381e993
fix: remove unused parameter to add_sweep_tx
6 years ago
ThomasV
f7c05f2602
Synchronize watchtower asynchronously:
...
- remove remote_commitment_to_be_revoked
- pass old ctns to lnsweep.create_sweeptxs_for_watchtower
- store the ctn of sweeptxs in sweepStore database
- request the highest ctn from sweepstore using get_ctn
- send sweeptxs asynchronously in LNWallet.sync_with_watchtower
6 years ago
ThomasV
2be68ac4d2
Use one LNWatcher instance per wallet
6 years ago
ThomasV
c7b9bdc5f5
lnwatcher: wait until lnwatcher is fully synchronized before check_onchain_situation
6 years ago
ThomasV
a8ce8109be
Perform breach remedy without sweepstore:
...
- add functions to lnsweep
- lnworker: analyze candidate ctx and htlc_tx
- watchtower will be optional
- add test for breach remedy with spent htlcs
- save tx name as label
6 years ago
ThomasV
238f3c949c
get rid of sql_alchemy
6 years ago
ThomasV
f2d58d0e3f
optimize channel_db:
...
- use python objects mirrored by sql database
- write sql to file asynchronously
- the sql decorator is awaited in sweepstore, not in channel_db
6 years ago
ThomasV
7be4cdaf18
redeem htlcs:
...
- fix bug in lnsweep: lnwatcher transactions were indexed by prev_txid
- add test for breach remedy with unsettled htlcs
- add timeout option to lnpay, and replace DO_NOT_SETTLE with SETTLE_DELAY
so that we can read intermediate commitment tx in regtest
6 years ago