rgb-node icon indicating copy to clipboard operation
rgb-node copied to clipboard

Add finalize_transfers API

Open zoedberg opened this issue 2 years ago • 3 comments

In order to finalize an RGB transfer that sends more than one asset, I added a new finalize_transfers API. I haven't changed the existing finalize transfer API since I don't want to break compatibility, but maybe in the future we can deprecate that in favor of this API. Moreover I haven't implemented the beneficiary part to save some implementation time (since currently we are not using that feature) and the respective CLI command, but I guess we can open some "good first" issues for these features.

zoedberg avatar Oct 12 '22 09:10 zoedberg

Hi @zoedberg

How are you?

That's a great feature!

I will try to reproduce the tests. Can you help with questions?

  1. Do you made all transfers using OpRet, correct?
  2. For each consignment file, it is necessary to have an output in PSBT file, correct?

Thanks

crisdut avatar Oct 17 '22 21:10 crisdut

Hi! All good, thanks :) Sure, always happy to help!

  1. Do you made all transfers using OpRet, correct?

Yes, correct

  1. For each consignment file, it is necessary to have an output in PSBT file, correct?

No, all transfers are anchored on a single opret output

zoedberg avatar Oct 18 '22 16:10 zoedberg

Hi! All good, thanks :) Sure, always happy to help!

  1. Do you made all transfers using OpRet, correct?

Yes, correct

  1. For each consignment file, it is necessary to have an output in PSBT file, correct?

No, all transfers are anchored on a single opret output

Thanks for reply, I will try make tests ASAP.

crisdut avatar Oct 18 '22 17:10 crisdut

Thanks for reply, I will try make tests ASAP.

Hi @zoedberg ,

I tried to reproduce all steps, and add more than one contract into the psbt file, but when I executed rgb-cli transfer combine the node returned Error: The key is already present but has a different value.

Can you help me to reproduce the tests?

My Test

  1. Create two new contracts with different UTXO issuer.
  2. Create a new consignment file with each contract.
  3. Create two new state transitions with the same change output (with rgb20).
  4. Create one PSBT file with two inputs with UTXOs used in the first step (with descriptor wallet)
  5. Try embed and combining consignment files with PSBT.

PS: The new API seems correct!

crisdut avatar Oct 26 '22 22:10 crisdut

Hi @crisdut,

Your test is a very high level one, not sure how to reproduce it. Are you doing this via CLI? If so please note there are some open issues and missing features on rgb-node CLI that I think prevent your test from working properly.

In rgb-lib we have a test send::receive_multiple_different_assets_success that does exactly what you say (using opret instead of tapret). So I believe the bug you're encountering is not in the rgb-node daemon or other RGB libraries. It could be an issue in one of the RGB CLIs or another issue in your setup.

zoedberg avatar Nov 08 '22 13:11 zoedberg

Hi @zoedberg,

Your test is a very high level one, not sure how to reproduce it. Are you doing this via CLI? If so please note there are some open issues and missing features on rgb-node CLI that I think prevent your test from working properly.

Sorry, I didn't detail how I tested the feature. Yes, I'm doing with rgb-cli to test.

In rgb-lib we have a test send::receive_multiple_different_assets_success that does exactly what you say (using opret instead of tapret). So I believe the bug you're encountering is not in the rgb-node daemon or other RGB libraries. It could be an issue in one of the RGB CLIs or another issue in your setup.

The error occurs when executing rgb-cli transfer combine command in rgb daemon.

Well, I will investigate more. However, I agree this error is about tooling compatibility and not your feature.

crisdut avatar Nov 08 '22 14:11 crisdut