-
Notifications
You must be signed in to change notification settings - Fork 135
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 FindRelatedTransactions Function for Block Storage #290
Conversation
|
||
_, err := db.Scan( | ||
ctx, | ||
getBackwardRelationKey(tx.TransactionIdentifier, nil), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lot cleaner than maintaining a separate prefix function. We should probably go back and remove any ...prefix()
functions in another PR.
@@ -1084,6 +1184,108 @@ func (b *BlockStorage) FindTransaction( | |||
return newestBlock, newestTransaction, nil | |||
} | |||
|
|||
func (b *BlockStorage) FindRelatedTransactions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this method is supposed to return only forward related transactions, we should make it obvious in the name. Something like FindForwardRelatedTransactions. 🙏 🙏
Let's also pl add a comment describing what it does and its return values.
For instance, we should mention that it collects entire chains of forward relations, however many levels deep.
And that it considers transactions that point to the passed transactionIdentifier
via backward relationship, as forward relations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is meant to fetch all related txs. It currently handles both forward and backward relations. I think the name is fitting as any expansion will require further subroutines regardless.
Motivation
This change adds the FindRelatedTransactions function to block storage, which will allow for related transaction processing in the future. This change also adds a duplicate check for related transactions to the asserter.
Solution
By checking all forward and backward relations, FindRelatedTransactions finds the highest block that must be confirmed to confirm a given transaction.
Open questions