diff --git a/src/index.rs b/src/index.rs index d96b6bb93c..4a0038b210 100644 --- a/src/index.rs +++ b/src/index.rs @@ -1128,7 +1128,7 @@ impl Index { } pub(crate) fn list(&self, outpoint: OutPoint) -> Result> { - if !self.index_sats { + if !self.index_sats || outpoint == unbound_outpoint() { return Ok(None); } diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 5eca99481f..d7c81fcc89 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -2575,7 +2575,7 @@ mod tests { #[test] fn unbound_output_receives_unbound_inscriptions() { - let server = TestServer::new_with_regtest(); + let server = TestServer::new_with_regtest_with_index_sats(); server.mine_blocks(1); @@ -2611,6 +2611,17 @@ mod tests {
0000000000000000000000000000000000000000000000000000000000000000:0
.*" ), ); + + server.assert_response_regex( + "/output/0000000000000000000000000000000000000000000000000000000000000000:0", + StatusCode::OK, + ".*

Output 0000000000000000000000000000000000000000000000000000000000000000:0

+
+
inscriptions
+
+ +
.*", + ); } #[test] diff --git a/tests/wallet/outputs.rs b/tests/wallet/outputs.rs index fcef95d39c..39a648e38e 100644 --- a/tests/wallet/outputs.rs +++ b/tests/wallet/outputs.rs @@ -35,3 +35,22 @@ fn outputs_includes_locked_outputs() { assert_eq!(output[0].output, outpoint); assert_eq!(output[0].amount, amount); } + +#[test] +fn outputs_includes_unbound_outputs() { + let rpc_server = test_bitcoincore_rpc::spawn(); + create_wallet(&rpc_server); + + let coinbase_tx = &rpc_server.mine_blocks_with_subsidy(1, 1_000_000)[0].txdata[0]; + let outpoint = OutPoint::new(coinbase_tx.txid(), 0); + let amount = coinbase_tx.output[0].value; + + rpc_server.lock(outpoint); + + let output = CommandBuilder::new("wallet outputs") + .rpc_server(&rpc_server) + .run_and_deserialize_output::>(); + + assert_eq!(output[0].output, outpoint); + assert_eq!(output[0].amount, amount); +}