decred / dcrticketbuyer

An automated smart ticket purchaser.
0 stars 7 forks source link

smart input selection #75

Open raedah opened 8 years ago

raedah commented 8 years ago

Instead of creating a new transaction output for each ticket purchase, first check if we already have outputs that are the correct size. This is common because of ticket purchases that expired before they were mined.

More advanced. Check for outputs that are larger then needed. Sort smallest usable first. Calculate if it is efficient to use by looking at maxperblock and expirydelta. If maxperblock is 3 and expiredelta is 16, then 16 3 ticketprice is the amount of reserve funds needed. If wallets spendable balance is greater then the reserve funds needed minus the large output, then the output can be used directly. Also, if the output is only roughly 10% larger then the ticket price it should just be used since that amount is likely not enough to get a ticket with anyways.

Question: Does getting change increase the size of a transaction? From the looks of the block explorer, all tickets include a sstxchange regardless of if it is used.