Browse Source

Poll mempool after a transaction is broadcast

refactor-mempool
Roman Zeyde 7 years ago
parent
commit
961a9207ae
No known key found for this signature in database GPG Key ID: 87CAE5FA46917CBB
  1. 1
      TODO.md
  2. 4
      src/rpc.rs

1
TODO.md

@ -1,6 +1,5 @@
# Electrum
* Poll mempool after transaction broadcast
* Support TLS (via https://docs.rs/rustls/)
* Snapshot DB after successful indexing - and run queries on the latest snapshot
* Update height to -1 for txns with any [unconfirmed input](https://electrumx.readthedocs.io/en/latest/protocol-basics.html#status)

4
src/rpc.rs

@ -229,6 +229,10 @@ impl Connection {
let tx = hex::decode(&tx).chain_err(|| "non-hex tx")?;
let tx: Transaction = deserialize(&tx).chain_err(|| "failed to parse tx")?;
let txid = self.query.broadcast(&tx)?;
self.query.update_mempool()?;
if let Err(e) = self.chan.sender().try_send(Message::PeriodicUpdate) {
warn!("failed to issue PeriodicUpdate after broadcast: {}", e);
}
Ok(json!(txid.be_hex_string()))
}

Loading…
Cancel
Save