Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,27 @@ class WalletTxLogIntegrationTest
)
}

"not blow up with failed CO_TransferPreapprovalSend" in { implicit env =>
// Note: using Alice and Charlie because manually creating subscriptions requires both
// the sender and the receiver to be hosted on the same participant.
onboardWalletUser(aliceWalletClient, aliceValidatorBackend)
val charlieUserParty = onboardWalletUser(charlieWalletClient, aliceValidatorBackend)

aliceValidatorWalletClient.tap(100) // funds to create preapproval
charlieWalletClient.createTransferPreapproval()

assertCommandFailsDueToInsufficientFunds(
aliceWalletClient.transferPreapprovalSend(
charlieUserParty,
BigDecimal(10000000),
UUID.randomUUID().toString,
Some("this should not go through"),
)
)

aliceWalletClient.listTransactions(None, Limit.MaxPageSize) shouldBe empty
}

}

private def assertCommandFailsDueToInsufficientFunds[T](cmd: => Unit): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.lfdecentralizedtrust.splice.codegen.java.splice.wallet.install.amulet
CO_SubscriptionAcceptAndMakeInitialPayment,
CO_SubscriptionMakePayment,
CO_Tap,
CO_TransferPreapprovalSend,
ExtAmuletOperation,
}
import org.lfdecentralizedtrust.splice.codegen.java.splice.wallet.install.{
Expand All @@ -56,17 +57,17 @@ import org.lfdecentralizedtrust.splice.history.{
AmuletRules_CreateTransferPreapproval,
AnsRules_CollectEntryRenewalPayment,
AnsRules_CollectInitialEntryPayment,
CreateTokenStandardTransferInstruction,
LockedAmuletExpireAmulet,
LockedAmuletOwnerExpireLock,
LockedAmuletUnlock,
Mint,
Tap,
CreateTokenStandardTransferInstruction,
Transfer,
TransferInstructionCreate,
TransferInstruction_Accept,
TransferInstruction_Reject,
TransferInstruction_Withdraw,
Transfer,
TransferPreapproval_Renew,
TransferPreapproval_Send,
}
Expand Down Expand Up @@ -247,7 +248,7 @@ class UserWalletTxLogParser(
_: CO_MergeTransferInputs | _: CO_BuyMemberTraffic |
_: CO_CompleteBuyTrafficRequest | _: CO_CreateExternalPartySetupProposal |
_: CO_AcceptTransferPreapprovalProposal | _: CO_RenewTransferPreapproval |
_: CO_Tap | _: ExtAmuletOperation =>
_: CO_Tap | _: CO_TransferPreapprovalSend | _: ExtAmuletOperation =>
State.empty
case _ => {
throw new RuntimeException(s"Invalid operation $op")
Expand Down
Loading