-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix wrong casting to long #2841
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1019,13 +1019,17 @@ private void logUpdateCollections(Transaction rskTx) { | |||||||||
|
||||||||||
private boolean svpIsOngoing() { | ||||||||||
return federationSupport.getProposedFederation() | ||||||||||
.map(Federation::getCreationBlockNumber) | ||||||||||
.map(proposedFederationCreationBlockNumber -> | ||||||||||
proposedFederationCreationBlockNumber + bridgeConstants.getFederationConstants().getValidationPeriodDurationInBlocks()) | ||||||||||
.filter(validationPeriodEndBlock -> rskExecutionBlock.getNumber() <= validationPeriodEndBlock) | ||||||||||
.filter(this::validationPeriodIsOngoing) | ||||||||||
.isPresent(); | ||||||||||
} | ||||||||||
|
||||||||||
private boolean validationPeriodIsOngoing(Federation proposedFederation) { | ||||||||||
long validationPeriodEndBlock = proposedFederation.getCreationBlockNumber() + | ||||||||||
bridgeConstants.getFederationConstants().getValidationPeriodDurationInBlocks(); | ||||||||||
|
||||||||||
return rskExecutionBlock.getNumber() < validationPeriodEndBlock; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also replaced the |
||||||||||
} | ||||||||||
|
||||||||||
protected void processSvpFundTransactionUnsigned(Transaction rskTx) throws IOException, InsufficientMoneyException { | ||||||||||
Optional<Federation> proposedFederationOpt = federationSupport.getProposedFederation(); | ||||||||||
if (proposedFederationOpt.isEmpty()) { | ||||||||||
|
@@ -1119,10 +1123,10 @@ private void addSvpSpendTransactionInputs(BtcTransaction svpSpendTransaction, Bt | |||||||||
|
||||||||||
private Coin calculateSvpSpendTxAmount(Federation proposedFederation) { | ||||||||||
int svpSpendTransactionSize = calculatePegoutTxSize(activations, proposedFederation, 2, 1); | ||||||||||
long backupSizePercentage = (long) 1.2; // just to be sure the amount sent will be enough | ||||||||||
long svpSpendTransactionBackedUpSize = svpSpendTransactionSize * 12L / 10L; // just to be sure the amount sent will be enough | ||||||||||
|
||||||||||
return feePerKbSupport.getFeePerKb() | ||||||||||
.multiply(svpSpendTransactionSize * backupSizePercentage) | ||||||||||
.multiply(svpSpendTransactionBackedUpSize) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Just an idea, maybe we encapsulate the increase here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i found the other way clearer. We would end up having two |
||||||||||
.divide(1000); | ||||||||||
} | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I wonder if we should also apply this change to active and retiring feds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that. I can create a task in the backlog so we dont forget