-
Notifications
You must be signed in to change notification settings - Fork 214
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
Use tx max size & estimator to figure out the right input upper-bound in coin selection #536
Conversation
| otherwise = | ||
return (opt, inps, utxo) | ||
return (maxN, inps, utxo) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that most of the changes in this file are because the type for the maxN
in the coin selection options was changed from Word64
to Word8 -> Word8
. Therefore, the actual maxN
is now computed in the root random
(or largestFirst
function, and passed down to the iteration function as a Word64
to be depleted.
coinSelOpts :: CoinSelectionOptions (ErrValidateSelection t) | ||
coinSelOpts = CoinSelectionOptions | ||
{ maximumNumberOfInputs = 10 | ||
{ maximumNumberOfInputs = estimateMaxNumberOfInputs tl txMaxSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
let n = fromIntegral $ maximumNumberOfInputs opt | ||
let nLargest = take n . L.sortBy (flip $ comparing (coin . snd)) . Map.toList . getUTxO | ||
let nOuts = fromIntegral $ NE.length outs | ||
let maxN = fromIntegral $ maximumNumberOfInputs opt (fromIntegral nOuts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
-- there's also a soft-limit of 8kb which results in much smaller transactions | ||
-- in the end. | ||
softTxMaxSize :: Quantity "byte" Word16 | ||
softTxMaxSize = Quantity 8192 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
58583f1
to
5dc539e
Compare
Issue Number
#462
Overview
txMaxSize
toBlockchainParameter
estimateMaxNumberOfInputs
from the transaction layer to replace the hard-coded max number of inputs with a number that's actually relevant.Comments