Merge remote-tracking branch 'refs/remotes/origin/dev' into dev

This commit is contained in:
Richard Holland
2023-08-15 10:08:25 +00:00
9 changed files with 1274 additions and 1092 deletions

View File

@@ -169,14 +169,27 @@ XRPNotCreated::finalize(
: beast::zero; // if the txn didnt burn a fee we add nothing
if (accountsCreated_ == 1)
dropsAdded += Import::computeStartingBonus(view);
maxDropsAdded += Import::computeStartingBonus(view);
JLOG(j.trace())
<< "Invariant XRPNotCreated Import: "
<< "dropsAdded: " << dropsAdded
<< "maxDropsAdded: " << maxDropsAdded
<< " fee.drops(): " << fee.drops()
<< " drops_: " << drops_
<< " <= dropsAdded - fee.drops(): " << dropsAdded - fee.drops();
<< " <= maxDropsAdded - fee.drops(): " << maxDropsAdded - fee.drops();
// We should never allow more than the max supply in totalCoins.
XRPAmount const newTotal = view.info().drops + maxDropsAdded;
if (newTotal > INITIAL_XRP)
{
JLOG(j.fatal()) << "Invariant failed Import: total coins paid exceeds "
<< "system limit: "<< INITIAL_XRP
<< "maxDropsAdded: " << maxDropsAdded
<< " fee.drops(): " << fee.drops()
<< " info().drops: " << view.info().drops
<< " newTotal: " << newTotal;
return false;
}
return (drops_ <= maxDropsAdded.drops() - fee.drops());
}
@@ -190,10 +203,10 @@ XRPNotCreated::finalize(
dropsAdded += dest.getFieldAmount(sfAmount).xrp();
JLOG(j.trace())
<< "Invariant XRPNotCreated GenesisMint: "
<< "Invariant XRPNotCreated GenesisMint: "
<< "dropsAdded: " << dropsAdded
<< " fee.drops(): " << fee.drops()
<< " drops_: " << drops_
<< " fee.drops(): " << fee.drops()
<< " drops_: " << drops_
<< " dropsAdded - fee.drops(): " << dropsAdded - fee.drops();
int64_t drops = dropsAdded.drops() - fee.drops();
@@ -202,10 +215,21 @@ XRPNotCreated::finalize(
if (drops > dropsAdded.drops() || drops > fee.drops())
return false;
// We should never allow more than the max supply in totalCoins.
XRPAmount const newTotal = view.info().drops + dropsAdded;
if (newTotal > INITIAL_XRP)
{
JLOG(j.fatal()) << "Invariant failed GenesisMint: total coins exceeds "
<< "system limit: "<< INITIAL_XRP
<< "dropsAdded: " << dropsAdded
<< " fee.drops(): " << fee.drops()
<< " info().drops: " << view.info().drops
<< " newTotal: " << newTotal;
return false;
}
return drops_ == drops;
}
// The net change should never be positive, as this would mean that the
// transaction created XRP out of thin air. That's not possible.