inputs.js
function pickOneCoinJustBiggerAndContinue(){
		if (amount === Infinity)
			return pickMultipleCoinsAndContinue();
		var more = is_base ? '>' : '>=';
		conn.query(
			"SELECT unit, message_index, output_index, amount, blinding, address \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 AND amount "+more+" ? \n\
				AND sequence='good' "+confirmation_condition+" \n\
			ORDER BY is_stable DESC, amount LIMIT 1",
			[arrSpendableAddresses, amount+is_base*TRANSFER_INPUT_SIZE],
			function(rows){
				if (rows.length === 1){
					var input = rows[0];
					// default type is "transfer"
					addInput(input);
					onDone(arrInputsWithProofs, total_amount);
				}
				else
					pickMultipleCoinsAndContinue();
			}
		);
	}
function pickOneCoinJustBiggerAndContinue(){
		if (amount === Infinity)
			return pickMultipleCoinsAndContinue();
		var more = is_base ? '>' : '>=';
		conn.query(
			"SELECT unit, message_index, output_index, amount, blinding, address \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 AND amount "+more+" ? \n\
				AND sequence='good' "+confirmation_condition+" \n\
			ORDER BY is_stable DESC, amount LIMIT 1",
			[arrSpendableAddresses, amount+is_base*TRANSFER_INPUT_SIZE],
			function(rows){
				if (rows.length === 1){
					var input = rows[0];
					// default type is "transfer"
					addInput(input);
					onDone(arrInputsWithProofs, total_amount);
				}
				else
					pickMultipleCoinsAndContinue();
			}
		);
	}
function pickOneCoinJustBiggerAndContinue ( ) { if ( amount === Infinity ) return pickMultipleCoinsAndContinue ( ) ; var more = is_base ? '>' : '>=' ; conn . query ( "SELECT unit, message_index, output_index, amount, blinding, address \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 AND amount " + more + " ? \n\
				AND sequence='good' " + confirmation_condition + " \n\
			ORDER BY is_stable DESC, amount LIMIT 1" , [ arrSpendableAddresses , amount + is_base * TRANSFER_INPUT_SIZE ] , function ( rows ) { if ( rows . length === 1 ) { var input = rows [ 0 ] ; // default type is "transfer" addInput ( input ) ; onDone ( arrInputsWithProofs , total_amount ) ; } else pickMultipleCoinsAndContinue ( ) ; } ) ; }
first, try to find a coin just bigger than the required amount
first try to find a coin just bigger than the required amount