mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
storage upgrade: move "htlc_minimum_msat" to base channel config
This commit is contained in:
parent
53c6fc8cf1
commit
01207316aa
4 changed files with 15 additions and 4 deletions
|
@ -504,6 +504,7 @@ class Peer(Logger):
|
|||
was_announced=False,
|
||||
current_commitment_signature=None,
|
||||
current_htlc_signatures=b'',
|
||||
htlc_minimum_msat=1,
|
||||
)
|
||||
return local_config
|
||||
|
||||
|
@ -536,7 +537,7 @@ class Peer(Logger):
|
|||
max_htlc_value_in_flight_msat=local_config.max_htlc_value_in_flight_msat,
|
||||
channel_flags=0x00, # not willing to announce channel
|
||||
channel_reserve_satoshis=local_config.reserve_sat,
|
||||
htlc_minimum_msat=1,
|
||||
htlc_minimum_msat=local_config.htlc_minimum_msat,
|
||||
)
|
||||
payload = await self.wait_for_message('accept_channel', temp_channel_id)
|
||||
remote_per_commitment_point = payload['first_per_commitment_point']
|
||||
|
|
|
@ -69,6 +69,7 @@ class Config(StoredObject):
|
|||
max_accepted_htlcs = attr.ib(type=int)
|
||||
initial_msat = attr.ib(type=int)
|
||||
reserve_sat = attr.ib(type=int)
|
||||
htlc_minimum_msat = attr.ib(type=int)
|
||||
|
||||
@attr.s
|
||||
class LocalConfig(Config):
|
||||
|
@ -80,7 +81,6 @@ class LocalConfig(Config):
|
|||
|
||||
@attr.s
|
||||
class RemoteConfig(Config):
|
||||
htlc_minimum_msat = attr.ib(type=int)
|
||||
next_per_commitment_point = attr.ib(type=bytes, converter=hex_to_bytes)
|
||||
current_per_commitment_point = attr.ib(default=None, type=bytes, converter=hex_to_bytes)
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ def create_channel_state(funding_txid, funding_index, funding_sat, is_initiator,
|
|||
was_announced=False,
|
||||
current_commitment_signature=None,
|
||||
current_htlc_signatures=None,
|
||||
htlc_minimum_msat=1,
|
||||
),
|
||||
"constraints":lnpeer.ChannelConstraints(
|
||||
capacity=funding_sat,
|
||||
|
|
|
@ -50,7 +50,7 @@ if TYPE_CHECKING:
|
|||
|
||||
OLD_SEED_VERSION = 4 # electrum versions < 2.0
|
||||
NEW_SEED_VERSION = 11 # electrum versions >= 2.0
|
||||
FINAL_SEED_VERSION = 26 # electrum >= 2.7 will set this to prevent
|
||||
FINAL_SEED_VERSION = 27 # electrum >= 2.7 will set this to prevent
|
||||
# old versions from overwriting new format
|
||||
|
||||
|
||||
|
@ -172,6 +172,7 @@ class WalletDB(JsonDB):
|
|||
self._convert_version_24()
|
||||
self._convert_version_25()
|
||||
self._convert_version_26()
|
||||
self._convert_version_27()
|
||||
self.put('seed_version', FINAL_SEED_VERSION) # just to be sure
|
||||
|
||||
self._after_upgrade_tasks()
|
||||
|
@ -587,6 +588,14 @@ class WalletDB(JsonDB):
|
|||
c['closing_height'] = closing_txid, closing_height, closing_timestamp
|
||||
self.data['seed_version'] = 26
|
||||
|
||||
def _convert_version_27(self):
|
||||
if not self._is_upgrade_method_needed(26, 26):
|
||||
return
|
||||
channels = self.data.get('channels', {})
|
||||
for channel_id, c in channels.items():
|
||||
c['local_config']['htlc_minimum_msat'] = 1
|
||||
self.data['seed_version'] = 27
|
||||
|
||||
def _convert_imported(self):
|
||||
if not self._is_upgrade_method_needed(0, 13):
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue