mirror of
https://github.com/corda/corda.git
synced 2025-04-15 15:07:03 +00:00
Fixing post merge issues with reference states
This commit is contained in:
parent
bb7d33380f
commit
1fda42c2de
@ -37,9 +37,10 @@ abstract class AsyncCFTNotaryService : TrustedAuthorityNotaryService() {
|
||||
txId: SecureHash,
|
||||
callerIdentity: Party,
|
||||
requestSignature: NotarisationRequestSignature,
|
||||
timeWindow: TimeWindow?
|
||||
timeWindow: TimeWindow?,
|
||||
references: List<StateRef>
|
||||
): CordaFuture<Result> {
|
||||
return asyncUniquenessProvider.commitAsync(states, txId, callerIdentity, requestSignature, timeWindow)
|
||||
return asyncUniquenessProvider.commitAsync(states, txId, callerIdentity, requestSignature, timeWindow, references)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,9 +54,11 @@ abstract class AsyncCFTNotaryService : TrustedAuthorityNotaryService() {
|
||||
val txId: SecureHash,
|
||||
val caller: Party,
|
||||
val requestSignature: NotarisationRequestSignature,
|
||||
val timeWindow: TimeWindow?) : FlowAsyncOperation<Result> {
|
||||
val timeWindow: TimeWindow?,
|
||||
val references: List<StateRef>
|
||||
): FlowAsyncOperation<Result> {
|
||||
override fun execute(): CordaFuture<Result> {
|
||||
return service.commitAsync(inputs, txId, caller, requestSignature, timeWindow)
|
||||
return service.commitAsync(inputs, txId, caller, requestSignature, timeWindow, references)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ import net.corda.core.identity.Party
|
||||
*/
|
||||
interface AsyncUniquenessProvider : UniquenessProvider {
|
||||
/** Commits all input states of the given transaction. */
|
||||
fun commitAsync(states: List<StateRef>, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?): CordaFuture<Result>
|
||||
fun commitAsync(states: List<StateRef>, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?, references: List<StateRef>): CordaFuture<Result>
|
||||
|
||||
/** Commits all input states of the given transaction synchronously. Use [commitAsync] for better performance. */
|
||||
override fun commit(states: List<StateRef>, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?) {
|
||||
val result = commitAsync(states, txId, callerIdentity, requestSignature, timeWindow).get()
|
||||
override fun commit(states: List<StateRef>, txId: SecureHash, callerIdentity: Party, requestSignature: NotarisationRequestSignature, timeWindow: TimeWindow?, references: List<StateRef>) {
|
||||
val result = commitAsync(states, txId, callerIdentity, requestSignature, timeWindow,references).get()
|
||||
if (result is Result.Failure) {
|
||||
throw NotaryInternalException(result.error)
|
||||
}
|
||||
|
@ -240,7 +240,8 @@ class MySQLNotaryServiceTests : IntegrationTest() {
|
||||
txId,
|
||||
callerParty,
|
||||
requestSignature,
|
||||
null).execute()
|
||||
null,
|
||||
emptyList()).execute()
|
||||
}
|
||||
return futures.transpose().get()
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ class MySQLUniquenessProvider(
|
||||
val callerIdentity: Party,
|
||||
val requestSignature: NotarisationRequestSignature,
|
||||
val timeWindow: TimeWindow?,
|
||||
val references: List<StateRef>,
|
||||
val id: UUID = UUID.randomUUID())
|
||||
|
||||
private val metricPrefix = MySQLUniquenessProvider::class.simpleName
|
||||
@ -176,11 +177,12 @@ class MySQLUniquenessProvider(
|
||||
txId: SecureHash,
|
||||
callerIdentity: Party,
|
||||
requestSignature: NotarisationRequestSignature,
|
||||
timeWindow: TimeWindow?
|
||||
timeWindow: TimeWindow?,
|
||||
references: List<StateRef>
|
||||
): CordaFuture<Result> {
|
||||
inputStateCount.update(states.size)
|
||||
val timer = Stopwatch.createStarted()
|
||||
val request = CommitRequest(states, txId, callerIdentity, requestSignature, timeWindow)
|
||||
val request = CommitRequest(states, txId, callerIdentity, requestSignature, timeWindow, references)
|
||||
val future = openFuture<Result>()
|
||||
requestFutures[request.id] = future
|
||||
future.then {
|
||||
|
@ -498,17 +498,14 @@ class NodeVaultService(
|
||||
Vault.Page(states = statesAndRefs, statesMetadata = statesMeta, stateTypes = criteriaParser.stateTypes, totalStatesAvailable = totalStates, otherResults = otherResults)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(VaultQueryException::class)
|
||||
override fun <T : ContractState> _trackBy(criteria: QueryCriteria, paging: PageSpecification, sorting: Sort, contractStateType: Class<out T>): DataFeed<Vault.Page<T>, Vault.Update<T>> {
|
||||
return mutex.locked {
|
||||
concurrentBox.exclusive {
|
||||
val snapshotResults = _queryBy(criteria, paging, sorting, contractStateType)
|
||||
val updates: Observable<Vault.Update<T>> = uncheckedCast(_updatesPublisher.bufferUntilSubscribed()
|
||||
.filter { it.containsType(contractStateType, snapshotResults.stateTypes) }
|
||||
.map { filterContractStates(it, contractStateType) })
|
||||
DataFeed(snapshotResults, updates)
|
||||
}
|
||||
return concurrentBox.exclusive {
|
||||
val snapshotResults = _queryBy(criteria, paging, sorting, contractStateType)
|
||||
val updates: Observable<Vault.Update<T>> = uncheckedCast(_updatesPublisher.bufferUntilSubscribed()
|
||||
.filter { it.containsType(contractStateType, snapshotResults.stateTypes) }
|
||||
.map { filterContractStates(it, contractStateType) })
|
||||
DataFeed(snapshotResults, updates)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,8 @@ open class AsyncLoadTestFlow<T : AsyncCFTNotaryService>(
|
||||
val inputs = inputGenerator.generateOrFail(random)
|
||||
val requestSignature = NotarisationRequest(inputs, txId).generateSignature(serviceHub)
|
||||
|
||||
futures += AsyncCFTNotaryService.CommitOperation(service, inputs, txId, callerParty, requestSignature, null).execute()
|
||||
futures += AsyncCFTNotaryService.CommitOperation(service, inputs, txId, callerParty, requestSignature,
|
||||
null, emptyList()).execute()
|
||||
}
|
||||
|
||||
futures.transpose().get()
|
||||
|
Loading…
x
Reference in New Issue
Block a user