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

Add poster public key to post assoc txindex #1408

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/block_view_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6507,10 +6507,11 @@ type DeleteUserAssociationTxindexMetadata struct {
}

type CreatePostAssociationTxindexMetadata struct {
PostHashHex string
AppPublicKeyBase58Check string
AssociationType string
AssociationValue string
PostHashHex string
AppPublicKeyBase58Check string
AssociationType string
AssociationValue string
PosterPublicKeyBase58Check string
}

type DeletePostAssociationTxindexMetadata struct {
Expand Down Expand Up @@ -6546,6 +6547,7 @@ func (associationTxindexMeta *CreatePostAssociationTxindexMetadata) RawEncodeWit
data = append(data, EncodeByteArray([]byte(associationTxindexMeta.AppPublicKeyBase58Check))...)
data = append(data, EncodeByteArray([]byte(associationTxindexMeta.AssociationType))...)
data = append(data, EncodeByteArray([]byte(associationTxindexMeta.AssociationValue))...)
data = append(data, EncodeByteArray([]byte(associationTxindexMeta.PosterPublicKeyBase58Check))...)
return data
}

Expand Down Expand Up @@ -6659,6 +6661,13 @@ func (associationTxindexMeta *CreatePostAssociationTxindexMetadata) RawDecodeWit
}
associationTxindexMeta.AssociationValue = string(associationValueBytes)

// PosterPublicKeyBase58Check
posterPublicKeyBase58CheckBytes, err := DecodeByteArray(rr)
if err != nil {
return errors.Wrapf(err, "CreatePostAssociationTxindexMetadata.Decode: Problem reading PosterPublicKeyBase58Check: ")
}
associationTxindexMeta.PosterPublicKeyBase58Check = string(posterPublicKeyBase58CheckBytes)

return nil
}

Expand Down
12 changes: 12 additions & 0 deletions lib/db_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6475,6 +6475,10 @@ type SubmitPostTxindexMetadata struct {
ParentPostHashHex string
// ParentPosterPublicKeyBase58Check in AffectedPublicKeys

// We require a related public key for quick feed generation in the case of
// a reclout post or a reply post.
RelatedPublicKeyBase58Check string

// The profiles that are mentioned are in the AffectedPublicKeys
// MentionedPublicKeyBase58Check in AffectedPublicKeys
}
Expand All @@ -6484,6 +6488,8 @@ func (txnMeta *SubmitPostTxindexMetadata) RawEncodeWithoutMetadata(blockHeight u

data = append(data, EncodeByteArray([]byte(txnMeta.PostHashBeingModifiedHex))...)
data = append(data, EncodeByteArray([]byte(txnMeta.ParentPostHashHex))...)
data = append(data, EncodeByteArray([]byte(txnMeta.RelatedPublicKeyBase58Check))...)

return data
}

Expand All @@ -6500,6 +6506,12 @@ func (txnMeta *SubmitPostTxindexMetadata) RawDecodeWithoutMetadata(blockHeight u
}
txnMeta.ParentPostHashHex = string(parentPostHashHexBytes)

relatedPublicKeyBase58CheckBytes, err := DecodeByteArray(rr)
if err != nil {
return errors.Wrapf(err, "SubmitPostTxindexMetadata.Decode: problem reading RelatedPublicKeyBase58Check")
}
txnMeta.RelatedPublicKeyBase58Check = string(relatedPublicKeyBase58CheckBytes)

return nil
}

Expand Down
Loading