zone117x / node-stratum-pool

High performance Stratum poolserver in Node.js
GNU General Public License v2.0
418 stars 851 forks source link

TypeError [ERR_INVALID_ARG_TYPE] #181

Closed knkrth closed 4 years ago

knkrth commented 4 years ago

Using the latest bitcoin v20 I got the following error,

$ node init.js 
2020-05-01 08:14:53 [POSIX]     [Connection Limit] (Safe to ignore) POSIX module not installed and resource (connection) limit was not raised
2020-05-01 08:14:53 [Master]    [CLI] CLI listening on port 17117
2020-05-01 08:14:53 [Master]    [PoolSpawner] Spawned 1 pool(s) on 1 thread(s)
2020-05-01 08:14:55 [Website]   [Server] Website started on 0.0.0.0:8080
2020-05-01 08:14:55 [Payments]  [bitcoin] Payment processing setup to run every 20 second(s) with daemon (root@127.0.0.1:8332) and redis (127.0.0.1:6379)
2020-05-01 08:14:55 [Payments]  [bitcoin] Finished interval - time spent: 9ms total, 6ms redis, 3ms daemon RPC
(node:27201) DeprecationWarning: (node-watch) First param in callback function  is replaced with event name since 0.5.0, use  `(evt, filename) => {}` if you want to get the filename
2020-05-01 08:14:55 [Switching] [Setup] (Thread 1) Loading last proxy state from redis
2020-05-01 08:14:55 [Pool]      [bitcoin] (Thread 1) Share processing setup with redis (127.0.0.1:6379)
(node:27214) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
buffer.js:207
    throw new ERR_INVALID_ARG_TYPE(
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined
    at Function.from (buffer.js:207:11)
    at Object.exports.CreateGeneration (/home/workspace/nomp/node_modules/stratum-pool/lib/transactions.js:248:16)
    at new BlockTemplate (/home/workspace/nomp/node_modules/stratum-pool/lib/blockTemplate.js:68:47)
    at JobManager.processTemplate (/home/workspace/nomp/node_modules/stratum-pool/lib/jobManager.js:146:32)
    at /home/workspace/nomp/node_modules/stratum-pool/lib/pool.js:587:62
    at itemFinished (/home/workspace/nomp/node_modules/stratum-pool/lib/daemon.js:156:36)
    at /home/workspace/nomp/node_modules/stratum-pool/lib/daemon.js:169:17
    at parseJson (/home/workspace/nomp/node_modules/stratum-pool/lib/daemon.js:85:17)
    at IncomingMessage.<anonymous> (/home/workspace/nomp/node_modules/stratum-pool/lib/daemon.js:95:17)
    at IncomingMessage.emit (events.js:203:15)
2020-05-01 08:14:55 [Master]    [PoolSpawner] Fork 0 died, spawning replacement worker...
knkrth commented 4 years ago

Fixed the issue by commit-out the line #L248

ie,

var scriptSigPart1 = Buffer.concat([
        util.serializeNumber(rpcData.height),
        // new Buffer(rpcData.coinbaseaux.flags, 'hex'), /* commit-out */
        util.serializeNumber(Date.now() / 1000 | 0),
        new Buffer([extraNoncePlaceholder.length])
    ]);
decryp2kanon commented 3 years ago

thanks! you saved my day