Closed philipcmonk closed 5 years ago
It's because this language is for psychopaths.
> foo
ArrayBuffer { byteLength: 32 }
> Buffer.from(foo)
<Buffer 2c f2 4d ba 5f b0 a3 0e 26 e8 3b 2a c5 b9 e2 9e 1b 16 1e 5c 1f a7 42 5e 73 04 33 62 93 8b 98 24>
> [foo]
[ ArrayBuffer { byteLength: 32 } ]
> [ Buffer.from(foo) ]
[ <Buffer 2c f2 4d ba 5f b0 a3 0e 26 e8 3b 2a c5 b9 e2 9e 1b 16 1e 5c 1f a7 42 5e 73 04 33 62 93 8b 98 24> ]
> [ foo ].map(Buffer.from)
[ <Buffer > ]
I guess I'll change it to explicitly take an argument:
> [foo].map(x => Buffer.from(x))
[ <Buffer 2c f2 4d ba 5f b0 a3 0e 26 e8 3b 2a c5 b9 e2 9e 1b 16 1e 5c 1f a7 42 5e 73 04 33 62 93 8b 98 24> ]
deriveNetworkSeed
gives the same output for all revision numbers greater than 0. I think it has something to do with thedhash
definition. If I swap that line for:then I get different values for different revisions. I don't understand buffers here, but the sha256 function looks like it's calling
Buffer.from
on the arguments anyway, so I can't figure out why that would be necessary.@jtobin Could you take a look at this?