-
Notifications
You must be signed in to change notification settings - Fork 846
Block library refactoring #883
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
Changes from 1 commit
c053761
ff46c55
dd228bc
608d804
17a33a8
72b5b78
8adcdf9
8987003
5f5e9f2
5351fb8
ce1dac1
526f986
75689e6
8923f71
6a2c193
381f5e1
7eecf80
395c6f8
be5c8d2
7fa486d
91d45d7
7e788c3
bc459e8
ea8a401
b694010
1f66378
9f9bab0
7ce9132
a5d3d14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ation helpers, removed defineProperties usage, fixed header tests
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ export type BufferLike = Buffer | TransformableToBuffer | PrefixedHexString | nu | |
| /** | ||
| * A block header's data. | ||
| */ | ||
| export interface BlockHeaderData { | ||
| export interface HeaderData { | ||
| parentHash?: BufferLike | ||
| uncleHash?: BufferLike | ||
| coinbase?: BufferLike | ||
|
|
@@ -76,9 +76,9 @@ export interface BlockHeaderData { | |
| * A block's data. | ||
| */ | ||
| export interface BlockData { | ||
| header?: Buffer | PrefixedHexString | BufferLike[] | BlockHeaderData | ||
| header?: Buffer | PrefixedHexString | BufferLike[] | HeaderData | ||
| transactions?: Array<Buffer | PrefixedHexString | BufferLike[] | TxData> | ||
| uncleHeaders?: Array<Buffer | PrefixedHexString | BufferLike[] | BlockHeaderData> | ||
| uncleHeaders?: Array<Buffer | PrefixedHexString | BufferLike[] | HeaderData> | ||
| } | ||
|
Member
Author
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. What was the motivation for this interface? Doesn't the
Member
Author
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. Update: ah, ok, got it, this is used subsequently in the
Contributor
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. Yeah I was just following the pattern set up in the tx refactor, I'm not entirely sure the specific reason to have them optional instead of required (maybe more valuable in the tx context, or some general rpc thing), but should be fine. |
||
|
|
||
| export interface Blockchain { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export function checkBufferLength(value: Buffer, expected: number): Buffer { | ||
| const provided = value.length | ||
| if (provided != expected) { | ||
| throw new Error( | ||
| `Expected Buffer length for ${value} on initialization is ${expected}, provided: ${provided}`, | ||
| ) | ||
| } | ||
| return value | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.