mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Check for malformed public key on payment channel
This commit is contained in:
@@ -171,6 +171,9 @@ PayChanCreate::preflight (PreflightContext const& ctx)
|
||||
if (ctx.tx[sfAccount] == ctx.tx[sfDestination])
|
||||
return temDST_IS_SRC;
|
||||
|
||||
if (!publicKeyType(ctx.tx[sfPublicKey]))
|
||||
return temMALFORMED;
|
||||
|
||||
return preflight2 (ctx);
|
||||
}
|
||||
|
||||
@@ -378,6 +381,8 @@ PayChanClaim::preflight (PreflightContext const& ctx)
|
||||
return tecNO_PERMISSION;
|
||||
|
||||
Keylet const k (ltPAYCHAN, ctx.tx[sfPayChannel]);
|
||||
if (!publicKeyType(ctx.tx[sfPublicKey]))
|
||||
return temMALFORMED;
|
||||
PublicKey const pk (ctx.tx[sfPublicKey]);
|
||||
Serializer msg;
|
||||
serializePayChanAuthorization (msg, k.key, authAmt);
|
||||
|
||||
@@ -40,9 +40,12 @@ void addChannel (Json::Value& jsonLines, SLE const& line)
|
||||
jDst[jss::destination_account] = to_string (line[sfDestination]);
|
||||
jDst[jss::amount] = line[sfAmount].getText ();
|
||||
jDst[jss::balance] = line[sfBalance].getText ();
|
||||
PublicKey const pk (line[sfPublicKey]);
|
||||
jDst[jss::public_key] = toBase58 (TokenType::TOKEN_ACCOUNT_PUBLIC, pk);
|
||||
jDst[jss::public_key_hex] = strHex (pk);
|
||||
if (publicKeyType(line[sfPublicKey]))
|
||||
{
|
||||
PublicKey const pk (line[sfPublicKey]);
|
||||
jDst[jss::public_key] = toBase58 (TokenType::TOKEN_ACCOUNT_PUBLIC, pk);
|
||||
jDst[jss::public_key_hex] = strHex (pk);
|
||||
}
|
||||
jDst[jss::settle_delay] = line[sfSettleDelay];
|
||||
if (auto const& v = line[~sfExpiration])
|
||||
jDst[jss::expiration] = *v;
|
||||
|
||||
Reference in New Issue
Block a user