diff --git a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs index 5d81f7358f..42f89de5f9 100644 --- a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs +++ b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs @@ -123,6 +123,9 @@ impl OutputSql { tip_height: i64, conn: &SqliteConnection, ) -> Result, OutputManagerStorageError> { + let no_flags = i32::from(OutputFlags::empty().bits()); + let coinbase_flag = i32::from(OutputFlags::COINBASE_OUTPUT.bits()); + if strategy == UTXOSelectionStrategy::Default { // lets get the max value for all utxos let max: Vec = outputs::table @@ -131,6 +134,7 @@ impl OutputSql { .filter(outputs::maturity.le(tip_height)) .filter(outputs::features_unique_id.is_null()) .filter(outputs::features_parent_public_key.is_null()) + .filter(outputs::flags.eq(no_flags).or(outputs::flags.eq(coinbase_flag))) .order(outputs::value.desc()) .select(outputs::value) .limit(1) @@ -151,6 +155,7 @@ impl OutputSql { .filter(outputs::maturity.le(tip_height)) .filter(outputs::features_unique_id.is_null()) .filter(outputs::features_parent_public_key.is_null()) + .filter(outputs::flags.eq(no_flags).or(outputs::flags.eq(coinbase_flag))) .order_by(outputs::spending_priority.desc()); match strategy { UTXOSelectionStrategy::Smallest => { diff --git a/integration_tests/features/WalletCli.feature b/integration_tests/features/WalletCli.feature index 069bbee8e2..0df343c01a 100644 --- a/integration_tests/features/WalletCli.feature +++ b/integration_tests/features/WalletCli.feature @@ -171,7 +171,10 @@ Feature: Wallet CLI And I have mining node MINE connected to base node BASE and wallet WALLET And mining node MINE mines 4 blocks Then I wait for wallet WALLET to have at least 1000000 uT - And I publish a contract constitution from file "fixtures/contract_constitution.json" on wallet WALLET via command line + And I publish a contract definition from file "fixtures/contract_definition.json" on wallet WALLET via command line And mining node MINE mines 8 blocks Then wallet WALLET has at least 1 transactions that are all TRANSACTION_STATUS_MINED_CONFIRMED and not cancelled + And I publish a contract constitution from file "fixtures/contract_constitution.json" on wallet WALLET via command line + And mining node MINE mines 8 blocks + Then wallet WALLET has at least 2 transactions that are all TRANSACTION_STATUS_MINED_CONFIRMED and not cancelled Then WALLET is connected to BASE \ No newline at end of file