fix rmp_serde to vec named for controller responses

This commit is contained in:
Evan Feenstra
2022-12-18 10:57:34 -08:00
parent 6955a4a8d2
commit 28a9aa8d1b
2 changed files with 5 additions and 4 deletions

View File

@@ -81,7 +81,8 @@ pub fn make_event_loop(
let persister: Arc<dyn Persist> = Arc::new(FsPersister::new(&ROOT_STORE, Some(8))); let persister: Arc<dyn Persist> = Arc::new(FsPersister::new(&ROOT_STORE, Some(8)));
// initialize the RootHandler // initialize the RootHandler
let root_handler = sphinx_signer::root::init(seed, network, policy, persister).expect("failed to init signer"); let root_handler =
sphinx_signer::root::init(seed, network, policy, persister).expect("failed to init signer");
// signing loop // signing loop
let dummy_peer = PubKey([0; 33]); let dummy_peer = PubKey([0; 33]);
@@ -127,7 +128,7 @@ pub fn make_event_loop(
handle_control_response(&root_handler, cres, network, led_tx.clone()) handle_control_response(&root_handler, cres, network, led_tx.clone())
{ {
let res_data = let res_data =
rmp_serde::to_vec(&res).expect("could not publish control response"); rmp_serde::to_vec_named(&res).expect("could not publish control response");
mqtt.publish(topics::CONTROL_RETURN, QOS, false, &res_data) mqtt.publish(topics::CONTROL_RETURN, QOS, false, &res_data)
.expect("could not publish control response"); .expect("could not publish control response");
} }

View File

@@ -136,7 +136,7 @@ async fn run_main(
topics::CONTROL => { topics::CONTROL => {
match ctrlr.handle(&msg_bytes) { match ctrlr.handle(&msg_bytes) {
Ok((_msg, res)) => { Ok((_msg, res)) => {
let res_data = rmp_serde::to_vec(&res) let res_data = rmp_serde::to_vec_named(&res)
.expect("could not build control response"); .expect("could not build control response");
client client
.publish( .publish(
@@ -199,7 +199,7 @@ async fn run_test(
topics::CONTROL => { topics::CONTROL => {
match ctrlr.handle(&msg_bytes) { match ctrlr.handle(&msg_bytes) {
Ok((_msg, res)) => { Ok((_msg, res)) => {
let res_data = rmp_serde::to_vec(&res) let res_data = rmp_serde::to_vec_named(&res)
.expect("could not build control response"); .expect("could not build control response");
client client
.publish( .publish(