Post
Topic
Board Development & Technical Discussion
Re: sendtoaddress sendmany api change proposal.
by
2112
on 27/09/2014, 15:47:32 UTC
I'm not saying the proposed API change is perfect... actually perfection to me would be if I could write app code something like:

Quote
// business application pseudo-code

while( num_tries++ < max_tries ) {

   fee = rpc.calcsendfee( address, amount )

   if( not fee_is_ok( fee ) )
       break;

   code = rpc.sendtoaddress( address, amount, .., fee )

   if( code != insufficient_fee ) {
      break;
   }
}
You seem to be missing the crucial fact: the coin selector in the "send" is a stochastic knapsack solver. For any non-trivial wallet it pseudo-randomly selects different coins resulting in a different size of the transaction and thus requiring a different minimal fee. This has been discussed many times on this forum, please use search.