Map entry txs to serialized txs in blockstream
This commit is contained in:
parent
10239c3b3c
commit
4776dc36ab
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
use crate::entry::Entry;
|
use crate::entry::Entry;
|
||||||
use crate::result::Result;
|
use crate::result::Result;
|
||||||
|
use bincode::serialize;
|
||||||
use chrono::{SecondsFormat, Utc};
|
use chrono::{SecondsFormat, Utc};
|
||||||
|
use serde_json::json;
|
||||||
use solana_sdk::hash::Hash;
|
use solana_sdk::hash::Hash;
|
||||||
use solana_sdk::pubkey::Pubkey;
|
use solana_sdk::pubkey::Pubkey;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
@ -91,7 +93,17 @@ where
|
|||||||
leader_id: &Pubkey,
|
leader_id: &Pubkey,
|
||||||
entry: &Entry,
|
entry: &Entry,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let json_entry = serde_json::to_string(&entry)?;
|
let transactions: Vec<Vec<u8>> = 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!(
|
let payload = format!(
|
||||||
r#"{{"dt":"{}","t":"entry","s":{},"h":{},"l":"{:?}","entry":{}}}"#,
|
r#"{{"dt":"{}","t":"entry","s":{},"h":{},"l":"{:?}","entry":{}}}"#,
|
||||||
Utc::now().to_rfc3339_opts(SecondsFormat::Nanos, true),
|
Utc::now().to_rfc3339_opts(SecondsFormat::Nanos, true),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user