node-stratum-pool icon indicating copy to clipboard operation
node-stratum-pool copied to clipboard

util.packInt64LE is actually util.packUInt64LE

Open prydie opened this issue 11 years ago • 0 comments

util.packInt64 does not support negative numbers and is is named incorrectly. This doesn't constitute a major bug, however, as it's only used in the context of numbers that we can assume will always be positive (subscription counter, epoch times, block rewards).

That said, if some hypothetical coin were to be developed where the block reward was negative for some reason it would brake Node Stratum as util.packInt64 is used to calculate the payee reward in lib/transactions.js.

> f(-234)
TypeError: value is out of bounds
    at TypeError (<anonymous>)
    at checkInt (buffer.js:705:11)
    at Buffer.writeUInt32LE (buffer.js:738:5)
    at f (repl:3:6)
    at repl:1:2
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.emit (events.js:95:17)
    at Interface._onLine (readline.js:203:10)
    at Interface._line (readline.js:532:8)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

prydie avatar Dec 21 '14 16:12 prydie