You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simplify + clarify random-bytes-fetching from KeysInterface
Due to a desire to be able to override temporary channel IDs and
onion keys, KeysInterface had two separate fetch-random-32-bytes
interfaces - an onion-key specific version which fetched 2 random
32 byte strings and a temporary-channel-id specific version.
It turns out, we never actually need to override both at once (as
creating a new channel and sending an outbound payment are always
separate top-level calls), so there's no reason to add two
functions to the interface when both really do the same thing.
let child_ix = self.session_child_index.fetch_add(1,Ordering::AcqRel);
828
-
let child_privkey = self.session_master_key.ckd_priv(&self.secp_ctx,ChildNumber::from_hardened_idx(child_ix asu32).expect("key space exhausted")).expect("Your RNG is busted");
829
-
sha.input(&child_privkey.private_key.key[..]);
830
-
831
-
letmut rng_seed = sha.clone();
832
-
// Not exactly the most ideal construction, but the second value will get fed into
833
-
// ChaCha so it is another step harder to break.
834
-
rng_seed.input(b"RNG Seed Salt");
835
-
sha.input(b"Session Key Salt");
836
-
(SecretKey::from_slice(&Sha256::from_engine(sha).into_inner()).expect("Your RNG is busted"),
837
-
Sha256::from_engine(rng_seed).into_inner())
838
-
}
839
-
840
-
fnget_channel_id(&self) -> [u8;32]{
841
-
letmut sha = self.derive_unique_start();
842
-
843
-
let child_ix = self.channel_id_child_index.fetch_add(1,Ordering::AcqRel);
844
-
let child_privkey = self.channel_id_master_key.ckd_priv(&self.secp_ctx,ChildNumber::from_hardened_idx(child_ix asu32).expect("key space exhausted")).expect("Your RNG is busted");
820
+
let child_ix = self.rand_bytes_child_index.fetch_add(1,Ordering::AcqRel);
821
+
let child_privkey = self.rand_bytes_master_key.ckd_priv(&self.secp_ctx,ChildNumber::from_hardened_idx(child_ix asu32).expect("key space exhausted")).expect("Your RNG is busted");
let channels = [create_announced_chan_between_nodes(&nodes,0,1,InitFeatures::known(),InitFeatures::known()),create_announced_chan_between_nodes(&nodes,1,2,InitFeatures::known(),InitFeatures::known())];
0 commit comments