mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
Correct handling of trying to record state more than once
* Check transactions to be recorded before filtering rather than after, as currently if the entire list of transactions is already recorded, it's mis-reported as an empty input. * Notify listeners only of recorded transactions, not all
This commit is contained in:
parent
09f3dcd107
commit
1d965b1785
@ -90,8 +90,8 @@ interface ServiceHubInternal : PluginServiceHub {
|
||||
val configuration: NodeConfiguration
|
||||
|
||||
override fun recordTransactions(txs: Iterable<SignedTransaction>) {
|
||||
require (txs.any()) { "No transactions passed in for recording" }
|
||||
val recordedTransactions = txs.filter { validatedTransactions.addTransaction(it) }
|
||||
require(recordedTransactions.isNotEmpty()) { "No transactions passed in for recording" }
|
||||
val stateMachineRunId = FlowStateMachineImpl.currentStateMachine()?.id
|
||||
if (stateMachineRunId != null) {
|
||||
recordedTransactions.forEach {
|
||||
@ -101,7 +101,7 @@ interface ServiceHubInternal : PluginServiceHub {
|
||||
log.warn("Transactions recorded from outside of a state machine")
|
||||
}
|
||||
|
||||
val toNotify = txs.map { if (it.isNotaryChangeTransaction()) it.notaryChangeTx else it.tx }
|
||||
val toNotify = recordedTransactions.map { if (it.isNotaryChangeTransaction()) it.notaryChangeTx else it.tx }
|
||||
vaultService.notifyAll(toNotify)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user