Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible conditional error on line 22 in blackjack.js #37

Open
miroosama opened this issue Sep 25, 2018 · 1 comment
Open

Possible conditional error on line 22 in blackjack.js #37

miroosama opened this issue Sep 25, 2018 · 1 comment

Comments

@miroosama
Copy link

I was running into an issue passing the conditional on line 22 of blackjack.js

if ((inAccum + inputValue) > (outAccum + fee + threshold)) continue

despite having a greater sum of inAccum + inputValue than outAccum + fee + threshold

I changed the conditional to

if ((inAccum + inputValue) > (outAccum + fee + threshold)){

and was able to generate the correct response of hitting

return utils.finalize(inputs, outputs, feeRate)

The original error would read cannot forEach on inputs value of Undefined because I was only being returned a fee from the else

return { fee: feeRate * bytesAccum }

@dcousens
Copy link
Contributor

dcousens commented Sep 25, 2018

Blackjack attempts to hit the target value, but not exceed it by threshold.
You probably want an accumulative strategy instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants