-
Notifications
You must be signed in to change notification settings - Fork 28
Block Value Reuse #40
Conversation
|
|
||
| func GetBlock(db database.KeyValueReader, bid ids.ID) ([]byte, error) { | ||
| return db.Get(PrefixBlockKey(bid)) | ||
| func GetBlock(db database.KeyValueReader, bid ids.ID) (*StatefulBlock, []byte, 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.
nice!
| Preferred() (ids.ID, error) | ||
| // Checks the validity of the block. | ||
| // Accepted fetches the ID of the last accepted block. | ||
| Accepted() (ids.ID, 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.
+1, better name.
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 actually a usage improvement as well...if you build off the preferred, the blockID you are referencing may get orphaned and you'll need to start over.
| kvs = append(kvs, KeyValue{ | ||
| Key: formattedKey, | ||
| Value: cursor.Value(), | ||
| Value: v, |
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.
Does this mean now we can return same k-v pairs but with different tx IDs? Should we incude tx id in the response?
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 guess we could return it now that we have it in case people want to know when it was last updated?
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 can do this in another PR, however. This is complex enough.
closes: #31
closes: #36