Skip to content

Commit

Permalink
chore(api): get_sync_progress returns short_desc (#6504)
Browse files Browse the repository at this point in the history
Description
---
Add `short_desc` to the `SyncProgressResponse`

Motivation and Context
---
Using `short_desc` would be very handy for the Tari Universe

How Has This Been Tested?
---

What process can a PR reviewer use to test or verify this change?
---

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
mmrrnn committed Aug 27, 2024
1 parent 7a1150d commit 7cb88fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions applications/minotari_app_grpc/proto/base_node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ message SyncProgressResponse {
uint64 tip_height = 1;
uint64 local_height = 2;
SyncState state = 3;
string short_desc = 4;
}

enum SyncState {
Expand Down
6 changes: 6 additions & 0 deletions applications/minotari_node/src/grpc/base_node_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2003,26 +2003,31 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer {
.borrow()
.state_info
.clone();
let short_desc = state.short_desc();
let response = match state {
StateInfo::HeaderSync(None) => tari_rpc::SyncProgressResponse {
tip_height: 0,
local_height: 0,
state: tari_rpc::SyncState::HeaderStarting.into(),
short_desc,
},
StateInfo::HeaderSync(Some(info)) => tari_rpc::SyncProgressResponse {
tip_height: info.tip_height,
local_height: info.local_height,
state: tari_rpc::SyncState::Header.into(),
short_desc,
},
StateInfo::Connecting(_) => tari_rpc::SyncProgressResponse {
tip_height: 0,
local_height: 0,
state: tari_rpc::SyncState::BlockStarting.into(),
short_desc,
},
StateInfo::BlockSync(info) => tari_rpc::SyncProgressResponse {
tip_height: info.tip_height,
local_height: info.local_height,
state: tari_rpc::SyncState::Block.into(),
short_desc,
},
_ => tari_rpc::SyncProgressResponse {
tip_height: 0,
Expand All @@ -2032,6 +2037,7 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer {
} else {
tari_rpc::SyncState::Startup.into()
},
short_desc,
},
};
Ok(Response::new(response))
Expand Down

0 comments on commit 7cb88fa

Please sign in to comment.