localconfig: rename seed to channel_seed
This commit is contained in:
@@ -483,13 +483,8 @@ class Peer(Logger):
|
||||
return bool(self.features & LnFeatures.OPTION_STATIC_REMOTEKEY_OPT)
|
||||
|
||||
def make_local_config(self, funding_sat: int, push_msat: int, initiator: HTLCOwner) -> LocalConfig:
|
||||
|
||||
random_seed = os.urandom(32)
|
||||
if initiator == LOCAL:
|
||||
initial_msat = funding_sat * 1000 - push_msat
|
||||
else:
|
||||
initial_msat = push_msat
|
||||
|
||||
channel_seed = os.urandom(32)
|
||||
initial_msat = funding_sat * 1000 - push_msat if initiator == LOCAL else push_msat
|
||||
if self.is_static_remotekey():
|
||||
# Note: in the future, if a CSV delay is added,
|
||||
# we will want to derive that key
|
||||
@@ -499,9 +494,8 @@ class Peer(Logger):
|
||||
static_remotekey = bfh(wallet.get_public_key(addr))
|
||||
else:
|
||||
static_remotekey = None
|
||||
|
||||
local_config = LocalConfig.from_seed(
|
||||
seed=random_seed,
|
||||
channel_seed=channel_seed,
|
||||
static_remotekey=static_remotekey,
|
||||
to_self_delay=DEFAULT_TO_SELF_DELAY,
|
||||
dust_limit_sat=546,
|
||||
|
||||
@@ -77,7 +77,7 @@ class Config(StoredObject):
|
||||
|
||||
@attr.s
|
||||
class LocalConfig(Config):
|
||||
seed = attr.ib(type=bytes, converter=hex_to_bytes) # type: Optional[bytes]
|
||||
channel_seed = attr.ib(type=bytes, converter=hex_to_bytes) # type: Optional[bytes]
|
||||
funding_locked_received = attr.ib(type=bool)
|
||||
was_announced = attr.ib(type=bool)
|
||||
current_commitment_signature = attr.ib(type=bytes, converter=hex_to_bytes)
|
||||
@@ -86,9 +86,9 @@ class LocalConfig(Config):
|
||||
|
||||
@classmethod
|
||||
def from_seed(self, **kwargs):
|
||||
seed = kwargs['seed']
|
||||
channel_seed = kwargs['channel_seed']
|
||||
static_remotekey = kwargs.pop('static_remotekey')
|
||||
node = BIP32Node.from_rootseed(seed, xtype='standard')
|
||||
node = BIP32Node.from_rootseed(channel_seed, xtype='standard')
|
||||
keypair_generator = lambda family: generate_keypair(node, family)
|
||||
kwargs['per_commitment_secret_seed'] = keypair_generator(LnKeyFamily.REVOCATION_ROOT).privkey
|
||||
kwargs['multisig_key'] = keypair_generator(LnKeyFamily.MULTISIG)
|
||||
|
||||
@@ -70,7 +70,7 @@ def create_channel_state(funding_txid, funding_index, funding_sat, is_initiator,
|
||||
current_per_commitment_point=cur,
|
||||
),
|
||||
"local_config":lnpeer.LocalConfig(
|
||||
seed = None,
|
||||
channel_seed = None,
|
||||
payment_basepoint=privkeys[0],
|
||||
multisig_key=privkeys[1],
|
||||
htlc_basepoint=privkeys[2],
|
||||
|
||||
@@ -602,7 +602,7 @@ class WalletDB(JsonDB):
|
||||
return
|
||||
channels = self.data.get('channels', {})
|
||||
for channel_id, c in channels.items():
|
||||
c['local_config']['seed'] = None
|
||||
c['local_config']['channel_seed'] = None
|
||||
self.data['seed_version'] = 28
|
||||
|
||||
def _convert_imported(self):
|
||||
|
||||
Reference in New Issue
Block a user