Merge branch 'master' into mononaut/rebundle
This commit is contained in:
		
						commit
						2df99ef7ed
					
				| @ -3,21 +3,30 @@ import { Common } from './common'; | |||||||
| import mempool from './mempool'; | import mempool from './mempool'; | ||||||
| import projectedBlocks from './mempool-blocks'; | import projectedBlocks from './mempool-blocks'; | ||||||
| 
 | 
 | ||||||
|  | interface RecommendedFees { | ||||||
|  |   fastestFee: number, | ||||||
|  |   halfHourFee: number, | ||||||
|  |   hourFee: number, | ||||||
|  |   economyFee: number, | ||||||
|  |   minimumFee: number, | ||||||
|  | } | ||||||
|  | 
 | ||||||
| class FeeApi { | class FeeApi { | ||||||
|   constructor() { } |   constructor() { } | ||||||
| 
 | 
 | ||||||
|   defaultFee = Common.isLiquid() ? 0.1 : 1; |   defaultFee = Common.isLiquid() ? 0.1 : 1; | ||||||
| 
 | 
 | ||||||
|   public getRecommendedFee() { |   public getRecommendedFee(): RecommendedFees { | ||||||
|     const pBlocks = projectedBlocks.getMempoolBlocks(); |     const pBlocks = projectedBlocks.getMempoolBlocks(); | ||||||
|     const mPool = mempool.getMempoolInfo(); |     const mPool = mempool.getMempoolInfo(); | ||||||
|     const minimumFee = Math.ceil(mPool.mempoolminfee * 100000); |     const minimumFee = Math.ceil(mPool.mempoolminfee * 100000); | ||||||
|  |     const defaultMinFee = Math.max(minimumFee, this.defaultFee); | ||||||
| 
 | 
 | ||||||
|     if (!pBlocks.length) { |     if (!pBlocks.length) { | ||||||
|       return { |       return { | ||||||
|         'fastestFee': this.defaultFee, |         'fastestFee': defaultMinFee, | ||||||
|         'halfHourFee': this.defaultFee, |         'halfHourFee': defaultMinFee, | ||||||
|         'hourFee': this.defaultFee, |         'hourFee': defaultMinFee, | ||||||
|         'economyFee': minimumFee, |         'economyFee': minimumFee, | ||||||
|         'minimumFee': minimumFee, |         'minimumFee': minimumFee, | ||||||
|       }; |       }; | ||||||
| @ -27,11 +36,15 @@ class FeeApi { | |||||||
|     const secondMedianFee = pBlocks[1] ? this.optimizeMedianFee(pBlocks[1], pBlocks[2], firstMedianFee) : this.defaultFee; |     const secondMedianFee = pBlocks[1] ? this.optimizeMedianFee(pBlocks[1], pBlocks[2], firstMedianFee) : this.defaultFee; | ||||||
|     const thirdMedianFee = pBlocks[2] ? this.optimizeMedianFee(pBlocks[2], pBlocks[3], secondMedianFee) : this.defaultFee; |     const thirdMedianFee = pBlocks[2] ? this.optimizeMedianFee(pBlocks[2], pBlocks[3], secondMedianFee) : this.defaultFee; | ||||||
| 
 | 
 | ||||||
|  |     // explicitly enforce a minimum of ceil(mempoolminfee) on all recommendations.
 | ||||||
|  |     // simply rounding up recommended rates is insufficient, as the purging rate
 | ||||||
|  |     // can exceed the median rate of projected blocks in some extreme scenarios
 | ||||||
|  |     // (see https://bitcoin.stackexchange.com/a/120024)
 | ||||||
|     return { |     return { | ||||||
|       'fastestFee': firstMedianFee, |       'fastestFee': Math.max(minimumFee, firstMedianFee), | ||||||
|       'halfHourFee': secondMedianFee, |       'halfHourFee': Math.max(minimumFee, secondMedianFee), | ||||||
|       'hourFee': thirdMedianFee, |       'hourFee': Math.max(minimumFee, thirdMedianFee), | ||||||
|       'economyFee': Math.min(2 * minimumFee, thirdMedianFee), |       'economyFee': Math.max(minimumFee, Math.min(2 * minimumFee, thirdMedianFee)), | ||||||
|       'minimumFee': minimumFee, |       'minimumFee': minimumFee, | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								contributors/fanquake.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								contributors/fanquake.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | I hereby accept the terms of the Contributor License Agreement in the CONTRIBUTING.md file of the mempool/mempool git repository as of October 23, 2023. | ||||||
|  | 
 | ||||||
|  | Signed: fanquake | ||||||
| @ -332,7 +332,7 @@ BITCOIN_REPO_URL=https://github.com/bitcoin/bitcoin | |||||||
| BITCOIN_REPO_NAME=bitcoin | BITCOIN_REPO_NAME=bitcoin | ||||||
| BITCOIN_REPO_BRANCH=master | BITCOIN_REPO_BRANCH=master | ||||||
| #BITCOIN_LATEST_RELEASE=$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releases/latest|grep tag_name|head -1|cut -d '"' -f4) | #BITCOIN_LATEST_RELEASE=$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releases/latest|grep tag_name|head -1|cut -d '"' -f4) | ||||||
| BITCOIN_LATEST_RELEASE=v25.0 | BITCOIN_LATEST_RELEASE=v25.1 | ||||||
| echo -n '.' | echo -n '.' | ||||||
| 
 | 
 | ||||||
| BISQ_REPO_URL=https://github.com/bisq-network/bisq | BISQ_REPO_URL=https://github.com/bisq-network/bisq | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user