bitcore-channel
bitcore-channel copied to clipboard
setupRefund() failing
hi there,
when following the docs and examples to set up a channel, i get this error:
bitcore-channel.js:140 Uncaught TypeError: Cannot read property 'script' of undefined
this happens because outputs[] is empty. the insight api call however does return utxo transactions. so i assume that something in Consumer.processFunding() is not parsing them properly.
my code:
var consumer = new Consumer({
network: 'testnet',
fundingKey: fundingKey,
refundKey: refundKey,
commitmentKey: commitmentKey,
providerPublicKey: providerPublicKey,
});
var insight = new Insight(bitcore.Networks.testnet);
insight.getUnspentUtxos(consumer.fundingAddress, function(err, utxos) {
consumer.processFunding(utxos);
consumer.setupRefund();
});
any clues?
some more info related to this bug here: https://labs.bitpay.com/t/payment-channels-consumer-setuprefund-failing/416
Thanks for reporting, will take a look now
any chance we'll have more insight before the weekend? ;)
The problem is bigger than we expected. We'll review this in a few weeks, as it's not a priority for us now. Sorry! Feel free to provide a fixing PR if you find a solution on your own :)
Thanks @maraoz ! It seems you do have a clue as to where the problem may be located, at least roughly. Could you provide a guesstimate? :-)
Also, would we encounter the same problem when reimplementing the microtx-channel functionality simply with general bitcore API? Basically following the publicly available specs for such channels but using bitcore's simplified API for building transactions etc.?
Cheers
I wrote a fix for this, but am confused how to use gulp. Will make a pull request once this happens.
Will somebody explain how to run "gulp lint" on bitcore-channel?
I have gulp installed globally via sudo npm install -g gulp. Running gulp in bitcore-channel asks for bitcore-build, so I do sudo npm install bitcore-build. Running gulp then produces "Task 'lint' is not in your gulpfile"
I think I'm missing details on how bitcore-build and bitcore-channel are supposed to be related. Maybe the gulp files are shared? sorry for being such a n00b
I believe the latest merge takes care of this.