mirror of
https://github.com/corda/corda.git
synced 2025-06-15 05:38:14 +00:00
Changes the name of the addTimeWindow method to setTimeWindow.
This commit is contained in:
@ -30,6 +30,7 @@ import net.corda.flows.SignTransactionFlow;
|
||||
import org.bouncycastle.asn1.x500.X500Name;
|
||||
|
||||
import java.security.PublicKey;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -303,7 +304,10 @@ public class FlowCookbookJava {
|
||||
regTxBuilder.addOutputState(ourOutput);
|
||||
regTxBuilder.addCommand(ourCommand);
|
||||
regTxBuilder.addAttachment(ourAttachment);
|
||||
regTxBuilder.addTimeWindow(ourTimeWindow);
|
||||
|
||||
// We set the time-window within which the transaction must be notarised using either of:
|
||||
regTxBuilder.setTimeWindow(ourTimeWindow);
|
||||
regTxBuilder.setTimeWindow(getServiceHub().getClock().instant(), Duration.ofSeconds(30));
|
||||
|
||||
/*-----------------------
|
||||
* TRANSACTION SIGNING *
|
||||
|
@ -29,6 +29,7 @@ import net.corda.flows.ResolveTransactionsFlow
|
||||
import net.corda.flows.SignTransactionFlow
|
||||
import org.bouncycastle.asn1.x500.X500Name
|
||||
import java.security.PublicKey
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
|
||||
// We group our two flows inside a singleton object to indicate that they work
|
||||
@ -286,7 +287,10 @@ object FlowCookbook {
|
||||
regTxBuilder.addOutputState(ourOutput)
|
||||
regTxBuilder.addCommand(ourCommand)
|
||||
regTxBuilder.addAttachment(ourAttachment)
|
||||
regTxBuilder.addTimeWindow(ourTimeWindow)
|
||||
|
||||
// We set the time-window within which the transaction must be notarised using either of:
|
||||
regTxBuilder.timeWindow = ourTimeWindow
|
||||
regTxBuilder.setTimeWindow(serviceHub.clock.instant(), Duration.ofSeconds(30))
|
||||
|
||||
/**----------------------
|
||||
* TRANSACTION SIGNING *
|
||||
|
@ -123,7 +123,7 @@ class SubmitTradeApprovalFlow(val tradeId: String,
|
||||
// Create the TransactionBuilder and populate with the new state.
|
||||
val tx = TransactionType.General.Builder(notary)
|
||||
.withItems(tradeProposal, Command(TradeApprovalContract.Commands.Issue(), listOf(tradeProposal.source.owningKey)))
|
||||
tx.addTimeWindow(serviceHub.clock.instant(), Duration.ofSeconds(60))
|
||||
tx.setTimeWindow(serviceHub.clock.instant(), Duration.ofSeconds(60))
|
||||
// We can automatically sign as there is no untrusted data.
|
||||
val signedTx = serviceHub.signInitialTransaction(tx)
|
||||
// Notarise and distribute.
|
||||
@ -184,7 +184,7 @@ class SubmitCompletionFlow(val ref: StateRef, val verdict: WorkflowState) : Flow
|
||||
newState,
|
||||
Command(TradeApprovalContract.Commands.Completed(),
|
||||
listOf(serviceHub.myInfo.legalIdentity.owningKey, latestRecord.state.data.source.owningKey)))
|
||||
tx.addTimeWindow(serviceHub.clock.instant(), Duration.ofSeconds(60))
|
||||
tx.setTimeWindow(serviceHub.clock.instant(), Duration.ofSeconds(60))
|
||||
// We can sign this transaction immediately as we have already checked all the fields and the decision
|
||||
// is ultimately a manual one from the caller.
|
||||
// As a SignedTransaction we can pass the data around certain that it cannot be modified,
|
||||
|
Reference in New Issue
Block a user