Skip to content

Commit

Permalink
Merge branch 'b/testnet' into b/master
Browse files Browse the repository at this point in the history
  • Loading branch information
romever committed Nov 17, 2024
2 parents 6f47a07 + 4a83a96 commit 13c2b7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions job/task/block_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func BlockScanner(ctx context.Context, svcCtx *svc.ServiceContext) {
scanHeight++
}

logc.Infof(ctx, "block scan start: scanHeight:[%d], currentHeight:[%d]", scanHeight, currentHeight)

for scanHeight <= currentHeight {
//block
block, err := consensusApi.GetBlock(ctx, scanHeight)
Expand Down Expand Up @@ -110,7 +112,7 @@ func BlockScanner(ctx context.Context, svcCtx *svc.ServiceContext) {
Height: block.Height,
BlockIdFlag: int64(s.BlockIDFlag),
ValidatorAddress: s.ValidatorAddress.String(),
Timestamp: s.Timestamp,
Timestamp: s.Timestamp.UTC(),
Signature: hex.EncodeToString(s.Signature),
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
Expand All @@ -131,7 +133,7 @@ func BlockScanner(ctx context.Context, svcCtx *svc.ServiceContext) {
Height: block.Height,
Epoch: int64(epoch),
Hash: block.Hash.Hex(),
Timestamp: block.Time,
Timestamp: block.Time.UTC(),
Meta: string(metaJson),
Txs: int64(len(txs)),
ProposerAddress: meta.Header.ProposerAddress.String(),
Expand All @@ -157,7 +159,7 @@ func BlockScanner(ctx context.Context, svcCtx *svc.ServiceContext) {
}
logc.Infof(ctx, "transact duration [%v]", time.Since(startTime))

logc.Infof(ctx, "block scan height: %d, current height: %d", scanHeight, currentHeight)
logc.Infof(ctx, "block scan height: %d, current height: %d, size:[%d]", scanHeight, currentHeight, len(txsModels))
scanHeight++
}
}
Expand All @@ -181,7 +183,7 @@ func parseMethod(block *consensus.Block, signedTx *transaction.SignedTransaction
Status: result.IsSuccess(),
Nonce: int64(raw.Nonce),
Height: block.Height,
Timestamp: block.Time,
Timestamp: block.Time.UTC(),
SignAddr: staking.NewAddress(signedTx.Signature.PublicKey).String(),
Error: string(errorJson),
Events: string(eventsJson),
Expand Down
4 changes: 2 additions & 2 deletions job/task/governance_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func ProposalSync(ctx context.Context, svcCtx *svc.ServiceContext) {
logc.Errorf(ctx, "createdHeight getBlock error, %v", err)
return
}
createdTime = createdBlock.Time
createdTime = createdBlock.Time.UTC()
}

epochDuration := int64(proposal.ClosesAt) - int64(proposal.CreatedAt)
Expand All @@ -65,7 +65,7 @@ func ProposalSync(ctx context.Context, svcCtx *svc.ServiceContext) {
logc.Errorf(ctx, "closedBlock getBlock error, %v", err)
return
}
closedTime = closedBlock.Time
closedTime = closedBlock.Time.UTC()
}
} else {
closedTime = common.GetEpochDurationTime(createdTime, epochDuration, true)
Expand Down
2 changes: 1 addition & 1 deletion job/task/validator_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ func DelegatorRewardSync(ctx context.Context, svcCtx *svc.ServiceContext) {
DelegationAmount: delegationAmount.ToBigInt().Int64(),
DelegationShares: delegation.Shares.ToBigInt().Int64(),
Reward: reward.Int64(),
CreatedAt: block.Time,
CreatedAt: block.Time.UTC(),
UpdatedAt: time.Now(),
}
rewardModels = append(rewardModels, rewardModel)
Expand Down

0 comments on commit 13c2b7d

Please sign in to comment.