Skip to content

Commit 6ae6fec

Browse files
committed
notary selection adjustment
1 parent 9e8a17e commit 6ae6fec

File tree

39 files changed

+379
-56
lines changed

39 files changed

+379
-56
lines changed

Accounts/supplychain/workflows/src/main/java/com/supplychain/flows/InternalMessage.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,16 @@ public String call() throws FlowException {
8484
//generating State for transfer
8585
InternalMessageState output = new InternalMessageState(message,new AnonymousParty(myKey),targetAcctAnonymousParty);
8686

87-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
87+
// Obtain a reference to a notary we wish to use.
88+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
89+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
90+
*
91+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
92+
*/
93+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
94+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
95+
96+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
8897
.addOutputState(output)
8998
.addCommand(new InternalMessageStateContract.Commands.Create(),Arrays.asList(targetAcctAnonymousParty.getOwningKey(),myKey));
9099
progressTracker.setCurrentStep(SIGNING_TRANSACTION);

Accounts/supplychain/workflows/src/main/java/com/supplychain/flows/SendCargo.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,17 @@ public String call() throws FlowException {
5555

5656
//generating State for transfer
5757
CargoState output = new CargoState(new AnonymousParty(myKey),targetAcctAnonymousParty,cargo,getOurIdentity());
58-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
58+
59+
// Obtain a reference to a notary we wish to use.
60+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
61+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
62+
*
63+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
64+
*/
65+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
66+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
67+
68+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
5969
.addOutputState(output)
6070
.addCommand(new CargoStateContract.Commands.Create(), Arrays.asList(targetAcctAnonymousParty.getOwningKey(),getOurIdentity().getOwningKey()));
6171

Accounts/supplychain/workflows/src/main/java/com/supplychain/flows/SendInvoice.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,17 @@ public String call() throws FlowException {
5555

5656
//generating State for transfer
5757
InvoiceState output = new InvoiceState(amount,new AnonymousParty(myKey),targetAcctAnonymousParty, UUID.randomUUID());
58-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
58+
59+
// Obtain a reference to a notary we wish to use.
60+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
61+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
62+
*
63+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
64+
*/
65+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
66+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
67+
68+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
5969
.addOutputState(output)
6070
.addCommand(new InvoiceStateContract.Commands.Create(), Arrays.asList(targetAcctAnonymousParty.getOwningKey(),myKey));
6171

Accounts/supplychain/workflows/src/main/java/com/supplychain/flows/SendPayment.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,17 @@ public String call() throws FlowException {
5454

5555
//generating State for transfer
5656
PaymentState output = new PaymentState(amount,new AnonymousParty(myKey),targetAcctAnonymousParty);
57-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
57+
58+
// Obtain a reference to a notary we wish to use.
59+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
60+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
61+
*
62+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
63+
*/
64+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
65+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
66+
67+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
5868
.addOutputState(output)
5969
.addCommand(new PaymentStateContract.Commands.Create(), Arrays.asList(targetAcctAnonymousParty.getOwningKey(),myKey));
6070

Accounts/supplychain/workflows/src/main/java/com/supplychain/flows/SendShippingRequest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,17 @@ public String call() throws FlowException {
8787
//generating State for transfer
8888
progressTracker.setCurrentStep(GENERATING_TRANSACTION);
8989
ShippingRequestState output = new ShippingRequestState(new AnonymousParty(myKey),whereTo,shipper,cargo);
90-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
90+
91+
// Obtain a reference to a notary we wish to use.
92+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
93+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
94+
*
95+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
96+
*/
97+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
98+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
99+
100+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
91101
.addOutputState(output)
92102
.addCommand(new ShippingRequestStateContract.Commands.Create(), Arrays.asList(shipper.getOwningKey(),myKey));
93103

Accounts/tictacthor/workflows/src/main/java/com/tictacthor/flows/EndGameFlow.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,17 @@ public String call() throws FlowException {
9090

9191
progressTracker.setCurrentStep(GENERATING_TRANSACTION);
9292
//generating State for transfer
93-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
93+
94+
// Obtain a reference to a notary we wish to use.
95+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
96+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
97+
*
98+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
99+
*/
100+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
101+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
102+
103+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
94104
.addInputState(inputBoardStateAndRef)
95105
.addCommand(new BoardContract.Commands.EndGame(),Arrays.asList(myKey,targetAcctAnonymousParty.getOwningKey()));
96106

Accounts/tictacthor/workflows/src/main/java/com/tictacthor/flows/StartGameFlow.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,16 @@ public UniqueIdentifier call() throws FlowException {
9090
new AnonymousParty(myKey),
9191
targetAcctAnonymousParty);
9292

93-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
93+
// Obtain a reference to a notary we wish to use.
94+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
95+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
96+
*
97+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
98+
*/
99+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
100+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
101+
102+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
94103
.addOutputState(initialBoardState)
95104
.addCommand(new BoardContract.Commands.StartGame(),Arrays.asList(myKey,targetAcctAnonymousParty.getOwningKey()));
96105

Accounts/tictacthor/workflows/src/main/java/com/tictacthor/flows/SubmitTurnFlow.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,17 @@ public String call() throws FlowException {
102102
progressTracker.setCurrentStep(GENERATING_TRANSACTION);
103103
//generating State for transfer
104104
BoardState outputBoardState = inputBoardState.returnNewBoardAfterMove(new Pair<>(x,y),new AnonymousParty(myKey), targetAcctAnonymousParty);
105-
TransactionBuilder txbuilder = new TransactionBuilder(getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0))
105+
106+
// Obtain a reference to a notary we wish to use.
107+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
108+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
109+
*
110+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
111+
*/
112+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
113+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
114+
115+
TransactionBuilder txbuilder = new TransactionBuilder(notary)
106116
.addInputState(inputBoardStateAndRef)
107117
.addOutputState(outputBoardState)
108118
.addCommand(new BoardContract.Commands.SubmitTurn(),Arrays.asList(myKey,targetAcctAnonymousParty.getOwningKey()));

Accounts/worldcupticketbooking/workflows/src/main/java/com/t20worldcup/flows/CreateT20CricketTicketTokenFlow.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ public CreateT20CricketTicketTokenFlow(String ticketTeam) {
3030
@Override
3131
@Suspendable
3232
public String call() throws FlowException {
33-
//get the notary
34-
Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
33+
// Obtain a reference to a notary we wish to use.
34+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
35+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
36+
*
37+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
38+
*/
39+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
40+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
3541

3642
//create token type by passing in the name of the ipl match. specify the maintainer as BCCI
3743
UniqueIdentifier id = new UniqueIdentifier();

Accounts/worldcupticketbooking/workflows/src/main/java/com/t20worldcup/flows/DVPAccountsHostedOnDifferentNodes.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,14 @@ public Void call() throws FlowException {
228228
//get the pointer pointer to the T20CricketTicket
229229
TokenPointer tokenPointer = evolvableTokenType.toPointer(evolvableTokenType.getClass());
230230

231-
Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
231+
// Obtain a reference to a notary we wish to use.
232+
/** METHOD 1: Take first notary on network, WARNING: use for test, non-prod environments, and single-notary networks only!*
233+
* METHOD 2: Explicit selection of notary by CordaX500Name - argument can by coded in flow or parsed from config (Preferred)
234+
*
235+
* * - For production you always want to use Method 2 as it guarantees the expected notary is returned.
236+
*/
237+
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); // METHOD 1
238+
// final Party notary = getServiceHub().getNetworkMapCache().getNotary(CordaX500Name.parse("O=Notary,L=London,C=GB")); // METHOD 2
232239

233240
TransactionBuilder transactionBuilder = new TransactionBuilder(notary);
234241

0 commit comments

Comments
 (0)