listlockunspent when create and send tx are on different nodes

+1 vote

Dear Team,

I create a raw transaction on node_1 and I set the related UTXOs in lock state in order not to be selected by other processes.

The selected UTXOs are in lock state as I can check using listlockunspent.

After that I sign the transaction offline using an external private key and I sent the signed tx on node_2. The transaction is minted and broadcasted in the network.

If now I send the listlockunspent command on node_1 I was expecting not to see the previous UTXO because they are still locked but not unspent anymore.

Is this the inteded behaviour? Could you please elaborate?

 

Thanks,

  Fabio

asked Feb 27, 2021 by fabio

1 Answer

0 votes
Yes, it is intended behaviour. lockunspent list is in-memory structure residing on specific node. If transaction is sent by node_2, the only way for node_1 to remove UTXO from listlockunspent output is to check inputs of all transactions (which in most cases have nothing to do with lockunspent list on this node). It doesn't make sense to do this just because of this specific issue (if tx is sent by node_1, the UTXO will be removed).

lockunspent list is part of "raw transactions" mechanism. Automation and convenience has lower priority than performance and flexibility in this case.

BTW, you can unlock all UTXOs in the list by calling "lockunspent true" (i.e. without transactions list). We will fix documentation in the next version (transactions array is, in fact, optional)
answered Mar 1, 2021 by Michael
Thanks Michael, it is clear.

The operational mode of lockunspent true is nice and documented in the help outuput. It works straight, I often use it.
...