code: function pickMultipleCoinsAndContinue(){
  		conn.query(
  			"SELECT unit, message_index, output_index, amount, address, blinding \n\
  			FROM outputs \n\
  			CROSS JOIN units USING(unit) \n\
  			WHERE address IN(?) AND asset"+(asset ? "="+conn.escape(asset) : " IS NULL")+" AND is_spent=0 \n\
  				AND sequence='good' "+confirmation_condition+"  \n\
  			ORDER BY amount DESC LIMIT ?",
  			[arrSpendableAddresses, constants.MAX_INPUTS_PER_PAYMENT_MESSAGE-2],
  			function(rows){
  				async.eachSeries(
  					rows,
  					function(row, cb){
  						var input = row;
  						objectHash.cleanNulls(input);
  						required_amount += is_base*TRANSFER_INPUT_SIZE;
  						addInput(input);
  						// if we allow equality, we might get 0 amount for change which is invalid
  						var bFound = is_base ? (total_amount > required_amount) : (total_amount >= required_amount);
  						bFound ? cb('found') : cb();
  					},
  					function(err){
  						if (err === 'found')
  							onDone(arrInputsWithProofs, total_amount);
  						else if (asset)
  							issueAsset();
  						else
  							addHeadersCommissionInputs();
  					}
  				);
  			}
  		);
  	}
docs: then, try to add smaller coins until we accumulate the target amount