Skip to content

Commit

Permalink
Fix payment for unauthorized holder
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatcam committed Aug 13, 2024
1 parent a80a8cd commit f5081e8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/app/MPToken_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,25 @@ class MPToken_test : public beast::unit_test::suite
mptAlice.pay(bob, carol, 50);
}

// Holder is not authorized
{
Env env{*this, features};

MPTTester mptAlice(env, alice, {.holders = {&bob, &carol}});

mptAlice.create(
{.ownerCount = 1, .holderCount = 0, .flags = tfMPTCanTransfer});

// issuer to holder
mptAlice.pay(alice, bob, 100, tecNO_AUTH);

// holder to issuer
mptAlice.pay(bob, alice, 100, tecNO_AUTH);

// holder to holder
mptAlice.pay(bob, carol, 50, tecNO_AUTH);
}

// If allowlisting is enabled, Payment fails if the receiver is not
// authorized
{
Expand Down
4 changes: 4 additions & 0 deletions src/xrpld/ledger/detail/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,8 @@ rippleCredit(
else
return tecINSUFFICIENT_FUNDS;
}
else
return tecNO_AUTH;
}

if (uReceiverID == issuer)
Expand Down Expand Up @@ -1921,6 +1923,8 @@ rippleCredit(
sfMPTAmount, sle->getFieldU64(sfMPTAmount) + saAmount.value());
view.update(sle);
}
else
return tecNO_AUTH;
}
return tesSUCCESS;
}
Expand Down

0 comments on commit f5081e8

Please sign in to comment.