fixing tx pool/index and tightening up page content

This commit is contained in:
lza_menace 2020-07-02 21:52:21 -07:00
parent a2c4739344
commit e7d7e45df3
6 changed files with 54 additions and 62 deletions

View file

@ -159,7 +159,7 @@ pub struct GetTransactionPool {
pub spent_key_images: Option<Vec<SpentKeyImages>>,
pub status: String,
pub top_hash: String,
pub transactions: Option<Vec<Transactions>>
pub transactions: Vec<Transactions>
}
#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, Clone)]

View file

@ -216,30 +216,22 @@ fn index() -> Template {
&"get_info", None, true
).send().unwrap().json().unwrap();
let tx_pool: GetTransactionPool = build_rpc(
let mut tx_pool: GetTransactionPool = build_rpc(
&"get_transaction_pool", None, true
).send().unwrap().json().unwrap();
println!("{:#?}", tx_pool);
let mut tx_json_raw: Vec<TransactionJSON> = vec![];
// let mut tx_pool_txs = tx_pool.transactions;
//
// match tx_pool_txs {
// Some(s) => {
// for mut f in s {
// let mut _fp = f.process();
// }
// },
// None => {}
// };
// for f in &mut tx_pool.transactions {
// f.process();
// };
for f in &mut tx_pool.transactions {
f.process();
let j: TransactionJSON = serde_json::from_str(&f.tx_json).unwrap();
tx_json_raw.push(j)
};
let context: JsonValue = json!({
"daemon_info": daemon_info,
"tx_pool_txs": tx_pool.transactions
"tx_pool_txs": tx_pool.transactions,
"tx_json": tx_json_raw
});
Template::render("index", context)