Skip to content

Commit

Permalink
Fix mpt conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatcam committed Jul 12, 2024
1 parent 20eab6c commit a9eafe6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
19 changes: 3 additions & 16 deletions src/test/jtx/amount.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class MPT
return mptID;
}

/** Implicit conversion to Issue.
/** Implicit conversion to MPTIssue.
This allows passing an MPT
value where an Issue is expected.
Expand All @@ -457,23 +457,10 @@ class MPT
}

template <class T>
requires(sizeof(T) >= sizeof(int) && std::is_arithmetic_v<T>) PrettyAmount
requires(sizeof(T) >= sizeof(int) && std::is_arithmetic_v<T>) STMPTAmount
operator()(T v) const
{
// VFALCO NOTE Should throw if the
// representation of v is not exact.
return {amountFromString(mptID, std::to_string(v)), name};
}

PrettyAmount operator()(epsilon_t) const;
PrettyAmount operator()(detail::epsilon_multiple) const;

friend BookSpec
operator~(MPT const& mpt)
{
assert(false);
Throw<std::logic_error>("MPT is not supported");
return BookSpec{beast::zero, noCurrency()};
return amountFromString(mptID, std::to_string(v));
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/mpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ MPTTester::claw(
mptpay(*this, holder, holderAmt - std::min(holderAmt, amount)));
}

PrettyAmount
STMPTAmount
MPTTester::mpt(std::int64_t amount) const
{
assert(mpt_);
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/mpt.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class MPTTester
std::int64_t amount,
std::optional<TER> err = std::nullopt);

PrettyAmount
STMPTAmount
mpt(std::int64_t amount) const;

uint256 const&
Expand Down

0 comments on commit a9eafe6

Please sign in to comment.