Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-17972: APIs for Send and Receive Transaction #1346

Merged
merged 6 commits into from
Nov 21, 2023
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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 = 3
cordaApiRevision = 4

# Main
kotlinVersion = 1.8.21
Expand Down
27 changes: 27 additions & 0 deletions ledger/ledger-utxo/scans/corda-ledger-utxo-5.2.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,18 @@ net.corda.v5.ledger.utxo.UtxoLedgerService:
annotation:
- NotNull
type: net.corda.v5.ledger.utxo.transaction.UtxoTransactionValidator
receiveTransaction:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@blsemo do you have any information on what this file is for because this is new to me?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is not that related to this PR? #1274

Copy link
Contributor Author

@jennyang-r3 jennyang-r3 Nov 20, 2023

Choose a reason for hiding this comment

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

this was generated when I ran ./gradlew cementApi to be able to raise breaking changes to PR, it looks like we now must run it to raise it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What does it define as breaking changes? 🤔 We didn't break anything...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding new APIs is breaking change it looks like.

Copy link
Contributor

Choose a reason for hiding this comment

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

Adding APIs needs to be added to the list of things not to break, so you need to regenerate.

annotations:
- Suspendable
- NotNull
default: false
type: public abstract
returnType: net.corda.v5.ledger.utxo.transaction.UtxoSignedTransaction
params:
session:
annotation:
- NotNull
type: net.corda.v5.application.messaging.FlowSession
receiveTransactionBuilder:
annotations:
- Suspendable
Expand Down Expand Up @@ -461,6 +473,21 @@ net.corda.v5.ledger.utxo.UtxoLedgerService:
annotation:
- NotNull
type: net.corda.v5.application.messaging.FlowSession
sendTransaction:
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<net.corda.v5.application.messaging.FlowSession>
sendUpdatedTransactionBuilder:
annotations:
- Suspendable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.corda.v5.application.persistence.PagedQuery.ResultSet;
import net.corda.v5.base.annotations.DoNotImplement;
import net.corda.v5.base.annotations.Suspendable;
import net.corda.v5.base.exceptions.CordaRuntimeException;
import net.corda.v5.crypto.SecureHash;
import net.corda.v5.ledger.utxo.query.VaultNamedParameterizedQuery;
import net.corda.v5.ledger.utxo.query.VaultNamedQueryFactory;
Expand Down Expand Up @@ -247,6 +248,31 @@ void sendUpdatedTransactionBuilder(
@NotNull FlowSession session
);

/**
* Sends the transaction to counterparty sessions.
*
* @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 sendTransaction(
@NotNull UtxoSignedTransaction signedTransaction,
@NotNull List<FlowSession> sessions
);

/**
* Receives a verified transaction from the counterparty session and persists it to the vault.
*
* @param session The counterparty to receive a transaction from.
* @return the {@link UtxoSignedTransaction} received from counterparty.
* @throws CordaRuntimeException If the transaction received fails verification.
*/
@NotNull
@Suspendable
UtxoSignedTransaction receiveTransaction(
jennyang-r3 marked this conversation as resolved.
Show resolved Hide resolved
@NotNull FlowSession session
);

/**
* Creates a query object for a vault named query with the given name. This query can be executed later by calling
Expand Down