Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

history: WitnessOrd::Tentative regardless the TX being mined or not #281

Closed
zoedberg opened this issue Oct 31, 2024 · 5 comments
Closed
Assignees
Labels
question Further information is requested

Comments

@zoedberg
Copy link
Contributor

When calling the wallet history APIs, WitnessInfo has WitnessOrd::Tentative regardless the TX being mined or not. I think it might be a cache issue, because calling resolve_pub_witness_ord on the resolver shows the TX has a WitnessOrd::Mined

@zoedberg zoedberg changed the title WitnessOrd::Tentative regardless the TX being mined or not history: WitnessOrd::Tentative regardless the TX being mined or not Oct 31, 2024
@dr-orlovsky dr-orlovsky self-assigned this Oct 31, 2024
@dr-orlovsky dr-orlovsky moved this to Ready in RGB release v0.11 Oct 31, 2024
@dr-orlovsky
Copy link
Member

Wallet history API doesn't do refresh by itself. You need to call wallet.sync() first to get it refreshed.

@dr-orlovsky dr-orlovsky added the question Further information is requested label Nov 1, 2024
@zoedberg
Copy link
Contributor Author

zoedberg commented Nov 1, 2024

Calling wallet.sync() doesn't change this. I mine (making sure the TX gets in the block), sync the wallet and then print the wallet's history and I still see the operation as tentative.

You can see it by running check_fungible_history (from RGB-WG/rgb-tests#3) with the updated code and printing the history, you'll see:

Operation       Value           State   Seal                                                                            Witness
issued             100000       0x0FA0  bc:opret1st:88dab15599f47b4ef748828057c2be973ba4b8a0419b899c38106f8ea4879b0b:0  ~
        opid=9ccbc660cc253b7158a84520823fa7a9452b855c01066a9ecba4fd219243f1d9
sent                  200       0x0FA0  bc:opret1st:dae8e271282a6c1a411db750ec5548323b32dd2be5272cf93528f80981293282:0  bc:dae8e271282a6c1a411db750ec5548323b32dd2be5272cf93528f80981293282 (tentative)
        opid=0f130ffbd6b1b1fa25e2fd1814d483bff0b85af5931614ba79ef641bd104c673

If I call resolve_pub_witness_ord with the TXID associated to the send operation (in this example dae8e271282a6c1a411db750ec5548323b32dd2be5272cf93528f80981293282) I receive WitnessOrd::Mined, so the history is wrong in saying it has a WitnessOrd::Tentative

@dr-orlovsky
Copy link
Member

Ok, probably this is because wallet sync only UTXOs belonging to the wallet and not the past witness transactions from outside. I will check what was the API for refreshing the witness transactions

@dr-orlovsky
Copy link
Member

dr-orlovsky commented Nov 1, 2024

Well, additionally to wallet.sync() you have to call wallet.stock_mut().update_witnesses(), like I do in the cli when sync flag is set: https://github.com/RGB-WG/rgb/blob/1e13c99f22e2f1e2bd24907bb0d72435ba860827/cli/src/args.rs#L130-L134

But since the tests doesn't use cli args, they skip this step. Simply add wlt_X.stock_mut().update_witnesses() after each .sync() call and everything should work

@zoedberg
Copy link
Contributor Author

zoedberg commented Nov 4, 2024

Calling update_witnesses solved this, thanks

@zoedberg zoedberg closed this as completed Nov 4, 2024
@github-project-automation github-project-automation bot moved this from Ready to Done in RGB release v0.11 Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: Done
Development

No branches or pull requests

2 participants