Comments (8)
This isn't a bug. I've checked out out your code and run it. The test is failing because you are not sharing the lender (bank) key with the borrow (agent). Or rather.. the agent is not storing a mapping of the new key generated by the bank node to the bank node's x500name. It was useful to look at your code and see where we can make accounts easier to use. I'll make some changes to the code and maybe it'll be easier for you in the future so you won't run into these mistakes. Cheers
from accounts.
It's also worth noting that the lender AccountInfo
can be found in the first "flow" because the initiator part of the flow where all the logic is being executed, is being run by the lender node. The update flow fails because it is being run by the bank node, which doesn't have the mapping.
from accounts.
Can you clarify in the docs what the ShareAccountInfoWithParty does and doesn't do.
/**
* Shares an [AccountInfo] [StateAndRef] with the specified [Party]. The [AccountInfo]is always stored by the
* recipient using [StatesToRecord.ALL_VISIBLE].
*
* @param accountId the account ID of the [AccountInfo] to share.
* @param party the [Party] to share the [AccountInfo] with.
*/
fun shareAccountInfoWithParty(accountId: UUID, party: Party): CordaFuture<Unit>
I expected that this would be enough to share the lender with the agent.
I subsequently found this comment in another demo from a few months ago:
//Share the state and the account with the Bank node so that we can look up by keys
//TODO: The test will fail if we don't do this. Ideally the framework should do this for us
banksAccountService.shareStateAndSyncAccounts(signedTx.tx.outRefsOfType<IOUAccountState>().single(), agents.identity()).runAndGet(network)
Quite clearly, it is easy to forget to do this extra flow, so now I am doing this at the end of the issue flow:
//Notarise and record the transaction in both parties' vaults.
progressTracker.currentStep = FINALISING
val transaction = subFlow(FinalityFlow(fullySignedTx, listOf(borrowerSession)))
val state = transaction.tx.outRefsOfType<IOUAccountState>().single()
subFlow(ShareStateAndSyncAccounts(state, borrowerAccountInfo.state.data.host))
return transaction
Is this the right way to do it?
Could this sharing be done automatically?
from accounts.
You are right - the usability could be improved. However, this is just a V1 so I guess we won't get it 100% right the first time. I'm going to see what I can do to improve this before the release. Thanks
from accounts.
Thinking about this a little, maybe what we need is a version of the SyncKeyMappingFlow
that also adds PublicKey- > Account ID
mappings. Maybe could be called sync account keys flow and can be used when a node already has the AccountInfo
but they are missing some of the key mappings. The mappings can be extracted from a state/transaction or just provided as a list of pairs, or something. Would that help ?
from accounts.
That sounds like it should work.
Obviously, its hard to tell without implementing it and trying it out!
from accounts.
Hi all, I am also facing this kind of issue with the project I am currently working on. Is there any available solution for this?
from accounts.
You need to share the account infos
from accounts.
Related Issues (20)
- Which Versions Of Corda Are Supported?
- Unable to build Accounts since today HOT 2
- Cannot resolve symbol 'r3'
- https://download.corda.net/maven/corda-dependencies/ doesnt exist HOT 1
- Corda 5 compatibility
- IDEA Compile Directories Are Not Ignored
- How to extend AccountInfo ContractState HOT 7
- Share data between accounts on same node HOT 3
- Could not find com.r3.corda.lib.accounts:accounts-flows:1.0-RC04. HOT 1
- Make Accounts Easier To Use HOT 7
- Improvement Suggestion
- Incorrect result with Token intergration using Accounts HOT 3
- Accounts authentication in Corda's node HOT 1
- Empty account_to_state_refs table HOT 7
- Incorrect result while transferring token from Node containing account HOT 10
- Advice on implementing equivalent to FlowLogic.ourIdentity HOT 1
- Schema-validation: wrong column type encountered in column [external_id] in table [XX.account_to_state_refs]
- Send attachments to accounts
- SendKeyForAccountFlow to return AnonymousParty
- The KeyManagementBackedAccountService implementation fails to retrieve the accounts when the number of accounts exceeds DEFAULT_PAGE_SIZE
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from accounts.