Skip to content

Commit

Permalink
Don't have publish return the 'hash'
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Aug 14, 2023
1 parent 9895ec0 commit a3441a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 4 additions & 5 deletions coordinator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ pub async fn scan_tributaries<D: Db, Pro: Processors, P: P2p>(
async move {
loop {
match serai.publish(&tx).await {
Ok(hash) => {
log::info!("set key pair for {:?} in TX {}", set, hex::encode(hash));
Ok(_) => {
log::info!("set key pair for {set:?}");
break;
}
// This is assumed to be some ephemeral error due to the assumed fault-free
Expand Down Expand Up @@ -576,13 +576,12 @@ pub async fn handle_processors<D: Db, Pro: Processors, P: P2p>(
let tx = Serai::execute_batch(batch.clone());
loop {
match serai.publish(&tx).await {
Ok(hash) => {
Ok(_) => {
log::info!(
"executed batch {:?} {} (block {}) in TX {}",
"executed batch {:?} {} (block {})",
batch.batch.network,
batch.batch.id,
hex::encode(batch.batch.block),
hex::encode(hash),
);
break;
}
Expand Down
7 changes: 5 additions & 2 deletions substrate/client/src/serai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,11 @@ impl Serai {
.map_err(|_| SeraiError::InvalidRuntime)
}

pub async fn publish(&self, tx: &Encoded) -> Result<[u8; 32], SeraiError> {
self.0.rpc().submit_extrinsic(tx).await.map(Into::into).map_err(SeraiError::RpcError)
pub async fn publish(&self, tx: &Encoded) -> Result<(), SeraiError> {
// Drop the hash, which is the hash of the raw TX, as TXs are allowed to share hashes and this
// hash is practically useless/unsafe
// If we are to return something, it should be block included in and position within block
self.0.rpc().submit_extrinsic(tx).await.map(|_| ()).map_err(SeraiError::RpcError)
}
}

Expand Down

0 comments on commit a3441a6

Please sign in to comment.