minor fixes
This commit is contained in:
parent
40efdb58a4
commit
23fcbe25eb
@ -15,7 +15,7 @@ use sdk_common::sp_client::spclient::Recipient;
|
||||
use sdk_common::network::CommitMessage;
|
||||
use sdk_common::sp_client::bitcoin::consensus::deserialize;
|
||||
use sdk_common::sp_client::bitcoin::{Amount, Transaction, OutPoint};
|
||||
use sdk_common::process::{lock_processes, Process, ProcessState, CACHEDPROCESSES};
|
||||
use sdk_common::process::{lock_processes, Process, ProcessState};
|
||||
use serde_json::json;
|
||||
use serde_json::Value;
|
||||
|
||||
@ -162,6 +162,7 @@ fn handle_existing_commitment(outpoint: OutPoint, commit_msg: CommitMessage) ->
|
||||
if commit_msg.validation_tokens.is_empty() {
|
||||
register_new_state(process, commit_msg)
|
||||
} else {
|
||||
log::debug!("Received commit_msg with {} validation tokens for process {}", commit_msg.validation_tokens.len(), outpoint);
|
||||
process_validation(process, commit_msg)
|
||||
}
|
||||
}
|
||||
@ -309,6 +310,7 @@ mod tests {
|
||||
use sdk_common::pcd::Member;
|
||||
use sdk_common::pcd::RoleDefinition;
|
||||
use sdk_common::pcd::ValidationRule;
|
||||
use sdk_common::process::CACHEDPROCESSES;
|
||||
use sdk_common::sp_client::silentpayments::utils::SilentPaymentAddress;
|
||||
use serde_json::json;
|
||||
use mockall::predicate::*;
|
||||
|
12
src/main.rs
12
src/main.rs
@ -158,17 +158,8 @@ pub(crate) static WALLET: OnceLock<SilentPaymentWallet> = OnceLock::new();
|
||||
|
||||
fn handle_new_tx_request(new_tx_msg: &NewTxMessage) -> Result<()> {
|
||||
let tx = deserialize::<Transaction>(&Vec::from_hex(&new_tx_msg.transaction)?)?;
|
||||
let mempool_accept = DAEMON
|
||||
.get()
|
||||
.unwrap()
|
||||
.lock_anyhow()?
|
||||
.test_mempool_accept(&tx)?;
|
||||
if !mempool_accept.allowed {
|
||||
return Err(AnkError::NewTxError(mempool_accept.reject_reason.unwrap()))?;
|
||||
}
|
||||
|
||||
// we try to broadcast it
|
||||
DAEMON.get().unwrap().lock_anyhow()?.broadcast(&tx)?;
|
||||
DAEMON.get().unwrap().lock_anyhow()?.broadcast(&tx).map_err(|e| AnkError::NewTxError(e.to_string()))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -306,7 +297,6 @@ async fn handle_zmq(zmq_url: String, electrum_url: String) {
|
||||
continue;
|
||||
};
|
||||
|
||||
debug!("Broadcasting message {}", payload);
|
||||
if let Err(e) = broadcast_message(AnkFlag::NewTx, payload, BroadcastType::ToAll) {
|
||||
log::error!("{}", e.to_string());
|
||||
}
|
||||
|
@ -77,10 +77,9 @@ pub(crate) fn broadcast_message(
|
||||
};
|
||||
let msg = Message::Text(serde_json::to_string(&ank_msg)?);
|
||||
match ank_msg.flag {
|
||||
AnkFlag::Cipher => {
|
||||
log::debug!("Broadcasting cipher");
|
||||
}
|
||||
_ => log::debug!("Broadcasting message: {}", msg)
|
||||
AnkFlag::Cipher => log::debug!("Broadcasting cipher"),
|
||||
AnkFlag::Handshake => log::debug!("Broadcasting handshake"),
|
||||
_ => log::debug!("Broadcasting {} message: {}", ank_msg.flag.as_str(),msg)
|
||||
}
|
||||
match broadcast {
|
||||
BroadcastType::Sender(addr) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user