From e44da78b2ec7ad7a01589c8b01aa2a75f8cf8375 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Tue, 1 Jun 2021 23:28:20 +0800 Subject: [PATCH] Simplify CryptoUtil helper See https://github.com/MetacoSA/NBitcoin/pull/969#issuecomment-779578712 --- src/GWallet.Backend/UtxoCoin/Lightning/ChannelManagement.fs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/GWallet.Backend/UtxoCoin/Lightning/ChannelManagement.fs b/src/GWallet.Backend/UtxoCoin/Lightning/ChannelManagement.fs index 0ddcf90d8..9f2d9c97d 100644 --- a/src/GWallet.Backend/UtxoCoin/Lightning/ChannelManagement.fs +++ b/src/GWallet.Backend/UtxoCoin/Lightning/ChannelManagement.fs @@ -129,11 +129,7 @@ type ChannelInfo = module internal CryptoUtil = let internal AccountPrivateKeyToNodeMasterPrivKey (accountKey: Key): NodeMasterPrivKey = - let privateKeyBytesLength = 32 - let bytes: array = Array.zeroCreate privateKeyBytesLength - use bytesStream = new MemoryStream(bytes) - let stream = NBitcoin.BitcoinStream(bytesStream, true) - accountKey.ReadWrite stream + let bytes = accountKey.ToBytes () let hashed = NBitcoin.Crypto.Hashes.DoubleSHA256 bytes NodeMasterPrivKey <| NBitcoin.ExtKey (hashed.ToString())