Skip to content

Conversation

@MichelMajdalani
Copy link

Add documentation for the first core change of supporting reactions to posts.

  • add serialization/deserialization for React transaction
  • connect/disconnect logic
  • database PUT/DELETE support
  • index metadata

Copy link
Member

@lazynina lazynina left a comment

Choose a reason for hiding this comment

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

Great start!

}

func (bav *UtxoView) GetReactionsForPostHash(postHash *BlockHash) (_ReactorPubKeys [][]byte, _err error) {
if bav.Postgres != nil {
Copy link
Member

Choose a reason for hiding this comment

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

we should refactor this function to use the DbAdapter to get the reactions from the db and only update the view if the key constructed from the entry does not exist in the view yet. Otherwise, we risk updating entries in the view that haven't been flushed.

// increment the react s on the react d post.
reactEntry := &ReactionEntry{
ReactorPubKey: txn.PublicKey,
ReactedPostHash: txMeta.PostHash,
Copy link
Member

Choose a reason for hiding this comment

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

need to add ReactEmoji in here

require.NoError(utxoView.FlushToDb())
}

testDisconnectedState()
Copy link
Member

Choose a reason for hiding this comment

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

I would probably use the TestMeta struct and follow the pattern used in block_view_dao_coin_limit_order_test.go.

Using the below at the end of your tests ensures all disconnect / connects work in all different forms:

	_rollBackTestMetaTxnsAndFlush(testMeta)
	_applyTestMetaTxnsToMempool(testMeta)
	_applyTestMetaTxnsToViewAndFlush(testMeta)
	_disconnectTestMetaTxnsFromViewAndFlush(testMeta)
	_connectBlockThenDisconnectBlockAndFlush(testMeta)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants