From 5eda78584c63a2b5683ec1a1de1b1f07e37b9270 Mon Sep 17 00:00:00 2001 From: nkovacsx <57627796+nkovacsx@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:31:52 +0000 Subject: [PATCH] CORE-19087 Add force backchain option to send tx (#1510) Add a new function to UtxoLedgerService API to force backchain resolution Rename sendAsLedgerTransaction to sendLedgerTransaction --- gradle.properties | 2 +- .../scans/corda-ledger-common-5.2.0.yaml | 1 + .../scans/corda-ledger-utxo-5.2.0.yaml | 40 +++++++++++++++++-- .../v5/ledger/utxo/UtxoLedgerService.java | 16 +++++++- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index c8afe2fec2..7508ed2ae3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ cordaProductVersion = 5.2.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 46 +cordaApiRevision = 47 # Main kotlin.stdlib.default.dependency = false diff --git a/ledger/ledger-common/scans/corda-ledger-common-5.2.0.yaml b/ledger/ledger-common/scans/corda-ledger-common-5.2.0.yaml index a6ab68fb42..3cc7ccd6a5 100644 --- a/ledger/ledger-common/scans/corda-ledger-common-5.2.0.yaml +++ b/ledger/ledger-common/scans/corda-ledger-common-5.2.0.yaml @@ -39,6 +39,7 @@ net.corda.v5.ledger.common.NotaryLookup: type: net.corda.v5.base.types.MemberX500Name net.corda.v5.ledger.common.transaction.CordaPackageSummary: annotations: + - CordaSerializable - DoNotImplement type: public interface extends: [] diff --git a/ledger/ledger-utxo/scans/corda-ledger-utxo-5.2.0.yaml b/ledger/ledger-utxo/scans/corda-ledger-utxo-5.2.0.yaml index 69a099366e..98df8f4940 100644 --- a/ledger/ledger-utxo/scans/corda-ledger-utxo-5.2.0.yaml +++ b/ledger/ledger-utxo/scans/corda-ledger-utxo-5.2.0.yaml @@ -550,7 +550,7 @@ net.corda.v5.ledger.utxo.UtxoLedgerService: annotation: - NotNull type: net.corda.v5.application.messaging.FlowSession - sendAsLedgerTransaction: + sendLedgerTransaction: annotations: - Suspendable default: false @@ -580,6 +580,21 @@ net.corda.v5.ledger.utxo.UtxoLedgerService: annotation: - NotNull type: java.util.List + sendTransactionWithBackchain: + annotations: + - Suspendable + default: false + type: public abstract + returnType: void + params: + signedTransaction: + annotation: + - NotNull + type: net.corda.v5.ledger.utxo.transaction.UtxoSignedTransaction + sessions: + annotation: + - NotNull + type: java.util.List sendUpdatedTransactionBuilder: annotations: - Suspendable @@ -1100,11 +1115,28 @@ net.corda.v5.ledger.utxo.query.registration.VaultNamedQueryBuilder: annotation: - NotNull type: "net.corda.v5.ledger.utxo.query.VaultNamedQueryTransformer" + orderBy: + annotations: + - NotNull + default: false + type: public abstract + returnType: net.corda.v5.ledger.utxo.query.registration.VaultNamedQueryBuilder + params: + columnExpression: + annotation: + - NotNull + type: String register: annotations: [] default: false type: public abstract returnType: void + selectUnconsumedStatesOnly: + annotations: + - NotNull + default: false + type: public abstract + returnType: net.corda.v5.ledger.utxo.query.registration.VaultNamedQueryBuilder whereJson: annotations: - NotNull @@ -1232,7 +1264,8 @@ net.corda.v5.ledger.utxo.token.selection.TokenBalance: type: public abstract returnType: java.math.BigDecimal net.corda.v5.ledger.utxo.token.selection.TokenBalanceCriteria: - annotations: [] + annotations: + - CordaSerializable type: public final class extends: null implements: [] @@ -1339,7 +1372,8 @@ net.corda.v5.ledger.utxo.token.selection.TokenClaim: - NotNull type: java.util.List net.corda.v5.ledger.utxo.token.selection.TokenClaimCriteria: - annotations: [] + annotations: + - CordaSerializable type: public final class extends: null implements: [] diff --git a/ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/UtxoLedgerService.java b/ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/UtxoLedgerService.java index dc5ca6bd8e..163df75cba 100644 --- a/ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/UtxoLedgerService.java +++ b/ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/UtxoLedgerService.java @@ -281,6 +281,20 @@ void sendTransaction( @NotNull List sessions ); + /** + * Sends the transaction to counterparty sessions and forces backchain resolution. + * + * @param sessions The counterparties who receive the transaction. + * @param signedTransaction The {@link UtxoSignedTransaction} to send. + * @throws CordaRuntimeException If transaction verification fails on the receiving sessions. + */ + @Suspendable + void sendTransactionWithBackchain( + @NotNull UtxoSignedTransaction signedTransaction, + @NotNull List sessions + ); + + /** * Receives a verified transaction from the counterparty session and persists it to the vault. * @@ -301,7 +315,7 @@ UtxoSignedTransaction receiveTransaction( * @param sessions The counterparties who receive the transaction. */ @Suspendable - void sendAsLedgerTransaction( + void sendLedgerTransaction( @NotNull UtxoSignedTransaction signedTransaction, @NotNull List sessions );