Don't round variables in code, only in templates.
This commit is contained in:
		
							parent
							
								
									2d9b9b5c5d
								
							
						
					
					
						commit
						f1c5f83412
					
				| @ -176,8 +176,8 @@ | |||||||
|                   </a> |                   </a> | ||||||
|                 </td> |                 </td> | ||||||
|                 <td class="d-none d-lg-table-cell">{{ cpfpTx.weight / 4 | vbytes: 2 }}</td> |                 <td class="d-none d-lg-table-cell">{{ cpfpTx.weight / 4 | vbytes: 2 }}</td> | ||||||
|                 <td>{{ roundToOneDecimal(cpfpTx) | number : '1.1-1' }} <span i18n="shared.sat-vbyte|sat/vB">sat/vB</span></td> |                 <td>{{ cpfpTx.fee / (cpfpTx.weight / 4) | number : '1.1-1' }} <span i18n="shared.sat-vbyte|sat/vB">sat/vB</span></td> | ||||||
|                 <td class="d-none d-lg-table-cell"><fa-icon *ngIf="roundToOneDecimal(cpfpTx) < tx.feePerVsize" class="arrow-red" [icon]="['fas', 'angle-double-down']" [fixedWidth]="true"></fa-icon></td> |                 <td class="d-none d-lg-table-cell"><fa-icon *ngIf="roundToOneDecimal(cpfpTx) < roundToOneDecimal(tx)" class="arrow-red" [icon]="['fas', 'angle-double-down']" [fixedWidth]="true"></fa-icon></td> | ||||||
|               </tr> |               </tr> | ||||||
|             </ng-template> |             </ng-template> | ||||||
|           </tbody> |           </tbody> | ||||||
|  | |||||||
| @ -80,7 +80,7 @@ export class TransactionComponent implements OnInit, OnDestroy { | |||||||
|       if (tx.fee === undefined) { |       if (tx.fee === undefined) { | ||||||
|         this.tx.fee = 0; |         this.tx.fee = 0; | ||||||
|       } |       } | ||||||
|       this.tx.feePerVsize = +(tx.fee / (tx.weight / 4)).toFixed(1); |       this.tx.feePerVsize = tx.fee / (tx.weight / 4); | ||||||
|       this.isLoadingTx = false; |       this.isLoadingTx = false; | ||||||
|       this.error = undefined; |       this.error = undefined; | ||||||
|       this.waitingForTransaction = false; |       this.waitingForTransaction = false; | ||||||
| @ -105,11 +105,10 @@ export class TransactionComponent implements OnInit, OnDestroy { | |||||||
|             ancestors: tx.ancestors, |             ancestors: tx.ancestors, | ||||||
|             bestDescendant: tx.bestDescendant, |             bestDescendant: tx.bestDescendant, | ||||||
|           }; |           }; | ||||||
|           tx.effectiveFeePerVsize = +(tx.effectiveFeePerVsize).toFixed(1); |  | ||||||
|         } else { |         } else { | ||||||
|           this.apiService.getCpfpinfo$(this.tx.txid) |           this.apiService.getCpfpinfo$(this.tx.txid) | ||||||
|             .subscribe((cpfpInfo) => { |             .subscribe((cpfpInfo) => { | ||||||
|               const lowerFeeParents = cpfpInfo.ancestors.filter((ancestor) => (ancestor.fee / (ancestor.weight / 4)) < tx.feePerVsize); |               const lowerFeeParents = cpfpInfo.ancestors.filter((parent) => (parent.fee / (parent.weight / 4)) < tx.effectiveFeePerVsize); | ||||||
|               let totalWeight = tx.weight + lowerFeeParents.reduce((prev, val) => prev + val.weight, 0); |               let totalWeight = tx.weight + lowerFeeParents.reduce((prev, val) => prev + val.weight, 0); | ||||||
|               let totalFees = tx.fee + lowerFeeParents.reduce((prev, val) => prev + val.fee, 0); |               let totalFees = tx.fee + lowerFeeParents.reduce((prev, val) => prev + val.fee, 0); | ||||||
| 
 | 
 | ||||||
| @ -118,9 +117,8 @@ export class TransactionComponent implements OnInit, OnDestroy { | |||||||
|                 totalFees += cpfpInfo.bestDescendant.fee; |                 totalFees += cpfpInfo.bestDescendant.fee; | ||||||
|               } |               } | ||||||
| 
 | 
 | ||||||
|               const effectiveFeePerVsize = totalFees / (totalWeight / 4); |               this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4); | ||||||
|               this.tx.effectiveFeePerVsize = +effectiveFeePerVsize.toFixed(1); |               this.stateService.markBlock$.next({ txFeePerVSize: this.tx.effectiveFeePerVsize }); | ||||||
|               this.stateService.markBlock$.next({ txFeePerVSize: effectiveFeePerVsize }); |  | ||||||
|               this.cpfpInfo = cpfpInfo; |               this.cpfpInfo = cpfpInfo; | ||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user