-
Notifications
You must be signed in to change notification settings - Fork 68
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
tbcd, bfgd: add various hemi specific indexes #380
base: main
Are you sure you want to change the base?
Conversation
@@ -1215,20 +1214,387 @@ func (s *Server) TxIndexer(ctx context.Context, endHash *chainhash.Hash) error { | |||
return fmt.Errorf("invalid direction: %v", direction) | |||
} | |||
|
|||
func processKeystones(blockHash *chainhash.Hash, txs []*btcutil.Tx, kssCache map[chainhash.Hash]tbcd.Keystone) error { |
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.
TODO before merge: add a test case for this
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.
I think we need to a add a test case here, to ensure that we pull the correct bytes off of a btcutil.Tx
and store them correctly
…ng change to actual address to keep createPoPTx happy
a98c8f0
to
d5eed69
Compare
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.
hey @marcopeereboom I have a few changes to request; most requests are around test coverage, there is one indexing question that I have as well.
Co-authored-by: Joshua Sing <[email protected]>
Co-authored-by: Joshua Sing <[email protected]>
database/tbcd/level/level_test.go
Outdated
if err == nil { | ||
t.Fatalf("keystone in db: %v", spew.Sdump(v)) | ||
} else { | ||
_, ok := err.(database.NotFoundError) |
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.
it's probably better to use errors.Is
here
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.
fixed👍
database/tbcd/level/level_test.go
Outdated
name: "invalidRemove", | ||
direction: []int{-1}, | ||
kssMap: invalidKssCache, | ||
expectedOutDB: anyKssCache, |
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.
hey @AL-CT could we define these not as variables, but as each their own map[chainhash.Hash]tbcd.Keystone
?
for example:
expectedOutDB: map[chainhash.Hash]tbcd.Keystone{
...
}
I fear that sharing variables between tests here may cause unexpected behavior
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.
fair, also forced me to make things more readable when fixing it
Summary
Hemi needs to keep track of L2 keystones in order to provide callers the bitcoin view of the hemi network.
Changes
This PR adds L2 keystone indexing and hides this behind a configuration flag.