-
Notifications
You must be signed in to change notification settings - Fork 81
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
Headers fetching via NeoFS BlockFetcher service #3789
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,5 @@ type Ledger struct { | |
type Blockchain struct { | ||
ProtocolConfiguration | ||
Ledger | ||
NeoFSBlockFetcher | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,21 @@ | |
Witnesses []transaction.Witness `json:"witnesses"` | ||
} | ||
|
||
// GetIndex returns the index of the block. | ||
func (b *Header) GetIndex() uint32 { | ||
return b.Index | ||
} | ||
|
||
Comment on lines
+83
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would love to avoid that, but generics in Go don't support structural types for now, ref. golang/go#51259. We'll probably need Roman's ACK for these additional methods over Header, but for now let's keep this method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @roman-khimov what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly the same problem in SDK/node interactions. This should be documented appropriately to be used for interfaces only, but I think it's acceptable if we really save some code on this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And don't forget to create an issue for further removal of this method if one day golang/go#51259 will be resolved. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// GetExpectedHeaderSize returns the expected header size with empty witness. | ||
func (b *Header) GetExpectedHeaderSize() int { | ||
size := expectedHeaderSizeWithEmptyWitness - 1 - 1 + // 1 is for the zero-length (new(Header)).Script.Invocation/Verification | ||
io.GetVarSize(&b.Script) | ||
if b.StateRootEnabled { | ||
size += util.Uint256Size | ||
} | ||
return size | ||
} | ||
|
||
// Hash returns the hash of the block. Notice that it is cached internally, | ||
// so no matter how you change the [Header] after the first invocation of this | ||
// method it won't change. To get an updated hash in case you're changing | ||
|
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.
Exported method needs a comment.