Skip to content

Commit

Permalink
CORE-17972: APIs for Send and Receive Transaction (#1346)
Browse files Browse the repository at this point in the history
Added APIs for sending a transaction and receiving a transaction.
  • Loading branch information
jennyang-r3 authored Nov 21, 2023
1 parent f74ecea commit 6911079
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
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:
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(
@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

0 comments on commit 6911079

Please sign in to comment.