Skip to content

Commit

Permalink
fix: add last block time in blockchain info
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad committed Jul 21, 2024
1 parent fca7566 commit 0fe9552
Show file tree
Hide file tree
Showing 13 changed files with 387 additions and 194 deletions.
1 change: 1 addition & 0 deletions www/grpc/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (s *blockchainServer) GetBlockchainInfo(_ context.Context,
CommitteePower: s.state.CommitteePower(),
IsPruned: s.state.IsPruned(),
PruningHeight: int32(s.state.PruningHeight()),
LastBlockTime: s.state.LastBlockTime().Unix(),
CommitteeValidators: cv,
}, nil
}
Expand Down
14 changes: 14 additions & 0 deletions www/grpc/gen/dart/blockchain.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ class GetBlockchainInfoResponse extends $pb.GeneratedMessage {
..pc<ValidatorInfo>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'committeeValidators', $pb.PbFieldType.PM, subBuilder: ValidatorInfo.create)
..aOB(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isPruned')
..a<$core.int>(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'pruningHeight', $pb.PbFieldType.O3)
..aInt64(10, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'lastBlockTime')
..hasRequiredFields = false
;

Expand All @@ -853,6 +854,7 @@ class GetBlockchainInfoResponse extends $pb.GeneratedMessage {
$core.Iterable<ValidatorInfo>? committeeValidators,
$core.bool? isPruned,
$core.int? pruningHeight,
$fixnum.Int64? lastBlockTime,
}) {
final _result = create();
if (lastBlockHeight != null) {
Expand Down Expand Up @@ -882,6 +884,9 @@ class GetBlockchainInfoResponse extends $pb.GeneratedMessage {
if (pruningHeight != null) {
_result.pruningHeight = pruningHeight;
}
if (lastBlockTime != null) {
_result.lastBlockTime = lastBlockTime;
}
return _result;
}
factory GetBlockchainInfoResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
Expand Down Expand Up @@ -979,6 +984,15 @@ class GetBlockchainInfoResponse extends $pb.GeneratedMessage {
$core.bool hasPruningHeight() => $_has(8);
@$pb.TagNumber(9)
void clearPruningHeight() => clearField(9);

@$pb.TagNumber(10)
$fixnum.Int64 get lastBlockTime => $_getI64(9);
@$pb.TagNumber(10)
set lastBlockTime($fixnum.Int64 v) { $_setInt64(9, v); }
@$pb.TagNumber(10)
$core.bool hasLastBlockTime() => $_has(9);
@$pb.TagNumber(10)
void clearLastBlockTime() => clearField(10);
}

class GetConsensusInfoRequest extends $pb.GeneratedMessage {
Expand Down
3 changes: 2 additions & 1 deletion www/grpc/gen/dart/blockchain.pbjson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ const GetBlockchainInfoResponse$json = const {
const {'1': 'committee_validators', '3': 7, '4': 3, '5': 11, '6': '.pactus.ValidatorInfo', '10': 'committeeValidators'},
const {'1': 'is_pruned', '3': 8, '4': 1, '5': 8, '10': 'isPruned'},
const {'1': 'pruning_height', '3': 9, '4': 1, '5': 5, '10': 'pruningHeight'},
const {'1': 'last_block_time', '3': 10, '4': 1, '5': 3, '10': 'lastBlockTime'},
],
};

/// Descriptor for `GetBlockchainInfoResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List getBlockchainInfoResponseDescriptor = $convert.base64Decode('ChlHZXRCbG9ja2NoYWluSW5mb1Jlc3BvbnNlEioKEWxhc3RfYmxvY2tfaGVpZ2h0GAEgASgNUg9sYXN0QmxvY2tIZWlnaHQSJgoPbGFzdF9ibG9ja19oYXNoGAIgASgJUg1sYXN0QmxvY2tIYXNoEiUKDnRvdGFsX2FjY291bnRzGAMgASgFUg10b3RhbEFjY291bnRzEikKEHRvdGFsX3ZhbGlkYXRvcnMYBCABKAVSD3RvdGFsVmFsaWRhdG9ycxIfCgt0b3RhbF9wb3dlchgFIAEoA1IKdG90YWxQb3dlchInCg9jb21taXR0ZWVfcG93ZXIYBiABKANSDmNvbW1pdHRlZVBvd2VyEkgKFGNvbW1pdHRlZV92YWxpZGF0b3JzGAcgAygLMhUucGFjdHVzLlZhbGlkYXRvckluZm9SE2NvbW1pdHRlZVZhbGlkYXRvcnMSGwoJaXNfcHJ1bmVkGAggASgIUghpc1BydW5lZBIlCg5wcnVuaW5nX2hlaWdodBgJIAEoBVINcHJ1bmluZ0hlaWdodA==');
final $typed_data.Uint8List getBlockchainInfoResponseDescriptor = $convert.base64Decode('ChlHZXRCbG9ja2NoYWluSW5mb1Jlc3BvbnNlEioKEWxhc3RfYmxvY2tfaGVpZ2h0GAEgASgNUg9sYXN0QmxvY2tIZWlnaHQSJgoPbGFzdF9ibG9ja19oYXNoGAIgASgJUg1sYXN0QmxvY2tIYXNoEiUKDnRvdGFsX2FjY291bnRzGAMgASgFUg10b3RhbEFjY291bnRzEikKEHRvdGFsX3ZhbGlkYXRvcnMYBCABKAVSD3RvdGFsVmFsaWRhdG9ycxIfCgt0b3RhbF9wb3dlchgFIAEoA1IKdG90YWxQb3dlchInCg9jb21taXR0ZWVfcG93ZXIYBiABKANSDmNvbW1pdHRlZVBvd2VyEkgKFGNvbW1pdHRlZV92YWxpZGF0b3JzGAcgAygLMhUucGFjdHVzLlZhbGlkYXRvckluZm9SE2NvbW1pdHRlZVZhbGlkYXRvcnMSGwoJaXNfcHJ1bmVkGAggASgIUghpc1BydW5lZBIlCg5wcnVuaW5nX2hlaWdodBgJIAEoBVINcHJ1bmluZ0hlaWdodBImCg9sYXN0X2Jsb2NrX3RpbWUYCiABKANSDWxhc3RCbG9ja1RpbWU=');
@$core.Deprecated('Use getConsensusInfoRequestDescriptor instead')
const GetConsensusInfoRequest$json = const {
'1': 'GetConsensusInfoRequest',
Expand Down
7 changes: 7 additions & 0 deletions www/grpc/gen/docs/grpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,13 @@ Message has no fields.
<td>
Lowest-height block stored (only present if pruning is enabled)
</td>
</tr>
<tr>
<td class="fw-bold">last_block_time</td>
<td> int64</td>
<td>
The last block time as timestamp
</td>
</tr>
</tbody>
</table>
Expand Down
7 changes: 7 additions & 0 deletions www/grpc/gen/docs/json-rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,13 @@ Parameters has no fields.
<td>
Lowest-height block stored (only present if pruning is enabled)
</td>
</tr>
<tr>
<td class="fw-bold">last_block_time</td>
<td> numeric</td>
<td>
The last block time as timestamp
</td>
</tr>
</tbody>
</table>
Expand Down
Loading

0 comments on commit 0fe9552

Please sign in to comment.