Skip to content
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

Feat/timestamp block #2897

Merged
merged 1 commit into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion commands/schema/filecoin_block.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
"string",
"null"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
Expand All @@ -74,7 +77,8 @@
"parents",
"proof",
"stateRoot",
"ticket"
"ticket",
"timestamp"
],
"type": "object"
},
Expand Down
3 changes: 3 additions & 0 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type Block struct {
// a challenge
Proof PoStProof `json:"proof"`

// The timestamp, in seconds since the Unix epoch, at which this block was created.
Timestamp Uint64 `json:"timestamp"`

cachedCid cid.Cid

cachedBytes []byte
Expand Down
3 changes: 2 additions & 1 deletion types/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ func TestTriangleEncoding(t *testing.T) {
ParentWeight: Uint64(1000),
Proof: NewTestPoSt(),
StateRoot: SomeCid(),
Timestamp: Uint64(1),
}
s := reflect.TypeOf(*b)
// This check is here to request that you add a non-zero value for new fields
// to the above (and update the field count below).
require.Equal(t, 12, s.NumField()) // Note: this also counts private fields
require.Equal(t, 13, s.NumField()) // Note: this also counts private fields
testRoundTrip(t, b)
})
}
Expand Down