Return whole tx for faucet
This commit is contained in:
parent
4d3dc8123a
commit
8bbee83aac
19
src/main.rs
19
src/main.rs
@ -223,7 +223,7 @@ fn faucet_send(
|
||||
sp_address: SilentPaymentAddress,
|
||||
sp_wallet: Arc<SilentPaymentWallet>,
|
||||
shared_daemon: SharedDaemon,
|
||||
) -> Result<Txid> {
|
||||
) -> Result<Transaction> {
|
||||
let mut first_tx: Option<Transaction> = None;
|
||||
let final_tx: Transaction;
|
||||
let mut new_outpoints: HashMap<OutPoint, OwnedOutput>;
|
||||
@ -460,20 +460,29 @@ fn faucet_send(
|
||||
.get_mut_outputs()
|
||||
.extend_from(new_outpoints);
|
||||
|
||||
debug!("{:?}", sp_wallet);
|
||||
|
||||
// save to disk
|
||||
sp_wallet.save()?;
|
||||
|
||||
Ok(final_tx.txid())
|
||||
Ok(final_tx)
|
||||
}
|
||||
|
||||
fn handle_faucet_request(
|
||||
msg: &str,
|
||||
sp_wallet: Arc<SilentPaymentWallet>,
|
||||
shared_daemon: SharedDaemon,
|
||||
) -> Result<Txid> {
|
||||
if let Ok(sp_address) = SilentPaymentAddress::try_from(&msg["faucet".len()..]) {
|
||||
) -> Result<NewTxMessage> {
|
||||
if let Ok(sp_address) = SilentPaymentAddress::try_from(msg) {
|
||||
debug!("Sending bootstrap coins to {}", sp_address);
|
||||
// send bootstrap coins to this sp_address
|
||||
faucet_send(sp_address, sp_wallet, shared_daemon)
|
||||
let tx = faucet_send(sp_address, sp_wallet, shared_daemon.clone())?;
|
||||
let partial_tweak =
|
||||
compute_partial_tweak_to_transaction(tx.clone(), shared_daemon.clone())?;
|
||||
Ok(NewTxMessage::new(
|
||||
serialize(&tx).to_lower_hex_string(),
|
||||
Some(partial_tweak.to_string()),
|
||||
))
|
||||
} else {
|
||||
Err(Error::msg(format!(
|
||||
"faucet message with unparsable sp_address"
|
||||
|
Loading…
x
Reference in New Issue
Block a user