Skip to content

Commit 62508e5

Browse files
committed
Simplify CryptoUtil helper
See MetacoSA/NBitcoin#969 (comment)
1 parent 1096aff commit 62508e5

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/GWallet.Backend/UtxoCoin/Lightning/ChannelManagement.fs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ type ChannelInfo =
129129

130130
module internal CryptoUtil =
131131
let internal AccountPrivateKeyToNodeMasterPrivKey (accountKey: Key): NodeMasterPrivKey =
132-
let privateKeyBytesLength = 32
133-
let bytes: array<byte> = Array.zeroCreate privateKeyBytesLength
134-
use bytesStream = new MemoryStream(bytes)
135-
let stream = NBitcoin.BitcoinStream(bytesStream, true)
136-
accountKey.ReadWrite stream
132+
let bytes = accountKey.ToBytes ()
137133
let hashed = NBitcoin.Crypto.Hashes.DoubleSHA256 bytes
138134
NodeMasterPrivKey <| NBitcoin.ExtKey (hashed.ToString())
139135

0 commit comments

Comments
 (0)