-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to more accurate fee estimation endpoint
The API endpoint for fee estimations has been changed to one that delivers more accurate fee estimations. This is a temporary solution, until a more decentralized approach is found. Fixes projects/issues/27
- Loading branch information
Showing
2 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
pricenode/src/test/java/bisq/price/mining/providers/BitcoinFeeRateProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* This file is part of Bisq. | ||
* | ||
* Bisq is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* Bisq is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package bisq.price.mining.providers; | ||
|
||
import bisq.price.mining.FeeRate; | ||
|
||
import org.springframework.context.support.GenericXmlApplicationContext; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
public class BitcoinFeeRateProviderTest { | ||
|
||
@Test | ||
public void doGet_successfulCall() { | ||
|
||
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(); | ||
BitcoinFeeRateProvider feeRateProvider = new BitcoinFeeRateProvider(ctx.getEnvironment()); | ||
|
||
// Make a call to the API, retrieve the recommended fee rate | ||
// If the API call fails, or the response body cannot be parsed, the test will fail with an exception | ||
FeeRate retrievedFeeRate = feeRateProvider.doGet(); | ||
|
||
// Check that the FeeRateProvider returns a fee within the defined parameters | ||
assertTrue(retrievedFeeRate.getPrice() >= BitcoinFeeRateProvider.MIN_FEE_RATE); | ||
assertTrue(retrievedFeeRate.getPrice() <= BitcoinFeeRateProvider.MAX_FEE_RATE); | ||
} | ||
|
||
} |