From 4776dc36abfa90c8a4874eb6eb2c40ba837b3e7a Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Fri, 29 Mar 2019 00:10:32 -0600 Subject: [PATCH] Map entry txs to serialized txs in blockstream --- core/src/blockstream.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/src/blockstream.rs b/core/src/blockstream.rs index 27cfa8da4b..bcaa875f7f 100644 --- a/core/src/blockstream.rs +++ b/core/src/blockstream.rs @@ -4,7 +4,9 @@ use crate::entry::Entry; use crate::result::Result; +use bincode::serialize; use chrono::{SecondsFormat, Utc}; +use serde_json::json; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; use std::cell::RefCell; @@ -91,7 +93,17 @@ where leader_id: &Pubkey, entry: &Entry, ) -> Result<()> { - let json_entry = serde_json::to_string(&entry)?; + let transactions: Vec> = entry + .transactions + .iter() + .map(|tx| serialize(&tx).unwrap()) + .collect(); + let stream_entry = json!({ + "num_hashes": entry.num_hashes, + "hash": entry.hash, + "transactions": transactions + }); + let json_entry = serde_json::to_string(&stream_entry)?; let payload = format!( r#"{{"dt":"{}","t":"entry","s":{},"h":{},"l":"{:?}","entry":{}}}"#, Utc::now().to_rfc3339_opts(SecondsFormat::Nanos, true),