make ttINVOKE much more flexible

This commit is contained in:
Richard Holland
2022-12-22 11:42:20 +00:00
parent 7aa49cdf19
commit e8e4bf7bf3
3 changed files with 9 additions and 7 deletions

View File

@@ -204,7 +204,8 @@ namespace hook
case ttPAYCHAN_CREATE:
case ttINVOKE:
{
ADD_TSH(*destAcc, canRollback);
if (destAcc)
ADD_TSH(*destAcc, canRollback);
break;
}

View File

@@ -40,9 +40,6 @@ Invoke::preflight(PreflightContext const& ctx)
auto& tx = ctx.tx;
auto& j = ctx.j;
if (!tx.isFieldPresent(sfBlob) && !tx.isFieldPresent(sfHookParameters))
return temMALFORMED;
if (tx.getFieldVL(sfBlob).size() > (128*1024))
return temMALFORMED;
@@ -61,8 +58,11 @@ Invoke::preclaim(PreclaimContext const& ctx)
if (!sle)
return terNO_ACCOUNT;
if (!ctx.view.exists(keylet::account(ctx.tx[sfDestination])))
return tecNO_TARGET;
if (ctx.tx.isFieldPresent(sfDestination))
{
if (!ctx.view.exists(keylet::account(ctx.tx[sfDestination])))
return tecNO_TARGET;
}
return tesSUCCESS;
}

View File

@@ -357,7 +357,8 @@ TxFormats::TxFormats()
{
{sfBlob, soeOPTIONAL},
{sfHookParameters, soeOPTIONAL},
{sfDestination, soeREQUIRED}
{sfDestination, soeOPTIONAL},
{sfInvoiceID, soeOPTIONAL},
},
commonFields);
}