mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 13:26:44 +00:00
use minimum fee rate found for higher block targets if present
This commit is contained in:
parent
5d6bb5e4f9
commit
61c3c4a3ac
1 changed files with 3 additions and 6 deletions
|
@ -10,10 +10,7 @@ import com.sparrowwallet.sparrow.AppController;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static com.sparrowwallet.drongo.protocol.Transaction.DUST_RELAY_TX_FEE;
|
import static com.sparrowwallet.drongo.protocol.Transaction.DUST_RELAY_TX_FEE;
|
||||||
|
|
||||||
|
@ -216,12 +213,12 @@ public class SimpleElectrumServerRpc implements ElectrumServerRpc {
|
||||||
result.put(targetBlock, targetBlocksFeeRateBtcKb);
|
result.put(targetBlock, targetBlocksFeeRateBtcKb);
|
||||||
} catch(IllegalStateException | IllegalArgumentException e) {
|
} catch(IllegalStateException | IllegalArgumentException e) {
|
||||||
log.warn("Failed to retrieve fee rate for target blocks: " + targetBlock + " (" + e.getMessage() + ")");
|
log.warn("Failed to retrieve fee rate for target blocks: " + targetBlock + " (" + e.getMessage() + ")");
|
||||||
result.put(targetBlock, 0.0001d);
|
result.put(targetBlock, result.values().stream().mapToDouble(v -> v).min().orElse(0.0001d));
|
||||||
} catch(JsonRpcException e) {
|
} catch(JsonRpcException e) {
|
||||||
throw new ElectrumServerRpcException("Failed to retrieve fee rate for target blocks: " + targetBlock, e);
|
throw new ElectrumServerRpcException("Failed to retrieve fee rate for target blocks: " + targetBlock, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.put(targetBlock, 0.0001d);
|
result.put(targetBlock, result.values().stream().mapToDouble(v -> v).min().orElse(0.0001d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue