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

RPC: Remove anchor_txid from AnchorInfo #663

Merged
merged 3 commits into from
Nov 9, 2023

Conversation

GeorgeTsagk
Copy link
Member

Closes #654

@GeorgeTsagk GeorgeTsagk self-assigned this Nov 8, 2023
@@ -69,9 +70,12 @@ func AssetAnchorCheck(txid, blockHash chainhash.Hash) AssetCheck {
return fmt.Errorf("asset is missing chain anchor field")
}

if a.ChainAnchor.AnchorTxid != txid.String() {
anchorTxid :=
strings.Split(a.ChainAnchor.AnchorOutpoint, ":")[0]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the txid info was duplicate I now retrieve it by splitting the outpoint string

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should use wire.NewOutPointFromString here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, is the hash reversed in the raw outpoint string?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the outpoint string consists of the txid and the vout index. The txid in the outpoint string is a hex encoding of the byte reversed hash.

@GeorgeTsagk
Copy link
Member Author

There was a flake on a batch mint assets test, kicked it and passed, just flagging

@@ -69,9 +70,12 @@ func AssetAnchorCheck(txid, blockHash chainhash.Hash) AssetCheck {
return fmt.Errorf("asset is missing chain anchor field")
}

if a.ChainAnchor.AnchorTxid != txid.String() {
anchorTxid :=
strings.Split(a.ChainAnchor.AnchorOutpoint, ":")[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should use wire.NewOutPointFromString here.

Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just two or so nits.

I'm a fan of this change because it reduces our test surface.

itest/assertions.go Outdated Show resolved Hide resolved
itest/assertions.go Outdated Show resolved Hide resolved
itest/assets_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 💯

Copy link
Collaborator

@jharveyb jharveyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏽

@GeorgeTsagk GeorgeTsagk added this pull request to the merge queue Nov 9, 2023
Merged via the queue into lightninglabs:main with commit cdd6707 Nov 9, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Remove field anchor_txid from RPC message AnchorInfo.
3 participants