mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-03 00:45:49 +00:00
collect call logic bug
This commit is contained in:
@@ -242,8 +242,8 @@ namespace hook
|
|||||||
|
|
||||||
uint32_t maxHookChainLength(void);
|
uint32_t maxHookChainLength(void);
|
||||||
|
|
||||||
uint32_t computeExecutionFee(uint64_t instructionCount);
|
int64_t computeExecutionFee(uint64_t instructionCount);
|
||||||
uint32_t computeCreationFee(uint64_t byteCount);
|
int64_t computeCreationFee(uint64_t byteCount);
|
||||||
|
|
||||||
struct HookResult
|
struct HookResult
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -418,20 +418,22 @@ bool hook::isEmittedTxn(ripple::STTx const& tx)
|
|||||||
|
|
||||||
|
|
||||||
#define U32MAX ((uint32_t)(-1))
|
#define U32MAX ((uint32_t)(-1))
|
||||||
uint32_t hook::computeExecutionFee(uint64_t instructionCount)
|
int64_t hook::computeExecutionFee(uint64_t instructionCount)
|
||||||
{
|
{
|
||||||
// RH TODO: fee multiplier, validator votable
|
int64_t fee = (int64_t)instructionCount;
|
||||||
if (instructionCount > U32MAX)
|
if (fee < instructionCount)
|
||||||
return U32MAX;
|
return 0x7FFFFFFFFFFFFFFFLL;
|
||||||
return instructionCount;
|
|
||||||
|
return fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t hook::computeCreationFee(uint64_t byteCount)
|
int64_t hook::computeCreationFee(uint64_t byteCount)
|
||||||
{
|
{
|
||||||
// RH TODO: fee multiplier, validator votable
|
int64_t fee = ((int64_t)byteCount) * 10000ULL;
|
||||||
if (byteCount > U32MAX)
|
if (fee < byteCount)
|
||||||
return U32MAX;
|
return 0x7FFFFFFFFFFFFFFFLL;
|
||||||
return byteCount;
|
|
||||||
|
return fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t hook::maxHookChainLength(void)
|
uint32_t hook::maxHookChainLength(void)
|
||||||
|
|||||||
@@ -200,9 +200,7 @@ calculateHookChainFee(
|
|||||||
flags = hookDef->getFieldU32(sfFlags);
|
flags = hookDef->getFieldU32(sfFlags);
|
||||||
|
|
||||||
if (hook::canHook(tx.getTxnType(), hookOn) &&
|
if (hook::canHook(tx.getTxnType(), hookOn) &&
|
||||||
((collectCallsOnly && (flags & hook::hsfCOLLECT)) ||
|
(!collectCallsOnly || (flags & hook::hsfCOLLECT)))
|
||||||
(!collectCallsOnly && !(flags & hook::hsfCOLLECT)))
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
fee += FeeUnit64{
|
fee += FeeUnit64{
|
||||||
(uint32_t)(hookDef->getFieldAmount(sfFee).xrp().drops())
|
(uint32_t)(hookDef->getFieldAmount(sfFee).xrp().drops())
|
||||||
|
|||||||
Reference in New Issue
Block a user