Skip to content

Conversation

@adcockalexander
Copy link

  • Moves Corda version to 4.6
  • Adds 'haltForExternalSigning' parameter to flows for moving tokens, which can be set to true to make these flows halt while awaiting a transaction signature (intended for calls to external services)
  • External calls will timeout after 30 minutes

is IssueTokenCommand -> verifyIssue(commands.single(), inputs, outputs, attachments, references)
// Moves may contain more than one move command.
is MoveTokenCommand -> verifyMove(commands, inputs, outputs, attachments, references)
is MoveTokenCommand -> verifyMove(commands, inputs, outputs, attachments, references, summary)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redeem doesn't need summary? It should be signed by token holder too

inputs: List<TransactionState<ContractState>>,
outputs: List<TransactionState<ContractState>>,
commands: List<CommandData>,
attachments: List<SecureHash>): List<String> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are references not needed?

outputs: List<TransactionState<ContractState>>,
commands: List<CommandData>,
attachments: List<SecureHash>): List<String> {
return when(commands.first()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if this throws on empty list? add edge cases

outputs: List<TransactionState<ContractState>>,
commands: List<CommandData>,
attachments: List<SecureHash>): List<String> {
return when(commands.first()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we check only first? what if we have more command data?

// Moves may contain more than one move command.
is MoveTokenCommand -> constructMoveDescription(inputs, outputs)
// Redeems must only contain one redeem command.
is RedeemTokenCommand -> listOf("I AM A REDEPMPTION SONG)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

return when(commands.first()) {
//verify the type jar presence and correctness
// Issuances should only contain one issue command.
is IssueTokenCommand -> listOf("")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be implemented too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or at least some todo

observerSessions.forEach { it.send(TransactionRole.OBSERVER) }
val confidentialOutput = subFlow(ConfidentialTokensFlow(listOf(output), participantSessions)).single()
return subFlow(MoveTokensFlow(input, confidentialOutput, participantSessions, observerSessions))
return subFlow(MoveTokensFlow(listOf(input), listOf(confidentialOutput), participantSessions, observerSessions, haltForExternalSigning))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to change it to listOf(input) etc

?: throw IllegalArgumentException("Didn't provide transactionBuilder nor signedTransaction to the flow.")

val stx = if (haltForExternalSigning) {
await(SignTransactionOperation(transactionBuilder!!, ourSigningKeys, serviceHub))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove !! because it throws null pointer exception without explaining what happened. Have meaningful error handling if the transaction builder is null

val moveFrom = inputs.first().asFungibleToken().holder.owningKey
val moveTo = (outputs.map { it.asFungibleToken().holder }).firstOrNull { p -> p.owningKey != moveFrom }?.owningKey ?: throw IllegalArgumentException("")
val amountToMove = outputs.filter { p -> p.asFungibleToken().holder.owningKey != moveFrom }.first().asFungibleToken().amount
amountToMove.displayTokenSize
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what these lines do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants