Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pass correct bytes to network
  • Loading branch information
rphmeier committed May 14, 2018
commit b5a4fed20d2f80334742ee12012c5df02d9bcbe2
11 changes: 7 additions & 4 deletions polkadot/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,17 @@ impl substrate_rpc::author::AuthorApi for RpcTransactionPool {
use codec::Slicable;

info!("Extrinsic submitted: {}", HexDisplay::from(&xt.0));
let decoded = xt.using_encoded(|ref mut s| UncheckedExtrinsic::decode(s))
let (decoded, encoded_bytes) = xt.using_encoded(|s| {
UncheckedExtrinsic::decode(&mut &s[..]).map(|d| (d, s.to_vec()))
})
.ok_or(substrate_rpc::author::error::ErrorKind::InvalidFormat)?;
info!("Correctly formatted: {:?}", decoded);
let verified = self.inner.lock().import(decoded)

let hash = self.inner.lock().import(decoded)
.map(|v| v.hash().0.into())
.map_err(|_| substrate_rpc::author::error::ErrorKind::PoolError)?;

let hash = verified.hash();
self.network.on_new_transactions(&[(hash.0.into(), xt.0)]);
self.network.on_new_transactions(&[(hash, encoded_bytes)]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would end up propagating stale transactions; we might want to ensure cull is called first and propagate only after it is clear that the tx wasn't discarded.

Ok(())
}
}
Expand Down