add custom fee

This commit is contained in:
lucretius
2024-01-23 16:59:54 +01:00
parent 4ba8b962f2
commit 3634a6bcdd
5 changed files with 113 additions and 81 deletions

View File

@@ -1252,6 +1252,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
}
let addr = address.or(self.wallet.read().unwrap().get_all_zaddresses().get(0).map(|s| s.clone())).unwrap();
let fee: u64 = DEFAULT_FEE.try_into().unwrap();
let result = {
let _lock = self.sync_lock.lock().unwrap();
@@ -1260,6 +1261,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
&self.sapling_spend, &self.sapling_output,
true,
vec![(&addr, tbal - fee, None)],
&fee,
|txbytes| broadcast_raw_tx(&self.get_server_uri(),self.config.no_cert_verification, txbytes)
)
};
@@ -1600,7 +1602,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
crx.iter().take(num_fetches).collect::<Result<Vec<()>, String>>()
}
pub fn do_send(&self, addrs: Vec<(&str, u64, Option<String>)>) -> Result<String, String> {
pub fn do_send(&self, addrs: Vec<(&str, u64, Option<String>)>, fee: &u64) -> Result<String, String> {
if !self.wallet.read().unwrap().is_unlocked_for_spending() {
error!("Wallet is locked");
return Err("Wallet is locked".to_string());
@@ -1616,6 +1618,7 @@ pub fn start_mempool_monitor(lc: Arc<LightClient>) -> Result<(), String> {
&self.sapling_spend, &self.sapling_output,
false,
addrs,
fee,
|txbytes| broadcast_raw_tx(&self.get_server_uri(), self.config.no_cert_verification, txbytes)
)
};