Comments (4)
single UTXO provided
whats the purpose of using coinselect then?
from coinselect.
single UTXO provided
whats the purpose of using coinselect then?
For fee calculation and output preparation for Psbt
. Did another test with another wallet that had two UTXOs, this time it continued on the "waste" check and hit this:
Line 32 in 1f7cd37
And hit "waste" the second time, which it returns the fee only.
from coinselect.
so i would suggest that solution was indeed not found, to satisfy the requested feerate.
provide a test vector so we can check this hypothesis
from coinselect.
I was attempting to use blackjack
and based upon writing tests for it, is it correct that blackjack
will only be successful if there fee available within a certain threshold (upper and lower bounds)?
That's what it sounds like from the documentation, but it was not very clear to me that it will always fail if not within this threshold, maybe a clearer instruction that using blackjack
should only be done if one already knows what the threshold beforehand?
Blackjack - accumulates inputs until the target value (+fees) is matched, does not accumulate inputs that go over the target value (within a threshold)
The require('coinselect')
will attempt to do blackjack
first, it will not happen very often (in a normal wallet user scenario) where an input is found that is very close match to output (+ fee threshold), so the optimization you get from blackjack
, which I presume is to attempt to find an UTXOs that is within the range of the output, is most often wasted resources?
Using blackjack
:
var feeRate = 10
// Works (return fee and inputs/outputs):
coinSelectBlackjack([{ vout: 0, value: 303400 }], [{ value: 300000 }], feeRate)
coinSelectBlackjack([{ vout: 0, value: 301920 }], [{ value: 300000 }], feeRate)
// "Fails" and returns only { fee: 1920 } (which is required for it to work)
coinSelectBlackjack([{ vout: 0, value: 301919 }], [{ value: 300000 }], feeRate)
// "Fails" and returns only { fee: 440 }. This is the "problematic" scenario that I've been debugging.
// Consequence is that `blackjack` cannot be used as the sole method of coinselect.
coinSelectBlackjack([{ vout: 0, value: 303401 }], [{ value: 300000 }], feeRate)
Using accumulative
:
// Works (return fee and inputs/outputs):
coinSelectAccumulative([{ vout: 0, value: 303400 }], [{ value: 300000 }], feeRate)
coinSelectAccumulative([{ vout: 0, value: 301920 }], [{ value: 300000 }], feeRate)
// "Fails" and returns only { fee: 1920 } (which is required for it to work)
coinSelectAccumulative([{ vout: 0, value: 301919 }], [{ value: 300000 }], feeRate)
// Works and returns { fee: 3401 } + input/output
coinSelectAccumulative([{ vout: 0, value: 303401 }], [{ value: 300000 }], feeRate)
// Works and returns { fee: 3740 } and single output
coinSelectAccumulative([{ vout: 0, value: 303740 }], [{ value: 300000 }], feeRate)
// Works and returns { fee: 2260 } and double output (change address is above dust threshold)
coinSelectAccumulative([{ vout: 0, value: 303741 }], [{ value: 300000 }], feeRate)
So is the advice to avoid duplicate runs of coin select to always prefer using the require('coinselect/accumulative')
method?
And do the main one if you want sort order + a potential lucky (hence the name?) optimization that blackjack does?
from coinselect.
Related Issues (20)
- TransactionBuilder is now deprecated HOT 5
- No inputs or outputs generated HOT 6
- Consider Output Address Types HOT 5
- Proposal For Segwit Update PR HOT 5
- PR #49 + npm HOT 1
- What is the best way to handle user selection of virtual bytes in coinselect? HOT 1
- BIP 125 selection for replacement HOT 2
- No solution found if many inputs HOT 3
- Can the coinSelect recognize that my utxos are from segwit? HOT 1
- inputs and outputs returning unidefined when pending balance HOT 5
- CoinSelect using multiple small UTXOs instead of one big HOT 3
- Segwit workaround safe to use? HOT 2
- "coinselect" always expose the largest UTXO no matter how small the payment is because it sorts by descending value. HOT 5
- type error in typescript project HOT 1
- Is this project dead? HOT 1
- Check out trezor/trezor-suite/packages/utxo-lib/src/coinselect for any ideas HOT 1
- Module cannot be found , npm I βdev-save @types/coinselect HOT 2
- Reevaluating 'Dust' Considerations When Adding Change in Transactions HOT 5
- Library breaks with float feeRate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coinselect.