Skip to content

Commit

Permalink
Pass in network config
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cardona committed Jul 26, 2018
1 parent 2982070 commit 27352b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ io.on('connection', (socket) => {
sock.on('message', (topic, message) => {
let decoded = topic.toString('ascii');
if(decoded === 'rawtx') {
let network = {'pubKeyHash': 0x00, 'scriptHash': 0x05};
let network;
if(process.env.NETWORK === 'mainnet') {
network = {'pubKeyHash': 0x00, 'scriptHash': 0x05};
} else if(process.env.NETWORK === 'testnet') {
network = {'pubKeyHash': 0x6F, 'scriptHash': 0xC4};
}
let txd = new TxDecoder(message, network);
io.emit('transactions', JSON.stringify(txd.toObject(), null, 2));
} else if(decoded === 'rawblock') {
Expand Down

0 comments on commit 27352b8

Please sign in to comment.