diff --git a/package.json b/package.json index 798d181..7da9b51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cryptoforknote-util", - "version": "15.3.4", + "version": "15.3.5", "author": { "name": "LucasJones", "email": "lucasjonesdev@hotmail.co.uk" diff --git a/rtm.js b/rtm.js index c135ab0..b691e38 100644 --- a/rtm.js +++ b/rtm.js @@ -149,7 +149,10 @@ function getTransactionBuffers(txs) { } function addressToScript(addr) { - const decoded = base58.decode(addr); + let decoded; + try { + decoded = base58.decode(addr); + } catch(err) {} if (!decoded || decoded.length != 25) { const decoded2 = Buffer.from(bech32.bech32.fromWords(bech32.bech32.decode(addr).words.slice(1))); if (decoded2.length != 20) throw new Error('Invalid address ' + addr); @@ -176,7 +179,7 @@ function generateOutputTransactions(rpcData, poolAddress) { let txOutputBuffers = []; if (rpcData.coinbasedevreward) { - const rewards = createOutputTransaction(rpcData.coinbasedevreward.value, rpcData.coinbasedevreward.address, rewardToPool, reward, txOutputBuffers, rpcData.coinbasedevreward.scriptpubkey); + const rewards = createOutputTransaction(rpcData.coinbasedevreward.value, rpcData.coinbasedevreward.address, rewardToPool, reward, txOutputBuffers, Buffer.from(rpcData.coinbasedevreward.scriptpubkey, 'hex')); reward = rewards.reward; rewardToPool = rewards.rewardToPool; }