[beta] Cancel Transaction (#5656)
* option to disable persistent txqueue (#5544) * option to disable persistent txqueue * New option goes with kin * Remove transaction RPC (#4949) * Cancel tx JS (#4958) * Remove transaction RPC * Bumping multihash and libc * Updating nanomsg * bump nanomsg * cancel tx * cancel-tx-js * cancel-tx-js * cancel-tx-js * cancel-tx-hs * cancel-tx-js * cancel-tx-js * cancel-tx-js * small fixes * edit & time till submit * edit & time till submit * updates * updates * udpates * udpates * grumbles * step 1 * Wonderful updates * ready * small refact * small refact * grumbles 1 * ffx2 * good ol' fashioned updates * latest and greatest * removeHash * removeHash * spec * fix 1 * fix 1 * fix 2 * fix 2 * ff * ff * ff * updates * Updating documentation for RPCs (#5392) * Removing minBlocks occurrencies * Docs for new RPCs. * Fixing linting issues, updating *withToken documentatiojn. * Adding missing RPCs. Fixing tests. * Fixing lint issues.
This commit is contained in:
committed by
Arkadiy Paronyan
parent
8dfc10ede9
commit
1aea9caf6d
@@ -173,14 +173,26 @@ impl<T: NodeInfo> LocalDataStore<T> {
|
||||
pub fn update(&self) -> Result<(), Error> {
|
||||
trace!(target: "local_store", "Updating local store entries.");
|
||||
|
||||
let mut batch = self.db.transaction();
|
||||
|
||||
let local_entries: Vec<TransactionEntry> = self.node.pending_transactions()
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect();
|
||||
|
||||
let local_json = ::serde_json::to_value(&local_entries).map_err(Error::Json)?;
|
||||
self.write_txs(&local_entries)
|
||||
}
|
||||
|
||||
/// Clear data in this column.
|
||||
pub fn clear(&self) -> Result<(), Error> {
|
||||
trace!(target: "local_store", "Clearing local store entries.");
|
||||
|
||||
self.write_txs(&[])
|
||||
}
|
||||
|
||||
// helper for writing a vector of transaction entries to disk.
|
||||
fn write_txs(&self, txs: &[TransactionEntry]) -> Result<(), Error> {
|
||||
let mut batch = self.db.transaction();
|
||||
|
||||
let local_json = ::serde_json::to_value(txs).map_err(Error::Json)?;
|
||||
let json_str = format!("{}", local_json);
|
||||
|
||||
batch.put_vec(self.col, LOCAL_TRANSACTIONS_KEY, json_str.into_bytes());
|
||||
|
||||
Reference in New Issue
Block a user