diff --git a/commands/schema/filecoin_block.schema.json b/commands/schema/filecoin_block.schema.json index b3cf8049fd..4c9f63a0dc 100644 --- a/commands/schema/filecoin_block.schema.json +++ b/commands/schema/filecoin_block.schema.json @@ -64,6 +64,9 @@ "string", "null" ] + }, + "timestamp": { + "type": "string" } }, "required": [ @@ -74,7 +77,8 @@ "parents", "proof", "stateRoot", - "ticket" + "ticket", + "timestamp" ], "type": "object" }, diff --git a/types/block.go b/types/block.go index 9d908cb68d..c3bae61956 100644 --- a/types/block.go +++ b/types/block.go @@ -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 diff --git a/types/block_test.go b/types/block_test.go index 953ec050ea..c59e7a6651 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -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) }) }